Skip to content

Commit f0fe9ab

Browse files
committed
windows: add a --build-mode argument
It currently does nothing meaningful. Our goal is to add support for building a normal Python distribution, shared library and all.
1 parent c94898e commit f0fe9ab

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

build-windows.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def bootstrap():
3232
os.environ["PYBUILD_BOOTSTRAPPED"] = "1"
3333
os.environ["PATH"] = "%s;%s" % (str(VENV / "bin"), os.environ["PATH"])
3434
os.environ["PYTHONPATH"] = str(ROOT)
35-
subprocess.run([str(PYTHON), __file__], check=True)
35+
args = [str(PYTHON), __file__]
36+
args.extend(sys.argv[1:])
37+
subprocess.run(args, check=True)
3638

3739

3840
def run():
@@ -46,9 +48,10 @@ def run():
4648

4749
arch = "x86" if os.environ.get("Platform") == "x86" else "amd64"
4850

49-
subprocess.run(
50-
[str(PYTHON), "build.py"], cwd=str(WINDOWS_DIR), env=env, check=True, bufsize=0
51-
)
51+
args = [str(PYTHON), "build.py"]
52+
args.extend(sys.argv[1:])
53+
54+
subprocess.run(args, cwd=str(WINDOWS_DIR), env=env, check=True, bufsize=0)
5255

5356
source_path = BUILD / ("cpython-windows-%s.tar" % arch)
5457

cpython-windows/build.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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 argparse
67
import concurrent.futures
78
import json
89
import os
@@ -1292,7 +1293,7 @@ def find_additional_dependencies(project: pathlib.Path):
12921293
return res
12931294

12941295

1295-
def build_cpython(arch: str, pgo=False):
1296+
def build_cpython(arch: str, pgo=False, build_mode="static"):
12961297
msbuild = find_msbuild()
12971298
log("found MSBuild at %s" % msbuild)
12981299

@@ -1525,6 +1526,16 @@ def fetch_strawberry_perl() -> pathlib.Path:
15251526
def main():
15261527
BUILD.mkdir(exist_ok=True)
15271528

1529+
parser = argparse.ArgumentParser()
1530+
parser.add_argument(
1531+
"--build-mode",
1532+
choices={"static"},
1533+
default="static",
1534+
help="How to compile Python",
1535+
)
1536+
1537+
args = parser.parse_args()
1538+
15281539
log_path = BUILD / "build.log"
15291540

15301541
with log_path.open("wb") as log_fh:
@@ -1540,7 +1551,7 @@ def main():
15401551
build_openssl(perl_path, arch)
15411552

15421553
LOG_PREFIX[0] = "cpython"
1543-
build_cpython(arch)
1554+
build_cpython(arch, build_mode=args.build_mode)
15441555

15451556

15461557
if __name__ == "__main__":

0 commit comments

Comments
 (0)