Skip to content

Commit 123a58b

Browse files
authored
Backport Mac installer fixes for git-based workflow (python#2837)
1 parent 8d41de6 commit 123a58b

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

Mac/BuildScript/build-installer.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Python 2.6.
1414
1515
In addition to what is supplied with OS X 10.5+ and Xcode 3+, the script
16-
requires an installed version of hg and a third-party version of
16+
requires an installed third-party version of
1717
Tcl/Tk 8.4 (for OS X 10.4 and 10.5 deployment targets) or Tcl/TK 8.5
1818
(for 10.6 or later) installed in /Library/Frameworks. When installed,
1919
the Python built by this script will attempt to dynamically link first to
@@ -23,7 +23,7 @@
2323
2424
32-bit-only installer builds are still possible on OS X 10.4 with Xcode 2.5
2525
and the installation of additional components, such as a newer Python
26-
(2.5 is needed for Python parser updates), hg, and for the documentation
26+
(2.5 is needed for Python parser updates) and for the documentation
2727
build either svn (pre-3.4.1) or sphinx-build (3.4.1 and later).
2828
2929
Usage: see USAGE variable in the script.
@@ -577,7 +577,7 @@ def getTclTkVersion(configfile, versionline):
577577
"""
578578
try:
579579
f = open(configfile, "r")
580-
except:
580+
except OSError:
581581
fatal("Framework configuration file not found: %s" % configfile)
582582

583583
for l in f:
@@ -663,9 +663,8 @@ def checkEnvironment():
663663
base_path = base_path + ':' + OLD_DEVELOPER_TOOLS
664664
os.environ['PATH'] = base_path
665665
print("Setting default PATH: %s"%(os.environ['PATH']))
666-
# Ensure ws have access to hg and to sphinx-build.
667-
# You may have to create links in /usr/bin for them.
668-
runCommand('hg --version')
666+
# Ensure we have access to sphinx-build.
667+
# You may have to create a link in /usr/bin for it.
669668
runCommand('sphinx-build --version')
670669

671670
def parseOptions(args=None):
@@ -819,7 +818,7 @@ def downloadURL(url, fname):
819818
except:
820819
try:
821820
os.unlink(fname)
822-
except:
821+
except OSError:
823822
pass
824823

825824
def verifyThirdPartyFile(url, checksum, fname):
@@ -1115,7 +1114,6 @@ def buildPythonDocs():
11151114
docdir = os.path.join(rootDir, 'pydocs')
11161115
curDir = os.getcwd()
11171116
os.chdir(buildDir)
1118-
# The Doc build changed for 3.4 (technically, for 3.4.1) and for 2.7.9
11191117
runCommand('make clean')
11201118
# Assume sphinx-build is on our PATH, checked in checkEnvironment
11211119
runCommand('make html')
@@ -1168,8 +1166,25 @@ def buildPython():
11681166
shellQuote(WORKDIR)[1:-1],
11691167
shellQuote(WORKDIR)[1:-1]))
11701168

1171-
print("Running make")
1172-
runCommand("make")
1169+
# Look for environment value BUILDINSTALLER_BUILDPYTHON_MAKE_EXTRAS
1170+
# and, if defined, append its value to the make command. This allows
1171+
# us to pass in version control tags, like GITTAG, to a build from a
1172+
# tarball rather than from a vcs checkout, thus eliminating the need
1173+
# to have a working copy of the vcs program on the build machine.
1174+
#
1175+
# A typical use might be:
1176+
# export BUILDINSTALLER_BUILDPYTHON_MAKE_EXTRAS=" \
1177+
# GITVERSION='echo 123456789a' \
1178+
# GITTAG='echo v3.6.0' \
1179+
# GITBRANCH='echo 3.6'"
1180+
1181+
make_extras = os.getenv("BUILDINSTALLER_BUILDPYTHON_MAKE_EXTRAS")
1182+
if make_extras:
1183+
make_cmd = "make " + make_extras
1184+
else:
1185+
make_cmd = "make"
1186+
print("Running " + make_cmd)
1187+
runCommand(make_cmd)
11731188

11741189
print("Running make install")
11751190
runCommand("make install DESTDIR=%s"%(

0 commit comments

Comments
 (0)