Skip to content

Commit 087df33

Browse files
committed
macos: switch to UNIX build system
The UNIX build system now handles building CPython for macOS! Let's switch to it.
1 parent e7d4c1d commit 087df33

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

build-macos.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919
PIP = VENV / "bin" / "pip"
2020
PYTHON = VENV / "bin" / "python"
2121
REQUIREMENTS = ROOT / "requirements.txt"
22-
MAKE_DIR = ROOT / "cpython-macos"
22+
MAKE_DIR = ROOT / "cpython-unix"
2323

2424

2525
def bootstrap():
2626
parser = argparse.ArgumentParser()
2727
parser.add_argument("--optimized", action="store_true")
28+
parser.add_argument(
29+
"--python", default="cpython-3.7", help="name of Python to build"
30+
)
2831

2932
args = parser.parse_args()
3033

@@ -42,6 +45,8 @@ def bootstrap():
4245
if args.optimized:
4346
os.environ["PYBUILD_OPTIMIZED"] = "1"
4447

48+
os.environ["PYBUILD_PYTHON"] = args.python
49+
4550
subprocess.run([str(PYTHON), __file__], check=True)
4651

4752

@@ -54,9 +59,15 @@ def run():
5459
env = dict(os.environ)
5560
env["PYTHONUNBUFFERED"] = "1"
5661

62+
entry = DOWNLOADS[os.environ["PYBUILD_PYTHON"]]
63+
env["PYBUILD_PYTHON_VERSION"] = entry["version"]
64+
65+
env["PYBUILD_NO_DOCKER"] = "1"
66+
env["PYBUILD_UNIX_PLATFORM"] = "macos"
67+
5768
subprocess.run(["make"], cwd=str(MAKE_DIR), env=env, check=True)
5869

59-
basename = "cpython-macos"
70+
basename = "cpython-%s-macos" % entry["version"]
6071
extra = ""
6172

6273
if "PYBUILD_OPTIMIZED" in os.environ:
@@ -71,7 +82,7 @@ def run():
7182
source_path,
7283
DIST,
7384
"cpython-%s-macos%s-%s"
74-
% (DOWNLOADS["cpython-3.7"]["version"], extra, now.strftime("%Y%m%dT%H%M")),
85+
% (entry["version"], extra, now.strftime("%Y%m%dT%H%M")),
7586
)
7687

7788

0 commit comments

Comments
 (0)