Skip to content

Commit d278f55

Browse files
committed
windows: move compressing of archive into build.py
This way the invoking script needs to know less about filenames, etc.
1 parent 404273c commit d278f55

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

build-windows.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# License, v. 2.0. If a copy of the MPL was not distributed with this
44
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
55

6-
import datetime
76
import os
87
import pathlib
98
import subprocess
@@ -38,30 +37,14 @@ def bootstrap():
3837

3938

4039
def run():
41-
from pythonbuild.downloads import DOWNLOADS
42-
from pythonbuild.utils import compress_python_archive
43-
44-
now = datetime.datetime.utcnow()
45-
4640
env = dict(os.environ)
4741
env["PYTHONUNBUFFERED"] = "1"
4842

49-
arch = "x86" if os.environ.get("Platform") == "x86" else "amd64"
50-
5143
args = [str(PYTHON), "build.py"]
5244
args.extend(sys.argv[1:])
5345

5446
subprocess.run(args, cwd=str(WINDOWS_DIR), env=env, check=True, bufsize=0)
5547

56-
source_path = BUILD / ("cpython-windows-%s.tar" % arch)
57-
58-
compress_python_archive(
59-
source_path,
60-
DIST,
61-
"cpython-%s-windows-%s-%s"
62-
% (DOWNLOADS["cpython-3.7"]["version"], arch, now.strftime("%Y%m%dT%H%M")),
63-
)
64-
6548

6649
if __name__ == "__main__":
6750
try:

cpython-windows/build.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import argparse
77
import concurrent.futures
8+
import datetime
89
import json
910
import os
1011
import pathlib
@@ -21,10 +22,12 @@
2122
create_tar_from_directory,
2223
download_entry,
2324
extract_tar_to_directory,
25+
compress_python_archive,
2426
)
2527

2628
ROOT = pathlib.Path(os.path.abspath(__file__)).parent.parent
2729
BUILD = ROOT / "build"
30+
DIST = ROOT / "dist"
2831
SUPPORT = ROOT / "cpython-windows"
2932

3033
LOG_PREFIX = [None]
@@ -1513,6 +1516,8 @@ def build_cpython(arch: str, pgo=False, build_mode="static"):
15131516
with dest_path.open("wb") as fh:
15141517
create_tar_from_directory(fh, td / "out")
15151518

1519+
return dest_path
1520+
15161521

15171522
def fetch_strawberry_perl() -> pathlib.Path:
15181523
strawberryperl_zip = download_entry("strawberryperl", BUILD)
@@ -1536,6 +1541,8 @@ def main():
15361541

15371542
args = parser.parse_args()
15381543

1544+
now = datetime.datetime.utcnow()
1545+
15391546
log_path = BUILD / "build.log"
15401547

15411548
with log_path.open("wb") as log_fh:
@@ -1551,7 +1558,14 @@ def main():
15511558
build_openssl(perl_path, arch)
15521559

15531560
LOG_PREFIX[0] = "cpython"
1554-
build_cpython(arch, build_mode=args.build_mode)
1561+
tar_path = build_cpython(arch, build_mode=args.build_mode)
1562+
1563+
compress_python_archive(
1564+
tar_path,
1565+
DIST,
1566+
"cpython-%s-windows-%s-%s"
1567+
% (DOWNLOADS["cpython-3.7"]["version"], arch, now.strftime("%Y%m%dT%H%M")),
1568+
)
15551569

15561570

15571571
if __name__ == "__main__":

0 commit comments

Comments
 (0)