8000 Synchronize macOS installer with 3.9 · python/cpython@62855d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62855d5

Browse files
committed
Synchronize macOS installer with 3.9
1 parent 678ffc4 commit 62855d5

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

Mac/BuildScript/build-installer.py

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,13 +1066,40 @@ def buildPythonDocs():
10661066
curDir = os.getcwd()
10671067
os.chdir(buildDir)
10681068
runCommand('make clean')
1069-
# Create virtual environment for docs builds with blurb and sphinx
1070-
runCommand('make venv')
1071-
runCommand('make html PYTHON=venv/bin/python')
1069+
1070+
# Search third-party source directory for a pre-built version of the docs.
1071+
# Use the naming convention of the docs.python.org html downloads:
1072+
# python-3.9.0b1-docs-html.tar.bz2
1073+
doctarfiles = [ f for f in os.listdir(DEPSRC)
1074+
if f.startswith('python-'+getFullVersion())
1075+
if f.endswith('-docs-html.tar.bz2') ]
1076+
if doctarfiles:
1077+
doctarfile = doctarfiles[0]
1078+
if not os.path.exists('build'):
1079+
os.mkdir('build')
1080+
# if build directory existed, it was emptied by make clean, above
1081+
os.chdir('build')
1082+
# Extract the first archive found for this version into build
1083+
runCommand('tar xjf %s'%shellQuote(os.path.join(DEPSRC, doctarfile)))
1084+
# see if tar extracted a directory ending in -docs-html
1085+
archivefiles = [ f for f in os.listdir('.')
1086+
if f.endswith('-docs-html')
1087+
if os.path.isdir(f) ]
1088+
if archivefiles:
1089+
archivefile = archivefiles[0]
1090+
# make it our 'Docs/build/html' directory
1091+
print(' -- using pre-built python documentation from %s'%archivefile)
1092+
os.rename(archivefile, 'html')
1093+
os.chdir(buildDir)
1094+
1095+
htmlDir = os.path.join('build', 'html')
1096+
if not os.path.exists(htmlDir):
1097+
# Create virtual environment for docs builds with blurb and sphinx
1098+
runCommand('make venv')
1099+
runCommand('venv/bin/python3 -m pip install -U Sphinx==2.3.1')
1100+
runCommand('make html PYTHON=venv/bin/python')
1101+
os.rename(htmlDir, docdir)
10721102
os.chdir(curDir)
1073-
if not os.path.exists(docdir):
1074-
os.mkdir(docdir)
1075-
os.rename(os.path.join(buildDir, 'build', 'html'), docdir)
10761103

10771104

10781105
def buildPython():
@@ -1217,7 +1244,8 @@ def buildPython():
12171244
if ln.startswith('VERSION='):
12181245
VERSION=ln.split()[1]
12191246
if ln.startswith('ABIFLAGS='):
1220-
ABIFLAGS=ln.split()[1]
1247+
ABIFLAGS=ln.split()
1248+
ABIFLAGS=ABIFLAGS[1] if len(ABIFLAGS) > 1 else ''
12211249
if ln.startswith('LDVERSION='):
12221250
LDVERSION=ln.split()[1]
12231251
fp.close()
@@ -1268,7 +1296,8 @@ def buildPython():
12681296
import pprint
12691297
if getVersionMajorMinor() >= (3, 6):
12701298
# XXX this is extra-fragile
1271-
path = os.path.join(path_to_lib, '_sysconfigdata_m_darwin_darwin.py')
1299+
path = os.path.join(path_to_lib,
1300+
'_sysconfigdata_%s_darwin_darwin.py' % (ABIFLAGS,))
12721301
else:
12731302
path = os.path.join(path_to_lib, '_sysconfigdata.py')
12741303
fp = open(path, 'r')
@@ -1306,12 +1335,6 @@ def buildPython():
13061335

13071336
os.chdir(curdir)
13081337

1309-
if PYTHON_3:
1310-
# Remove the 'Current' link, that way we don't accidentally mess
1311-
# with an already installed version of python 2
1312-
os.unlink(os.path.join(rootDir, 'Library', 'Frameworks',
1313-
'Python.framework', 'Versions', 'Current'))
1314-
13151338
def patchFile(inPath, outPath):
13161339
data = fileContents(inPath)
13171340
data = data.replace('$FULL_VERSION', getFullVersion())

0 commit comments

Comments
 (0)
0