12
12
import subprocess
13
13
import sys
14
14
import tempfile
15
+ import zipfile
15
16
16
17
from pythonbuild .cpython import (
17
18
derive_setup_local ,
@@ -310,6 +311,8 @@ def process_setup_line(line):
310
311
def build_cpython (optimized = False ):
311
312
python_archive = download_entry ('cpython-3.7' , BUILD )
312
313
python_version = DOWNLOADS ['cpython-3.7' ]['version' ]
314
+ setuptools_archive = download_entry ('setuptools' , BUILD )
315
+ pip_archive = download_entry ('pip' , BUILD )
313
316
314
317
with (SUPPORT / 'static-modules' ).open ('rb' ) as fh :
315
318
static_modules_lines = [l .rstrip () for l in fh if not l .startswith (b'#' )]
@@ -344,6 +347,10 @@ def build_cpython(optimized=False):
344
347
extract_tar_to_directory (BUILD / 'zlib-macos.tar' , deps_dir )
345
348
346
349
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 )
347
354
348
355
setup_local_path = td / ('Python-%s' % python_version ) / 'Modules' / 'Setup.local'
349
356
with setup_local_path .open ('wb' ) as fh :
@@ -359,6 +366,8 @@ def build_cpython(optimized=False):
359
366
360
367
env = dict (os .environ )
361
368
env ['PYTHON_VERSION' ] = python_version
369
+ env ['SETUPTOOLS_VERSION' ] = DOWNLOADS ['setuptools' ]['version' ]
370
+ env ['PIP_VERSION' ] = DOWNLOADS ['pip' ]['version' ]
362
371
363
372
# We force a PATH only containing system files: we don't want
364
373
# pollution from homebrew, macports, etc.
0 commit comments