Skip to content

Commit d09e012

Browse files
committed
macos: install setuptools and pip
For consistency with Linux, which installs modern versions of these.
1 parent 9a554da commit d09e012

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

cpython-macos/build-cpython.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ cat ../Makefile.extra >> Makefile
4242
make -j ${NUM_CPUS}
4343
make -j ${NUM_CPUS} install DESTDIR=${ROOT}/out/python
4444

45+
pushd ${ROOT}/setuptools-${SETUPTOOLS_VERSION}
46+
${ROOT}/out/python/install/bin/python3 setup.py install
47+
popd
48+
49+
pushd ${ROOT}/pip-${PIP_VERSION}
50+
${ROOT}/out/python/install/bin/python3 setup.py install
51+
popd
52+
4553
# Downstream consumers don't require bytecode files. So remove them.
4654
# Ideally we'd adjust the build system. But meh.
4755
find ${ROOT}/out/python/install -type d -name __pycache__ -print0 | xargs -0 rm -rf

cpython-macos/build.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import subprocess
1313
import sys
1414
import tempfile
15+
import zipfile
1516

1617
from pythonbuild.cpython import (
1718
derive_setup_local,
@@ -310,6 +311,8 @@ def process_setup_line(line):
310311
def build_cpython(optimized=False):
311312
python_archive = download_entry('cpython-3.7', BUILD)
312313
python_version = DOWNLOADS['cpython-3.7']['version']
314+
setuptools_archive = download_entry('setuptools', BUILD)
315+
pip_archive = download_entry('pip', BUILD)
313316

314317
with (SUPPORT / 'static-modules').open('rb') as fh:
315318
static_modules_lines = [l.rstrip() for l in fh if not l.startswith(b'#')]
@@ -344,6 +347,10 @@ def build_cpython(optimized=False):
344347
extract_tar_to_directory(BUILD / 'zlib-macos.tar', deps_dir)
345348

346349
extract_tar_to_directory(python_archive, td)
350+
extract_tar_to_directory(pip_archive, td)
351+
352+
with zipfile.ZipFile(setuptools_archive) as zf:
353+
zf.extractall(td)
347354

348355
setup_local_path = td / ('Python-%s' % python_version) / 'Modules' / 'Setup.local'
349356
with setup_local_path.open('wb') as fh:
@@ -359,6 +366,8 @@ def build_cpython(optimized=False):
359366

360367
env = dict(os.environ)
361368
env['PYTHON_VERSION'] = python_version
369+
env['SETUPTOOLS_VERSION'] = DOWNLOADS['setuptools']['version']
370+
env['PIP_VERSION'] = DOWNLOADS['pip']['version']
362371

363372
# We force a PATH only containing system files: we don't want
364373
# pollution from homebrew, macports, etc.

0 commit comments

Comments
 (0)