Moved the update_assets_makefile script into the batools package

This commit is contained in:
Eric Froemling 2020-07-12 22:11:00 -07:00
parent 8f53e03cdb
commit 057717598d
4 changed files with 12 additions and 12 deletions

View File

@ -259,17 +259,14 @@ def _get_extras_targets_win(all_targets: Set[str], platform: str) -> str:
return out
def main() -> None:
def update_assets_makefile(projroot: str, check: bool) -> None:
"""Main script entry point."""
# pylint: disable=too-many-locals
from efrotools import getconfig
from pathlib import Path
# In 'check' mode we simply error on differences.
check = ('--check' in sys.argv)
# Always operate out of dist root dir.
os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '..'))
os.chdir(projroot)
public = getconfig(Path('.'))['public']
assert isinstance(public, bool)
@ -396,7 +393,3 @@ def _write_manifest(manifest_path: str, all_targets: Set[str],
print(f'{Clr.SBLU}Updating: {manifest_path}{Clr.RST}')
with open(manifest_path, 'w') as outfile:
outfile.write(json.dumps(manifest, indent=1))
if __name__ == '__main__':
main()

View File

@ -703,3 +703,10 @@ def stage_assets() -> None:
except CleanError as exc:
exc.pretty_print()
sys.exit(1)
def update_assets_makefile() -> None:
"""Update the assets makefile."""
from batools.assetsmakefile import update_assets_makefile as uam
check = ('--check' in sys.argv)
uam(projroot=str(PROJROOT), check=check)

View File

@ -55,7 +55,7 @@ from batools.pcommand import (
get_modern_make, warm_start_asset_build, update_docs_md, list_pip_reqs,
install_pip_reqs, checkenv, ensure_prefab_platform, prefab_run_var,
make_prefab, update_makebob, lazybuild, android_archive_unstripped_libs,
efro_gradle, stage_assets)
efro_gradle, stage_assets, update_assets_makefile)
# pylint: enable=unused-import
if TYPE_CHECKING:

View File

@ -634,8 +634,8 @@ class App:
sys.exit(255)
def _update_assets_makefile(self) -> None:
assert os.path.exists('tools/update_assets_makefile')
if os.system('tools/update_assets_makefile' + self._checkarg) != 0:
if os.system(f'tools/pcommand update_assets_makefile {self._checkarg}'
) != 0:
print(
f'{Clr.RED}Error checking/updating assets Makefile.f{Clr.RST}')
sys.exit(255)