From 1d631f9b0d95ac2fc3fcbfab01e2f181a6c64167 Mon Sep 17 00:00:00 2001 From: Calvin Spealman Date: Sun, 3 May 2020 09:24:59 -0400 Subject: [PATCH 1/5] Update to Python 3.8.2 --- feet/feet.py | 17 ++++++++--------- feetmaker.py | 11 ++++++----- tests/test_build.py | 19 +++++++++++-------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/feet/feet.py b/feet/feet.py index f3015c0..6991b8a 100644 --- a/feet/feet.py +++ b/feet/feet.py @@ -2,6 +2,7 @@ import fnmatch import glob import os +import pkg_resources import shutil import subprocess import sys @@ -21,8 +22,6 @@ # TODO: Decide if this is necessary...? sys.path.insert(0, '.') -import requirements - HELP = """FEET, it makes Python run! @@ -159,18 +158,18 @@ def main(argv): cur_libraries = {} if os.path.exists('requirements.txt'): - for line in requirements.parse(open('requirements.txt')): - cur_libraries[line.name] = line.line - new_req = list(requirements.parse(args.spec))[0] - cur_libraries[new_req.name] = new_req.line + for req in pkg_resources.parse_requirements(open('requirements.txt')): + cur_libraries[req.name] = req.specifier + new_req = list(pkg_resources.parse_requirements(args.spec))[0] + cur_libraries[new_req.name] = new_req.specifier - args = ['install', '--trusted-host=pypi.org', new_req.line] + args = ['install', '--trusted-host=pypi.org', args.spec] subprocess.check_call([py_bin, '-m', 'pip', *args]) print("Updating project requirements.txt file...") with open('requirements.txt', 'w') as f: - for _, line in cur_libraries.items(): - f.write(f'{line}\n') + for name, spec in cur_libraries.items(): + f.write(f'{name}{spec}\n') elif args.command == 'exe': name = args.name diff --git a/feetmaker.py b/feetmaker.py index 5b0b506..75d17c8 100644 --- a/feetmaker.py +++ b/feetmaker.py @@ -26,7 +26,7 @@ setup_parser = subparsers.add_parser('setup') python_parser = subparsers.add_parser('python') -python_parser.add_argument('-p', dest='pyversion', action='store', default='3.7') +python_parser.add_argument('-p', dest='pyversion', action='store', default='v3.8.2') version = open("VERSION.txt").read() arch = "amd64" # win32 or amd64 @@ -51,7 +51,7 @@ # These third-party packages will be included in the build py_deps = ( 'pip', - 'requirements-parser', + # 'requirements-parser', 'setuptools', # 'pkg_resources', ) @@ -144,7 +144,8 @@ def main(): subprocess.check_call(f"git clone https://github.com/python/cpython.git {python_loc}") os.chdir(python_loc) subprocess.check_call("git fetch") - subprocess.check_call(f"git reset --hard origin/{args.pyversion}") + subprocess.check_call("git reset --hard HEAD") + subprocess.check_call(f"git checkout {args.pyversion}") os.chdir('..') assert os.path.exists(f"./{python_loc}/PCBuild/build.bat") @@ -194,7 +195,7 @@ def main(): zipdir( os.path.join(python_loc, "lib"), None, - os.path.join("feet", "cpython", "python37.zip"), + os.path.join("feet", "cpython", "python38.zip"), zipfile.ZIP_DEFLATED, ) @@ -231,7 +232,7 @@ def main(): base = open('target/debug/feet.exe', 'rb') archive = open('feetruntime.zip', 'rb') - output = args.output or 'build/feet-{arch}-{version}' + output = args.output or f'build/feet-{arch}-{version}' if not output.endswith('.exe'): output += '.exe' final = open(output, 'wb') diff --git a/tests/test_build.py b/tests/test_build.py index e304f27..c3d6f4f 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -68,7 +68,7 @@ def test_run(tempdir): assert ret == 0, stderr MAIN_SETUPTOOLS = ''' -import future +import sdl2 print("ok") ''' @@ -77,11 +77,12 @@ def test_setuptools_package(rundir, tempdir, build): dest = os.path.join(tempdir, 'feet.exe') copyfile(src, dest) - call('./feet.exe library future') - assert not os.path.exists('./Lib') - open('main.py', 'w').write(MAIN_SETUPTOOLS) + call('./feet.exe library pysdl2-dll') + call('./feet.exe library pysdl2') + assert not os.path.exists('./Lib') + p = Popen("feet.exe", stdout=PIPE, universal_newlines=True) stdout, stderr = p.communicate() ret = p.returncode @@ -97,8 +98,9 @@ def test_exe(rundir, tempdir, build): open('main.py', 'w').write(MAIN_SETUPTOOLS) - call('./feet.exe library future') - assert os.path.exists('feet_data/cpython/lib/site-packages/future') + call('./feet.exe library pysdl2-dll') + call('./feet.exe library pysdl2') + assert os.path.exists('feet_data/cpython/lib/site-packages/sdl2') call('./feet.exe exe testprog.exe main.py') with TemporaryDirectory() as exedir: copyfile('dist/testprog.exe', os.path.join(exedir, 'testprog.exe')) @@ -122,8 +124,9 @@ def test_zip(rundir, tempdir, build): open('main.py', 'w').write(MAIN_SETUPTOOLS) - call('./feet.exe library future') - assert os.path.exists('feet_data/cpython/lib/site-packages/future') + call('./feet.exe library pysdl2-dll') + call('./feet.exe library pysdl2') + assert os.path.exists('feet_data/cpython/lib/site-packages/sdl2') call('./feet.exe zip testprog.zip') with TemporaryDirectory() as exedir: copyfile('dist/testprog.zip', os.path.join(exedir, 'testprog.zip')) From 48fba75a510955cd7b0950f7d44cb81715e2f3d6 Mon Sep 17 00:00:00 2001 From: Calvin Spealman Date: Sun, 3 May 2020 23:14:53 -0400 Subject: [PATCH 2/5] New utility to detect auto-include of files for packaging, and tests --- feet/feet.py | 52 ++++++++++++++++++++++++++++++++--------- tests/__init__.py | 0 tests/test_app_files.py | 43 ++++++++++++++++++++++++++++++++++ tests/test_build.py | 33 ++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 11 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/test_app_files.py diff --git a/feet/feet.py b/feet/feet.py index 6991b8a..bb4f5f0 100644 --- a/feet/feet.py +++ b/feet/feet.py @@ -9,13 +9,29 @@ import zipfile root = os.path.abspath(os.path.dirname(__file__)) -feet_bin = root.split('_data')[0] + '.exe' + +def _set_root_relative(): + global feet_bin + global site_packages + global zip_excludes + + feet_bin = root.split('_data')[0] + '.exe' + site_packages = os.path.join(root, 'cpython', 'lib', 'site-packages') + + zip_excludes = [ + "*.pyc", + "*__pycache__*", + "dist", + os.path.basename(root), + os.path.basename(feet_bin), + ] + +_set_root_relative() # Add path for included third-party packages with the Feet runtime sys.path.insert(0, os.path.join(sys.executable, 'Lib', 'site-packages')) # Add path for project required Python dependencies -site_packages = os.path.join(root, 'cpython', 'lib', 'site-packages') sys.path.insert(0, site_packages) # Add path for the actual project, main script and all @@ -66,10 +82,6 @@ zip_parser.add_argument('name', type=str, action='store') zip_parser.add_argument('files', type=str, nargs='*') -zip_excludes = [ - "*.pyc", - "*__pycache__*", -] def add_to_zip(path, dest, compression, prefix=None): if prefix is None: @@ -101,6 +113,21 @@ def add_to_zip(path, dest, compression, prefix=None): zipf.close() +def get_app_files(files): + if files: + yield from files + else: + for fn in os.listdir('.'): + include = True + for exc in zip_excludes: + if fnmatch.fnmatch(fn, exc): + include = False + break + if include: + yield fn + + + def main(argv): feet_exec = argv.pop(0) args = parser.parse_args(argv) @@ -108,9 +135,10 @@ def main(argv): assert os.path.exists(feet_bin) py_bin = os.path.join(root, "cpython", "python.exe") - main = os.path.join(root, "app", "main.py") + main = os.path.join(root, "app", "main.py") if not os.path.exists(main): - main = os.path.join(root, "..", "main.py") + main = os.path.join(root, "..", "main.py") + main = os.path.abspath(main) if not os.path.exists(main): print(HELP) exit(1) @@ -124,6 +152,7 @@ def main(argv): }) proc = subprocess.Popen( [py_bin, main], + cwd=os.path.dirname(main), env=env, stdout=sys.stdout, stderr=sys.stderr, @@ -180,15 +209,16 @@ def main(argv): if not os.path.exists('dist'): os.mkdir('dist') - include = args.files or [main] + include = args.files or [os.path.basename(main)] zip_excludes.append(os.path.join(os.path.abspath(root), '*')) zip_excludes.append(os.path.join(os.path.abspath("dist"), '*')) shutil.copy(feet_bin, name) zf = zipfile.ZipFile(name, 'a', zipfile.ZIP_BZIP2) - for pattern in include: - for f in glob.glob(pattern): + for f in include: + # for pattern in include: + # for f in glob.glob(pattern): print(f, "->", os.path.join("feet", "app", f)) zf.write(f, os.path.join("feet", "app", f)) zf.close() diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_app_files.py b/tests/test_app_files.py new file mode 100644 index 0000000..fdc2440 --- /dev/null +++ b/tests/test_app_files.py @@ -0,0 +1,43 @@ +import sys +sys.path.append('feet') + +from unittest.mock import patch + +import pytest + +import feet +feet.root = 'c:/__fake__/feet_data' +feet._set_root_relative() + + +def test_one_file(): + files = [] + + with patch('os.listdir') as listdir: + listdir.return_value = ['main.py'] + include = list(feet.get_app_files(files)) + assert include == ['main.py'] + + +def test_auto_scripts(): + files = [] + + with patch('os.listdir') as listdir: + listdir.return_value = ['main.py', 'foo.py'] + include = list(feet.get_app_files(files)) + assert include == ['main.py', 'foo.py'] + + +def test_excludes(): + files = [ + 'dist', + 'foo.pyc', + 'feet_data', + 'feet.exe', + 'main.py', + ] + + with patch('os.listdir') as listdir: + listdir.return_value = files + include = list(feet.get_app_files(None)) + assert include == ['main.py',] \ No newline at end of file diff --git a/tests/test_build.py b/tests/test_build.py index c3d6f4f..5eb48c3 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -3,6 +3,7 @@ import os from shutil import copyfile from subprocess import call, Popen, PIPE +import sys from tempfile import TemporaryDirectory from time import sleep from zipfile import ZipFile @@ -117,6 +118,38 @@ def test_exe(rundir, tempdir, build): assert lines and lines[-1] == "ok", stderr +def test_exe_auto(rundir, tempdir, build): + src = os.path.join(rundir, 'build', 'feet.exe') + dest = os.path.join(tempdir, 'feet.exe') + copyfile(src, dest) + + open('main.py', 'w').write(MAIN_SETUPTOOLS) + open('module.py', 'w').write("") + open('compiled.pyc', 'w').write("") + + call('./feet.exe library pysdl2-dll') + call('./feet.exe library pysdl2') + assert os.path.exists('feet_data/cpython/lib/site-packages/sdl2') + call('./feet.exe exe testprog.exe') + with TemporaryDirectory() as exedir: + copyfile('dist/testprog.exe', os.path.join(exedir, 'testprog.exe')) + + with cd(exedir): + assert 0 == call('./testprog.exe setup', stdout=sys.stdout, stderr=sys.stderr), str(os.listdir(exedir)) + + print("Running test program") + p = Popen("testprog.exe", stdout=PIPE, stderr=PIPE, universal_newlines=True) + stdout, stderr = p.communicate() + ret = p.returncode + + lines = stdout.splitlines() + assert lines and lines[-1] == "ok", stderr + + assert os.path.exists(os.path.join(exedir, 'testprog_data', 'app', 'main.py')) + assert os.path.exists(os.path.join(exedir, 'testprog_data', 'app', 'module.py')) + assert not os.path.exists(os.path.join(exedir, 'testprog_data', 'app', 'compiled.pyc')) + + def test_zip(rundir, tempdir, build): src = os.path.join(rundir, 'build', 'feet.exe') dest = os.path.join(tempdir, 'feet.exe') From 5a3ccca6474735a474279ab1e66286d6f08690fe Mon Sep 17 00:00:00 2001 From: Calvin Spealman Date: Mon, 4 May 2020 22:00:46 -0400 Subject: [PATCH 3/5] Use new packing utility for exe and zip commands --- feet/feet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feet/feet.py b/feet/feet.py index bb4f5f0..74502d8 100644 --- a/feet/feet.py +++ b/feet/feet.py @@ -209,7 +209,7 @@ def main(argv): if not os.path.exists('dist'): os.mkdir('dist') - include = args.files or [os.path.basename(main)] + include = get_app_files(args.files) zip_excludes.append(os.path.join(os.path.abspath(root), '*')) zip_excludes.append(os.path.join(os.path.abspath("dist"), '*')) @@ -235,7 +235,7 @@ def main(argv): if not os.path.exists("dist"): os.makedirs("dist") - include = args.files or [main] + include = get_app_files(args.files) zip_excludes.append(os.path.join(os.path.abspath(root), '*')) zip_excludes.append(os.path.join(os.path.abspath("dist"), '*')) From 1881814c9548adf89308fb1751bbd48ba0f1b75b Mon Sep 17 00:00:00 2001 From: Calvin Spealman Date: Sun, 10 May 2020 20:00:38 -0400 Subject: [PATCH 4/5] Controllable arch builds, smaller bootload binary, updated zip command --- VERSION.txt | 2 +- build_all.bat | 4 ++++ feet/feet.py | 51 +++++++++++++++++++---------------------- feetmaker.py | 26 ++++++++++++++------- tests/test_app_files.py | 6 +++-- tests/test_build.py | 6 +++-- 6 files changed, 54 insertions(+), 41 deletions(-) create mode 100644 build_all.bat diff --git a/VERSION.txt b/VERSION.txt index fa3de58..69289ba 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.0.5 \ No newline at end of file +0.6.0rc1 \ No newline at end of file diff --git a/build_all.bat b/build_all.bat new file mode 100644 index 0000000..4d3715b --- /dev/null +++ b/build_all.bat @@ -0,0 +1,4 @@ +python feetmaker.py python -a amd64 +python feetmaker.py build -a amd64 +python feetmaker.py python -a win32 +python feetmaker.py build -a win32 \ No newline at end of file diff --git a/feet/feet.py b/feet/feet.py index 74502d8..b8022aa 100644 --- a/feet/feet.py +++ b/feet/feet.py @@ -1,6 +1,7 @@ import argparse import fnmatch import glob +import itertools import os import pkg_resources import shutil @@ -21,9 +22,9 @@ def _set_root_relative(): zip_excludes = [ "*.pyc", "*__pycache__*", - "dist", - os.path.basename(root), - os.path.basename(feet_bin), + "dist*", + ".git*", + os.path.basename(root) + '*', ] _set_root_relative() @@ -77,6 +78,7 @@ def _set_root_relative(): exe_parser = subparsers.add_parser('exe') exe_parser.add_argument('name', type=str, action='store') exe_parser.add_argument('files', type=str, nargs='*') +exe_parser.add_argument('--confirm', action='store_true') zip_parser = subparsers.add_parser('zip') zip_parser.add_argument('name', type=str, action='store') @@ -84,8 +86,6 @@ def _set_root_relative(): def add_to_zip(path, dest, compression, prefix=None): - if prefix is None: - prefix = os.path.join("feet", "app") zipf = zipfile.ZipFile(dest, 'a', compression) for root, _, files in os.walk(path): @@ -93,33 +93,34 @@ def add_to_zip(path, dest, compression, prefix=None): src = os.path.join(root, file) name = os.path.relpath(src, ".") base = name.split(os.path.sep, 1)[0] - if base.endswith('_data'): - name = name.replace(base, 'feet', 1) + # print(name, '...', end='') excluded = False for pattern in zip_excludes: - if fnmatch.fnmatch(os.path.abspath(name), pattern): + if fnmatch.fnmatch(name, pattern): excluded = True + # print('skip') break if not excluded: - name = os.path.relpath(os.path.join(prefix, name)) + # print('ok') + if prefix: + name = os.path.relpath(os.path.join(prefix, name)) name = name.replace('\\', '/') try: zipf.getinfo(name) except KeyError: - print("...", name) zipf.write(src, name) zipf.close() -def get_app_files(files): +def get_app_files(files, exclude=()): if files: yield from files else: for fn in os.listdir('.'): include = True - for exc in zip_excludes: + for exc in itertools.chain(zip_excludes, exclude): if fnmatch.fnmatch(fn, exc): include = False break @@ -201,6 +202,9 @@ def main(argv): f.write(f'{name}{spec}\n') elif args.command == 'exe': + if not args.confirm: + print("The exe packing command is experimental. Use --confirm to confirm opting into using it.") + exit(1) name = args.name if not name.endswith('.exe'): name += ".exe" @@ -209,22 +213,17 @@ def main(argv): if not os.path.exists('dist'): os.mkdir('dist') - include = get_app_files(args.files) - zip_excludes.append(os.path.join(os.path.abspath(root), '*')) - zip_excludes.append(os.path.join(os.path.abspath("dist"), '*')) shutil.copy(feet_bin, name) + include = get_app_files(args.files, exclude=[feet_bin]) + prefix = '.' zf = zipfile.ZipFile(name, 'a', zipfile.ZIP_BZIP2) for f in include: - # for pattern in include: - # for f in glob.glob(pattern): - print(f, "->", os.path.join("feet", "app", f)) - zf.write(f, os.path.join("feet", "app", f)) + zf.write(f, os.path.join(prefix, f)) zf.close() - if os.path.exists(site_packages): - add_to_zip(site_packages, name, zipfile.ZIP_BZIP2, prefix='.') + add_to_zip(".", name, zipfile.ZIP_BZIP2, prefix=prefix) elif args.command == 'zip': name = args.name @@ -236,14 +235,10 @@ def main(argv): os.makedirs("dist") include = get_app_files(args.files) - zip_excludes.append(os.path.join(os.path.abspath(root), '*')) - zip_excludes.append(os.path.join(os.path.abspath("dist"), '*')) - zf = zipfile.ZipFile(name, 'a', zipfile.ZIP_BZIP2) - for pattern in include: - for f in glob.glob(pattern): - print(f, "->", os.path.join("feet", "app", f)) - zf.write(f, os.path.join("feet", "app", f)) + zf = zipfile.ZipFile(name, 'a', zipfile.ZIP_DEFLATED) + for f in include: + zf.write(f, f) zf.close() add_to_zip(".", name, zipfile.ZIP_DEFLATED, prefix=".") diff --git a/feetmaker.py b/feetmaker.py index 75d17c8..473838a 100644 --- a/feetmaker.py +++ b/feetmaker.py @@ -2,6 +2,7 @@ import argparse import fnmatch +import json import logging import os import shutil @@ -20,6 +21,7 @@ build_parser = subparsers.add_parser('build') build_parser.add_argument('--debug', action='store_true') build_parser.add_argument('-o', action='store', default=None, dest='output') +build_parser.add_argument('-a', '--arch', dest='arch', action='store', default='win32', choices=['win32', 'amd64']) clean_parser = subparsers.add_parser('clean') @@ -27,12 +29,11 @@ python_parser = subparsers.add_parser('python') python_parser.add_argument('-p', dest='pyversion', action='store', default='v3.8.2') +python_parser.add_argument('-a', '--arch', dest='arch', action='store', default='win32', choices=['win32', 'amd64']) version = open("VERSION.txt").read() -arch = "amd64" # win32 or amd64 python_loc_default = "cpython" python_loc = os.getenv("FEET_PYTHON_DIR", python_loc_default) -py_bin = os.path.join(python_loc, 'PCBuild', arch, 'python.exe') # These patterns will be excluded from the generated Zip archives zip_excludes = [ @@ -149,10 +150,10 @@ def main(): os.chdir('..') assert os.path.exists(f"./{python_loc}/PCBuild/build.bat") - if arch == "amd64": + if args.arch == "amd64": p = "x64" else: - p = arch + p = args.arch print(f"./{python_loc}/PCBuild/build.bat -c Release -p {p} -t Build") subprocess.check_call(f"{python_loc}\\PCBuild\\build.bat -c Release -p {p} -t Build") @@ -161,11 +162,11 @@ def main(): shutil.rmtree("feet/cpython") print("Compiling bootloader...") - subprocess.check_call("cargo build") + subprocess.check_call("cargo build --release") print("Creating runtime archive...") shutil.copytree( - os.path.join(python_loc, "PCbuild", arch), + os.path.join(python_loc, "PCbuild", args.arch), "feet/cpython", ignore=ignore_excludes, ) @@ -230,9 +231,9 @@ def main(): if not os.path.exists('build'): os.mkdir('build') - base = open('target/debug/feet.exe', 'rb') + base = open('target/release/feet.exe', 'rb') archive = open('feetruntime.zip', 'rb') - output = args.output or f'build/feet-{arch}-{version}' + output = args.output or f'build/feet-{args.arch}-{version}' if not output.endswith('.exe'): output += '.exe' final = open(output, 'wb') @@ -244,6 +245,15 @@ def main(): base.close() archive.close() + # add metadata + final = zipfile.ZipFile(output, 'a') + final.comment = json.dumps({ + 'feet_format': '1', + 'feet_arch': args.arch, + 'feet_runner_size': os.stat('target/release/feet.exe').st_size, + 'feet_archive_size': os.stat('feetruntime.zip').st_size, + }).encode('utf8') + print("Done.") elif args.command == "clean": diff --git a/tests/test_app_files.py b/tests/test_app_files.py index fdc2440..6d894f8 100644 --- a/tests/test_app_files.py +++ b/tests/test_app_files.py @@ -39,5 +39,7 @@ def test_excludes(): with patch('os.listdir') as listdir: listdir.return_value = files - include = list(feet.get_app_files(None)) - assert include == ['main.py',] \ No newline at end of file + include = set(feet.get_app_files(None)) + assert include == set(['main.py', 'feet.exe']) + include = set(feet.get_app_files(None, exclude=['*.exe'])) + assert include == set(['main.py']) \ No newline at end of file diff --git a/tests/test_build.py b/tests/test_build.py index 5eb48c3..5dec2cd 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -92,6 +92,7 @@ def test_setuptools_package(rundir, tempdir, build): assert lines[-1] == "ok", stderr +@pytest.mark.skip def test_exe(rundir, tempdir, build): src = os.path.join(rundir, 'build', 'feet.exe') dest = os.path.join(tempdir, 'feet.exe') @@ -104,7 +105,7 @@ def test_exe(rundir, tempdir, build): assert os.path.exists('feet_data/cpython/lib/site-packages/sdl2') call('./feet.exe exe testprog.exe main.py') with TemporaryDirectory() as exedir: - copyfile('dist/testprog.exe', os.path.join(exedir, 'testprog.exe')) + copyfile(os.path.join(rundir, 'dist/testprog.exe'), os.path.join(exedir, 'testprog.exe')) with cd(exedir): assert 0 == call('./testprog.exe setup') @@ -118,6 +119,7 @@ def test_exe(rundir, tempdir, build): assert lines and lines[-1] == "ok", stderr +@pytest.mark.skip def test_exe_auto(rundir, tempdir, build): src = os.path.join(rundir, 'build', 'feet.exe') dest = os.path.join(tempdir, 'feet.exe') @@ -132,7 +134,7 @@ def test_exe_auto(rundir, tempdir, build): assert os.path.exists('feet_data/cpython/lib/site-packages/sdl2') call('./feet.exe exe testprog.exe') with TemporaryDirectory() as exedir: - copyfile('dist/testprog.exe', os.path.join(exedir, 'testprog.exe')) + copyfile(os.path.join(rundir, 'dist/testprog.exe'), os.path.join(exedir, 'testprog.exe')) with cd(exedir): assert 0 == call('./testprog.exe setup', stdout=sys.stdout, stderr=sys.stderr), str(os.listdir(exedir)) From 250e5b46b85071610f031f9d5f1805d76441a5a5 Mon Sep 17 00:00:00 2001 From: Calvin Spealman Date: Tue, 12 May 2020 22:25:56 -0400 Subject: [PATCH 5/5] Generate lib2to3 grammars before archiving stdlib --- VERSION.txt | 2 +- feetmaker.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 69289ba..b9712a9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.6.0rc1 \ No newline at end of file +0.6.0rc2 \ No newline at end of file diff --git a/feetmaker.py b/feetmaker.py index 473838a..b5d3c16 100644 --- a/feetmaker.py +++ b/feetmaker.py @@ -165,6 +165,8 @@ def main(): subprocess.check_call("cargo build --release") print("Creating runtime archive...") + py_exe = os.path.join(python_loc, "PCbuild", args.arch, 'python.exe') + subprocess.run([py_exe, '-m', 'lib2to3'], stdout=subprocess.PIPE) shutil.copytree( os.path.join(python_loc, "PCbuild", args.arch), "feet/cpython", @@ -191,6 +193,8 @@ def main(): src, "feet/cpython/", ) + + feet_py = "feet/cpython/python.exe" # Create the stdlib zip to make unpacking faster zipdir( @@ -201,7 +205,7 @@ def main(): ) # Create the archive to attach to feet.exe to self-extract - feet_py = "feet/cpython/python.exe" + subprocess.check_call([feet_py, '-m', 'ensurepip']) for name in py_deps: try: