mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-04 22:43:17 +08:00
Tidying and updates for pylint 2.6
This commit is contained in:
parent
fc7ee67246
commit
7c24de005f
@ -3928,16 +3928,16 @@
|
|||||||
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
|
"assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450",
|
||||||
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
|
"assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e",
|
||||||
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
|
"assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f",
|
||||||
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/47/8a/9ebc5daa1524ab2c28f110594713",
|
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/53/c6/dfcaf3da1e374c6b6a8cca85299d",
|
||||||
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/47/54/4afa32ce286c9fd1769d5974d806",
|
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b2/40/1070559af08278c0b05d854c7e09",
|
||||||
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a4/f6/70e8021e7eecd0ac2780c5290e20",
|
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/27/d1/36949ffb430b588fa40a12f7bcad",
|
||||||
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/5e/1c/1537e910399d1ff9f16597d9a687",
|
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/07/99/ce84901053a1515146805082f104",
|
||||||
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bb/6d/2d6e692c88f33c69bb2cf4346d41",
|
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/59/3f/9c5e6a8435d46f4318034552870e",
|
||||||
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a4/e7/364c1ffda791abc63375d6fcbf24",
|
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/89/b4/c88b4b1ed9e843f6f008c6988d20",
|
||||||
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/8d/5f/425c115720b7f176a9968b064aec",
|
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/67/f5/ce7f8ba6786caf2e5953d330be22",
|
||||||
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9b/1e/14c166e8608beb01074606b58b6d",
|
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ef/30/d06da2a6a373905a997d8b54062e",
|
||||||
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/9c/d1/91d2ba146c8c8cbb5a314321fe68",
|
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/68/31/b5c420f11b65a031649339df0015",
|
||||||
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/f0/f7/1aa0a6b5a48bc91b48f8314f6091",
|
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/0d/e3/191eae14cf956088ed1bd635d744",
|
||||||
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ac/22/f41a02837800ffdcd1ab00b8c860",
|
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/bb/3c/6e2ca3917b4120d42fab3777c2ae",
|
||||||
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/1d/4a/5c01f5243c5dcae456f8f2dbf63d"
|
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/32/9f/586ee4ca6c6068483defbf95c86d"
|
||||||
}
|
}
|
||||||
13
.idea/dictionaries/ericf.xml
generated
13
.idea/dictionaries/ericf.xml
generated
@ -29,8 +29,8 @@
|
|||||||
<w>achname</w>
|
<w>achname</w>
|
||||||
<w>achs</w>
|
<w>achs</w>
|
||||||
<w>acinstance</w>
|
<w>acinstance</w>
|
||||||
<w>ack</w>
|
|
||||||
<w>ack'ed</w>
|
<w>ack'ed</w>
|
||||||
|
<w>ack</w>
|
||||||
<w>acked</w>
|
<w>acked</w>
|
||||||
<w>acks</w>
|
<w>acks</w>
|
||||||
<w>acnt</w>
|
<w>acnt</w>
|
||||||
@ -149,8 +149,8 @@
|
|||||||
<w>bacommon</w>
|
<w>bacommon</w>
|
||||||
<w>badguy</w>
|
<w>badguy</w>
|
||||||
<w>bafoundation</w>
|
<w>bafoundation</w>
|
||||||
<w>ballistica</w>
|
|
||||||
<w>ballistica's</w>
|
<w>ballistica's</w>
|
||||||
|
<w>ballistica</w>
|
||||||
<w>ballisticacore</w>
|
<w>ballisticacore</w>
|
||||||
<w>ballisticacorecb</w>
|
<w>ballisticacorecb</w>
|
||||||
<w>bamaster</w>
|
<w>bamaster</w>
|
||||||
@ -780,8 +780,8 @@
|
|||||||
<w>gamedata</w>
|
<w>gamedata</w>
|
||||||
<w>gameinstance</w>
|
<w>gameinstance</w>
|
||||||
<w>gamemap</w>
|
<w>gamemap</w>
|
||||||
<w>gamepad</w>
|
|
||||||
<w>gamepad's</w>
|
<w>gamepad's</w>
|
||||||
|
<w>gamepad</w>
|
||||||
<w>gamepadadvanced</w>
|
<w>gamepadadvanced</w>
|
||||||
<w>gamepads</w>
|
<w>gamepads</w>
|
||||||
<w>gamepadselect</w>
|
<w>gamepadselect</w>
|
||||||
@ -1151,8 +1151,8 @@
|
|||||||
<w>lsqlite</w>
|
<w>lsqlite</w>
|
||||||
<w>lssl</w>
|
<w>lssl</w>
|
||||||
<w>lstart</w>
|
<w>lstart</w>
|
||||||
<w>lstr</w>
|
|
||||||
<w>lstr's</w>
|
<w>lstr's</w>
|
||||||
|
<w>lstr</w>
|
||||||
<w>lstrs</w>
|
<w>lstrs</w>
|
||||||
<w>lsval</w>
|
<w>lsval</w>
|
||||||
<w>ltex</w>
|
<w>ltex</w>
|
||||||
@ -1773,8 +1773,8 @@
|
|||||||
<w>sessionname</w>
|
<w>sessionname</w>
|
||||||
<w>sessionplayer</w>
|
<w>sessionplayer</w>
|
||||||
<w>sessionplayers</w>
|
<w>sessionplayers</w>
|
||||||
<w>sessionteam</w>
|
|
||||||
<w>sessionteam's</w>
|
<w>sessionteam's</w>
|
||||||
|
<w>sessionteam</w>
|
||||||
<w>sessionteams</w>
|
<w>sessionteams</w>
|
||||||
<w>sessiontype</w>
|
<w>sessiontype</w>
|
||||||
<w>setactivity</w>
|
<w>setactivity</w>
|
||||||
@ -2100,8 +2100,8 @@
|
|||||||
<w>txtw</w>
|
<w>txtw</w>
|
||||||
<w>typeargs</w>
|
<w>typeargs</w>
|
||||||
<w>typecheck</w>
|
<w>typecheck</w>
|
||||||
<w>typechecker</w>
|
|
||||||
<w>typechecker's</w>
|
<w>typechecker's</w>
|
||||||
|
<w>typechecker</w>
|
||||||
<w>typedval</w>
|
<w>typedval</w>
|
||||||
<w>typeshed</w>
|
<w>typeshed</w>
|
||||||
<w>typestr</w>
|
<w>typestr</w>
|
||||||
@ -2177,6 +2177,7 @@
|
|||||||
<w>vcruntime</w>
|
<w>vcruntime</w>
|
||||||
<w>vcxproj</w>
|
<w>vcxproj</w>
|
||||||
<w>venv</w>
|
<w>venv</w>
|
||||||
|
<w>verfilename</w>
|
||||||
<w>verlines</w>
|
<w>verlines</w>
|
||||||
<w>versioning</w>
|
<w>versioning</w>
|
||||||
<w>versionpredicate</w>
|
<w>versionpredicate</w>
|
||||||
|
|||||||
@ -218,12 +218,12 @@ class Map(Actor):
|
|||||||
# (and instruct the user if we weren't preloaded properly).
|
# (and instruct the user if we weren't preloaded properly).
|
||||||
try:
|
try:
|
||||||
self.preloaddata = _ba.getactivity().preloads[type(self)]
|
self.preloaddata = _ba.getactivity().preloads[type(self)]
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
from ba import _error
|
from ba import _error
|
||||||
raise _error.NotFoundError(
|
raise _error.NotFoundError(
|
||||||
'Preload data not found for ' + str(type(self)) +
|
'Preload data not found for ' + str(type(self)) +
|
||||||
'; make sure to call the type\'s preload()'
|
'; make sure to call the type\'s preload()'
|
||||||
' staticmethod in the activity constructor')
|
' staticmethod in the activity constructor') from exc
|
||||||
|
|
||||||
# Set various globals.
|
# Set various globals.
|
||||||
gnode = _ba.getactivity().globalsnode
|
gnode = _ba.getactivity().globalsnode
|
||||||
|
|||||||
@ -143,7 +143,8 @@ class Session:
|
|||||||
else:
|
else:
|
||||||
missing_info = [(d.cls, d.config) for d in exc.deps]
|
missing_info = [(d.cls, d.config) for d in exc.deps]
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f'Missing non-asset dependencies: {missing_info}')
|
f'Missing non-asset dependencies: {missing_info}'
|
||||||
|
) from exc
|
||||||
|
|
||||||
# Throw a combined exception if we found anything missing.
|
# Throw a combined exception if we found anything missing.
|
||||||
if missing_asset_packages:
|
if missing_asset_packages:
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class ServerManagerApp:
|
|||||||
try:
|
try:
|
||||||
self._config = self._load_config()
|
self._config = self._load_config()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
raise CleanError(f'Error loading config: {exc}')
|
raise CleanError(f'Error loading config: {exc}') from exc
|
||||||
self._done = False
|
self._done = False
|
||||||
self._process_commands: List[Union[str, ServerCommand]] = []
|
self._process_commands: List[Union[str, ServerCommand]] = []
|
||||||
self._process_commands_lock = Lock()
|
self._process_commands_lock = Lock()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
||||||
<h4><em>last updated on 2020-08-09 for Ballistica version 1.5.25 build 20166</em></h4>
|
<h4><em>last updated on 2020-08-21 for Ballistica version 1.5.25 build 20171</em></h4>
|
||||||
<p>This page documents the Python classes and functions in the 'ba' module,
|
<p>This page documents the Python classes and functions in the 'ba' module,
|
||||||
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
|
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@ -208,9 +208,10 @@ class App:
|
|||||||
subprocess.run(['make', '--quiet', 'prereqs'],
|
subprocess.run(['make', '--quiet', 'prereqs'],
|
||||||
check=True,
|
check=True,
|
||||||
cwd=self._project_root)
|
cwd=self._project_root)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError as exc:
|
||||||
raise CleanError('"make prereqs" check failed. '
|
raise CleanError(
|
||||||
'Install missing requirements and try again.')
|
'"make prereqs" check failed. '
|
||||||
|
'Install missing requirements and try again.') from exc
|
||||||
|
|
||||||
self._load_state()
|
self._load_state()
|
||||||
|
|
||||||
@ -439,6 +440,6 @@ if __name__ == '__main__':
|
|||||||
# Let's do a clean fail on keyboard interrupt.
|
# Let's do a clean fail on keyboard interrupt.
|
||||||
# Can make this optional if a backtrace is ever useful..
|
# Can make this optional if a backtrace is ever useful..
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except CleanError as exc:
|
except CleanError as clean_exc:
|
||||||
exc.pretty_print()
|
clean_exc.pretty_print()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import subprocess
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from efro.error import CleanError
|
||||||
from efro.terminal import Clr
|
from efro.terminal import Clr
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -46,10 +47,10 @@ class PipRequirement:
|
|||||||
|
|
||||||
|
|
||||||
PIP_REQUIREMENTS = [
|
PIP_REQUIREMENTS = [
|
||||||
PipRequirement(modulename='pylint', minversion=[2, 5, 3]),
|
PipRequirement(modulename='pylint', minversion=[2, 6, 0]),
|
||||||
PipRequirement(modulename='mypy', minversion=[0, 782]),
|
PipRequirement(modulename='mypy', minversion=[0, 782]),
|
||||||
PipRequirement(modulename='yapf', minversion=[0, 30, 0]),
|
PipRequirement(modulename='yapf', minversion=[0, 30, 0]),
|
||||||
PipRequirement(modulename='cpplint', minversion=[1, 5, 3]),
|
PipRequirement(modulename='cpplint', minversion=[1, 5, 4]),
|
||||||
PipRequirement(modulename='typing_extensions'),
|
PipRequirement(modulename='typing_extensions'),
|
||||||
PipRequirement(modulename='pytz'),
|
PipRequirement(modulename='pytz'),
|
||||||
PipRequirement(modulename='yaml', pipname='PyYAML'),
|
PipRequirement(modulename='yaml', pipname='PyYAML'),
|
||||||
@ -489,19 +490,19 @@ def checkenv() -> None:
|
|||||||
# Make sure they've got curl.
|
# Make sure they've got curl.
|
||||||
if subprocess.run(['which', 'curl'], check=False,
|
if subprocess.run(['which', 'curl'], check=False,
|
||||||
capture_output=True).returncode != 0:
|
capture_output=True).returncode != 0:
|
||||||
raise RuntimeError('curl is required; please install it.')
|
raise CleanError('curl is required; please install it.')
|
||||||
|
|
||||||
# Make sure they've got our target python version.
|
# Make sure they've got our target python version.
|
||||||
if subprocess.run(['which', PYTHON_BIN], check=False,
|
if subprocess.run(['which', PYTHON_BIN], check=False,
|
||||||
capture_output=True).returncode != 0:
|
capture_output=True).returncode != 0:
|
||||||
raise RuntimeError(f'{PYTHON_BIN} is required; please install it.')
|
raise CleanError(f'{PYTHON_BIN} is required; please install it.')
|
||||||
|
|
||||||
# Make sure they've got pip for that python version.
|
# Make sure they've got pip for that python version.
|
||||||
if subprocess.run(f'{PYTHON_BIN} -m pip --version',
|
if subprocess.run(f'{PYTHON_BIN} -m pip --version',
|
||||||
shell=True,
|
shell=True,
|
||||||
check=False,
|
check=False,
|
||||||
capture_output=True).returncode != 0:
|
capture_output=True).returncode != 0:
|
||||||
raise RuntimeError(
|
raise CleanError(
|
||||||
f'pip (for {PYTHON_BIN}) is required; please install it.')
|
f'pip (for {PYTHON_BIN}) is required; please install it.')
|
||||||
|
|
||||||
# Check for some required python modules.
|
# Check for some required python modules.
|
||||||
@ -522,12 +523,11 @@ def checkenv() -> None:
|
|||||||
check=False,
|
check=False,
|
||||||
capture_output=True)
|
capture_output=True)
|
||||||
if results.returncode != 0:
|
if results.returncode != 0:
|
||||||
raise RuntimeError(
|
raise CleanError(f'{packagename} (for {PYTHON_BIN}) is required.\n'
|
||||||
f'{packagename} (for {PYTHON_BIN}) is required.\n'
|
f'To install it, try: "{PYTHON_BIN}'
|
||||||
f'To install it, try: "{PYTHON_BIN}'
|
f' -m pip install {packagename}"\n'
|
||||||
f' -m pip install {packagename}"\n'
|
f'Alternately, "tools/pcommand install_pip_reqs"'
|
||||||
f'Alternately, "tools/pcommand install_pip_reqs"'
|
f' will update all pip requirements.')
|
||||||
f' will update all pip requirements.')
|
|
||||||
if minver is not None:
|
if minver is not None:
|
||||||
verlines = results.stdout.decode().splitlines()
|
verlines = results.stdout.decode().splitlines()
|
||||||
if verlines[0].startswith('Cpplint fork'):
|
if verlines[0].startswith('Cpplint fork'):
|
||||||
@ -537,7 +537,7 @@ def checkenv() -> None:
|
|||||||
vnums = [int(x) for x in ver_line.split()[-1].split('.')]
|
vnums = [int(x) for x in ver_line.split()[-1].split('.')]
|
||||||
assert len(vnums) == len(minver)
|
assert len(vnums) == len(minver)
|
||||||
if vnums < minver:
|
if vnums < minver:
|
||||||
raise RuntimeError(
|
raise CleanError(
|
||||||
f'{packagename} ver. {_vstr(minver)} or newer is required;'
|
f'{packagename} ver. {_vstr(minver)} or newer is required;'
|
||||||
f' found {_vstr(vnums)}.\n'
|
f' found {_vstr(vnums)}.\n'
|
||||||
f'To upgrade it, try: "{PYTHON_BIN}'
|
f'To upgrade it, try: "{PYTHON_BIN}'
|
||||||
|
|||||||
@ -551,11 +551,7 @@ def install_pip_reqs() -> None:
|
|||||||
def checkenv() -> None:
|
def checkenv() -> None:
|
||||||
"""Check for tools necessary to build and run the app."""
|
"""Check for tools necessary to build and run the app."""
|
||||||
import batools.build
|
import batools.build
|
||||||
from efro.error import CleanError
|
batools.build.checkenv()
|
||||||
try:
|
|
||||||
batools.build.checkenv()
|
|
||||||
except RuntimeError as exc:
|
|
||||||
raise CleanError(exc)
|
|
||||||
|
|
||||||
|
|
||||||
def ensure_prefab_platform() -> None:
|
def ensure_prefab_platform() -> None:
|
||||||
@ -620,13 +616,13 @@ def lazybuild() -> None:
|
|||||||
try:
|
try:
|
||||||
category = batools.build.SourceCategory(sys.argv[2])
|
category = batools.build.SourceCategory(sys.argv[2])
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
raise CleanError(exc)
|
raise CleanError(exc) from exc
|
||||||
target = sys.argv[3]
|
target = sys.argv[3]
|
||||||
command = ' '.join(sys.argv[4:])
|
command = ' '.join(sys.argv[4:])
|
||||||
try:
|
try:
|
||||||
batools.build.lazybuild(target, category, command)
|
batools.build.lazybuild(target, category, command)
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
raise CleanError(exc)
|
raise CleanError(exc) from exc
|
||||||
|
|
||||||
|
|
||||||
def android_archive_unstripped_libs() -> None:
|
def android_archive_unstripped_libs() -> None:
|
||||||
@ -730,3 +726,43 @@ def update_project() -> None:
|
|||||||
fix = '--fix' in sys.argv
|
fix = '--fix' in sys.argv
|
||||||
|
|
||||||
Updater(check=check, fix=fix).run()
|
Updater(check=check, fix=fix).run()
|
||||||
|
|
||||||
|
|
||||||
|
def cmake_prep_dir() -> None:
|
||||||
|
"""Create a dir, recreating it when cmake version changes.
|
||||||
|
|
||||||
|
Useful to prevent builds from breaking when cmake is updated.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from efro.error import CleanError
|
||||||
|
from efro.terminal import Clr
|
||||||
|
|
||||||
|
if len(sys.argv) != 3:
|
||||||
|
raise CleanError('Expected 1 arg (dir name)')
|
||||||
|
dirname = sys.argv[2]
|
||||||
|
|
||||||
|
# Look for cmake version associated with the dir.
|
||||||
|
verfilename = os.path.join(dirname, '.ba_cmake_version')
|
||||||
|
ver: Optional[str]
|
||||||
|
if os.path.isfile(verfilename):
|
||||||
|
with open(verfilename) as infile:
|
||||||
|
ver = infile.read()
|
||||||
|
else:
|
||||||
|
ver = None
|
||||||
|
|
||||||
|
# Get version of installed cmake.
|
||||||
|
cmake_ver_output = subprocess.run(['cmake', '--version'],
|
||||||
|
check=True,
|
||||||
|
capture_output=True).stdout.decode()
|
||||||
|
cmake_ver = cmake_ver_output.splitlines()[0].split('cmake version ')[1]
|
||||||
|
|
||||||
|
# If they don't match, blow away the dir and write the current version.
|
||||||
|
if ver != cmake_ver:
|
||||||
|
if ver is not None:
|
||||||
|
print(f'{Clr.BLU}CMake version changed from {ver} to {cmake_ver};'
|
||||||
|
f' clearing existing build at "{dirname}".{Clr.RST}')
|
||||||
|
subprocess.run(['rm', '-rf', dirname], check=True)
|
||||||
|
os.makedirs(dirname, exist_ok=True)
|
||||||
|
with open(verfilename, 'w') as outfile:
|
||||||
|
outfile.write(cmake_ver)
|
||||||
|
|||||||
@ -121,8 +121,8 @@ def cpplint(projroot: Path, full: bool) -> None:
|
|||||||
# We want to do a few custom modifications to the cpplint module...
|
# We want to do a few custom modifications to the cpplint module...
|
||||||
try:
|
try:
|
||||||
import cpplint as cpplintmodule
|
import cpplint as cpplintmodule
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
raise CleanError('Unable to import cpplint')
|
raise CleanError('Unable to import cpplint.') from exc
|
||||||
with open(cpplintmodule.__file__) as infile:
|
with open(cpplintmodule.__file__) as infile:
|
||||||
codelines = infile.read().splitlines()
|
codelines = infile.read().splitlines()
|
||||||
cheadersline = codelines.index('_C_HEADERS = frozenset([')
|
cheadersline = codelines.index('_C_HEADERS = frozenset([')
|
||||||
@ -598,8 +598,8 @@ def mypy(projroot: Path, full: bool) -> None:
|
|||||||
starttime = time.time()
|
starttime = time.time()
|
||||||
try:
|
try:
|
||||||
runmypy(projroot, filenames, full)
|
runmypy(projroot, filenames, full)
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
raise CleanError('Mypy failed.')
|
raise CleanError('Mypy failed.') from exc
|
||||||
duration = time.time() - starttime
|
duration = time.time() - starttime
|
||||||
print(f'{Clr.GRN}Mypy passed in {duration:.1f} seconds.{Clr.RST}',
|
print(f'{Clr.GRN}Mypy passed in {duration:.1f} seconds.{Clr.RST}',
|
||||||
flush=True)
|
flush=True)
|
||||||
@ -625,8 +625,8 @@ def dmypy(projroot: Path) -> None:
|
|||||||
'.mypy.ini', '--follow-imports=error', '--pretty'
|
'.mypy.ini', '--follow-imports=error', '--pretty'
|
||||||
] + filenames
|
] + filenames
|
||||||
subprocess.run(args, check=True)
|
subprocess.run(args, check=True)
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
raise CleanError('Mypy daemon: fail.')
|
raise CleanError('Mypy daemon: fail.') from exc
|
||||||
duration = time.time() - starttime
|
duration = time.time() - starttime
|
||||||
print(f'{Clr.GRN}Mypy daemon passed in {duration:.1f} seconds.{Clr.RST}',
|
print(f'{Clr.GRN}Mypy daemon passed in {duration:.1f} seconds.{Clr.RST}',
|
||||||
flush=True)
|
flush=True)
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class NoIndentEncoder(json.JSONEncoder):
|
|||||||
"""Our custom encoder implementing selective indentation."""
|
"""Our custom encoder implementing selective indentation."""
|
||||||
|
|
||||||
def __init__(self, *args: Any, **kwargs: Any):
|
def __init__(self, *args: Any, **kwargs: Any):
|
||||||
super(NoIndentEncoder, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.kwargs = dict(kwargs)
|
self.kwargs = dict(kwargs)
|
||||||
del self.kwargs['indent']
|
del self.kwargs['indent']
|
||||||
self._replacement_map: Dict = {}
|
self._replacement_map: Dict = {}
|
||||||
@ -55,10 +55,10 @@ class NoIndentEncoder(json.JSONEncoder):
|
|||||||
key = uuid.uuid4().hex
|
key = uuid.uuid4().hex
|
||||||
self._replacement_map[key] = json.dumps(o.value, **self.kwargs)
|
self._replacement_map[key] = json.dumps(o.value, **self.kwargs)
|
||||||
return '@@%s@@' % (key, )
|
return '@@%s@@' % (key, )
|
||||||
return super(NoIndentEncoder, self).default(o)
|
return super().default(o)
|
||||||
|
|
||||||
def encode(self, o: Any) -> Any:
|
def encode(self, o: Any) -> Any:
|
||||||
result = super(NoIndentEncoder, self).encode(o)
|
result = super().encode(o)
|
||||||
for k, v in self._replacement_map.items():
|
for k, v in self._replacement_map.items():
|
||||||
result = result.replace('"@@%s@@"' % (k, ), v)
|
result = result.replace('"@@%s@@"' % (k, ), v)
|
||||||
return result
|
return result
|
||||||
|
|||||||
@ -297,8 +297,8 @@ def runmypy() -> None:
|
|||||||
try:
|
try:
|
||||||
efrotools.code.runmypy(PROJROOT, filenames)
|
efrotools.code.runmypy(PROJROOT, filenames)
|
||||||
print(f'{Clr.GRN}Mypy Passed.{Clr.RST}')
|
print(f'{Clr.GRN}Mypy Passed.{Clr.RST}')
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
raise CleanError('Mypy Failed.')
|
raise CleanError('Mypy Failed.') from exc
|
||||||
|
|
||||||
|
|
||||||
def dmypy() -> None:
|
def dmypy() -> None:
|
||||||
|
|||||||
@ -55,7 +55,7 @@ from batools.pcommand import (
|
|||||||
list_pip_reqs, install_pip_reqs, checkenv, ensure_prefab_platform,
|
list_pip_reqs, install_pip_reqs, checkenv, ensure_prefab_platform,
|
||||||
prefab_run_var, make_prefab, update_makebob, lazybuild,
|
prefab_run_var, make_prefab, update_makebob, lazybuild,
|
||||||
android_archive_unstripped_libs, efro_gradle, stage_assets,
|
android_archive_unstripped_libs, efro_gradle, stage_assets,
|
||||||
update_assets_makefile, update_project)
|
update_assets_makefile, update_project, cmake_prep_dir)
|
||||||
# pylint: enable=unused-import
|
# pylint: enable=unused-import
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user