tidying meta output

This commit is contained in:
Eric Froemling 2021-06-18 11:06:26 -05:00
parent f2ee4750a1
commit 5e75816d27
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
6 changed files with 42 additions and 20 deletions

View File

@ -3944,18 +3944,18 @@
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/7b/ac1a200be0f37078af0991faca3b",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/34/ff/358a7048f00432e0a1f3f2f6892a",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/97/3b/576fc32f9ec58ab4dfd83a30c2f3",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5f/77/6b483eaaee3360bbf6d4b1c4edfd",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/4c/d9/dcefa7433496e23d6722bec45c83",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/0d/bd/017a33857704529facbd1668a3d9",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/69/8a/9971f043234f42709ba180cacebf",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2a/b5/2e5d1109ab74691e54c4718c9bdf",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/54/d5/a64a1e3b4d07570b8346d3f012b7",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/08/04/55e83377e63f6aee5fbb1c0b3e40",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/54/fa/0a83f54428b6e1e800d73580cdb2",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/05/55/a1af91dbfbd65c28acfa74bb9195",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/93/b5/7e6ccee496778a6b59ff2821fdfe",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8d/ac/62521ee29f4b952b318a3c70d78c",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/39/7a/d32929d332be578e9ab615775ff0",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/4c/22/6b9f9f3ad25ee086176b39210b7b",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8d/5b/48fbb571a3f4c5d92d20a74c1315",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/c1/fb/e16517fbab5ec2d7fcb9bab1a733",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/c8/b0/0a05c54cdaff68b90963791021aa",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/01/c0/87a990c2ed155abc253aed53a6b0",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/b3/47/0fe64df855db157bc3f99202314c",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/e2/98/f34747aa2f4cb5c7c7eb79bf12e3",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/28/88/800c382835568db912616b223c0e",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9a/32/bda06e355384dac2fc81c8357812",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/34/f6/b4db57144d47cfdb153dd4de6742",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/53/44/cf4405c2ebe2695d55858129d3fe",
@ -3972,14 +3972,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b5/5b/0390ee8916f97d302cde3ea356bc",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/ee/8249ede29becc0cd41178924b6dc",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c0/5f/e89024a87dd092f6e0cc43afb707",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/bf/30/702511c5151e8c1953d402e91911",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/d8/44/7e213b937bc99d5ea48786a4bb6b",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/96/73/ee9bf0100649d8a8761e3f7384f6",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/b8/35/dbe63ddf903e21e0abf625f00780",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/9a/12/acb7aa1d3f99e2ff3290131cad2a",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/b9/70/7be47fa6f8d302c4e8ee4d250a6e",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/e8/9e/ba039e7a6c842b6cedbe07d21481",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/ec/82/f1318f738093caf043baf2de3b1d",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/6e/9a/f56dfc87cbcfe3db96a59729c95c",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/8f/34/161cc168673655f74570039ecf60",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/7c/b7/42061e80899861ec9b6854e940f3",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/11/94/c7403ce06b9a74d21b9e835e78f8",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/c1/84/2093f24945d0e858f7dab4473369",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/8d/8c/dc1d33754f442496d932cb6c1bb3",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/6f/71/a3fb9582f561435cc206f2cb4579",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/ed/25/8359de107bc51204177cbab4279d",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/fc/b5/62133319c6df8567aecfd29b1204",
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/8d/96/c1516dee7d458c9065597e0aede6"
}

View File

@ -1713,6 +1713,7 @@
<w>prereq</w>
<w>prereqs</w>
<w>prerun</w>
<w>prettypath</w>
<w>prevstate</w>
<w>priceraw</w>
<w>printcolors</w>
@ -1735,6 +1736,7 @@
<w>projectpath</w>
<w>projectroot</w>
<w>projpath</w>
<w>projprefix</w>
<w>projroot</w>
<w>projs</w>
<w>promocode</w>

View File

@ -780,6 +780,7 @@
<w>prepdata</w>
<w>prereq</w>
<w>prerun</w>
<w>prettypath</w>
<w>printf</w>
<w>printnodes</w>
<w>printobjects</w>
@ -790,6 +791,7 @@
<w>proj</w>
<w>projdir</w>
<w>projpath</w>
<w>projprefix</w>
<w>prolly</w>
<w>psmx</w>
<w>pspec</w>

View File

@ -941,18 +941,22 @@ def gen_python_enums_module() -> None:
from batools.pythonenumsmodule import generate
if len(sys.argv) != 4:
raise Exception('Expected infile and outfile args.')
generate(infilename=sys.argv[2], outfilename=sys.argv[3])
generate(projroot=str(PROJROOT),
infilename=sys.argv[2],
outfilename=sys.argv[3])
def gen_python_init_module() -> None:
"""Generate a basic __init__.py."""
import os
from efro.terminal import Clr
from batools.project import project_centric_path
if len(sys.argv) != 3:
raise Exception('Expected an outfile arg.')
outfilename = sys.argv[2]
os.makedirs(os.path.dirname(outfilename), exist_ok=True)
print(f'Meta-building {Clr.BLD}{outfilename}{Clr.RST}')
prettypath = project_centric_path(projroot=str(PROJROOT), path=outfilename)
print(f'Meta-building {Clr.BLD}{prettypath}{Clr.RST}')
with open(outfilename, 'w') as outfile:
outfile.write('# Released under the MIT License.'
' See LICENSE for details.\n'

View File

@ -18,6 +18,18 @@ if TYPE_CHECKING:
from typing import Optional, Tuple, List, Dict, Set
def project_centric_path(projroot: str, path: str) -> str:
"""Convert a CWD-relative path to a project-relative one."""
abspath = os.path.abspath(path)
if abspath == projroot:
return '.'
projprefix = f'{projroot}/'
if not abspath.startswith(projprefix):
raise RuntimeError(
f'Path "{abspath}" is not under project root "{projprefix}"')
return abspath[len(projprefix):]
def get_legal_notice_private() -> str:
"""Return the one line legal notice we expect private files to have."""
return 'Copyright (c) 2011-2021 Eric Froemling'

View File

@ -137,8 +137,9 @@ def _parse_doc_lines(lines: List[str], lnum: int) -> Tuple[List[str], int]:
return doclines, lnum
def generate(infilename: str, outfilename: str) -> None:
def generate(projroot: str, infilename: str, outfilename: str) -> None:
"""Main script entry point."""
from batools.project import project_centric_path
out = (get_public_license('python') +
f'\n"""Enum vals generated by {__name__}; do not edit by hand."""'
@ -146,7 +147,8 @@ def generate(infilename: str, outfilename: str) -> None:
out += _gen_enums(infilename)
print(f'Meta-building {Clr.BLD}{outfilename}{Clr.RST}')
path = project_centric_path(projroot=projroot, path=outfilename)
print(f'Meta-building {Clr.BLD}{path}{Clr.RST}')
os.makedirs(os.path.dirname(outfilename), exist_ok=True)
with open(outfilename, 'w') as outfile:
outfile.write(out)