@@ -1066,13 +1066,40 @@ def buildPythonDocs():
1066
1066
curDir = os .getcwd ()
1067
1067
os .chdir (buildDir )
1068
1068
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 )
1072
1102
os .chdir (curDir )
1073
- if not os .path .exists (docdir ):
1074
- os .mkdir (docdir )
1075
- os .rename (os .path .join (buildDir , 'build' , 'html' ), docdir )
1076
1103
1077
1104
1078
1105
def buildPython ():
@@ -1217,7 +1244,8 @@ def buildPython():
1217
1244
if ln .startswith ('VERSION=' ):
1218
1245
VERSION = ln .split ()[1 ]
1219
1246
if ln .startswith ('ABIFLAGS=' ):
1220
- ABIFLAGS = ln .split ()[1 ]
1247
+ ABIFLAGS = ln .split ()
1248
+ ABIFLAGS = ABIFLAGS [1 ] if len (ABIFLAGS ) > 1 else ''
1221
1249
if ln .startswith ('LDVERSION=' ):
1222
1250
LDVERSION = ln .split ()[1 ]
1223
1251
fp .close ()
@@ -1268,7 +1296,8 @@ def buildPython():
1268
1296
import pprint
1269
1297
if getVersionMajorMinor () >= (3 , 6 ):
1270
1298
# 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 ,))
1272
1301
else :
1273
1302
path = os .path .join (path_to_lib , '_sysconfigdata.py' )
1274
1303
fp = open (path , 'r' )
@@ -1306,12 +1335,6 @@ def buildPython():
1306
1335
1307
1336
os .chdir (curdir )
1308
1337
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
-
1315
1338
def patchFile (inPath , outPath ):
1316
1339
data = fileContents (inPath )
1317
1340
data = data .replace ('$FULL_VERSION' , getFullVersion ())
0 commit comments