Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
623918ed
Commit
623918ed
authored
Dec 20, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unpy3kize this; it require 2.x only Mac modules
parent
51f3ef9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
44 deletions
+43
-44
Mac/BuildScript/build-installer.py
Mac/BuildScript/build-installer.py
+43
-44
No files found.
Mac/BuildScript/build-installer.py
View file @
623918ed
...
@@ -9,8 +9,7 @@ bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
...
@@ -9,8 +9,7 @@ bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4)
Usage: see USAGE variable in the script.
Usage: see USAGE variable in the script.
"""
"""
import
platform
,
os
,
sys
,
getopt
,
textwrap
,
shutil
,
stat
,
time
,
pwd
import
platform
,
os
,
sys
,
getopt
,
textwrap
,
shutil
,
urllib2
,
stat
,
time
,
pwd
import
urllib.request
import
grp
import
grp
INCLUDE_TIMESTAMP
=
1
INCLUDE_TIMESTAMP
=
1
...
@@ -55,7 +54,7 @@ def getFullVersion():
...
@@ -55,7 +54,7 @@ def getFullVersion():
if
'PY_VERSION'
in
ln
:
if
'PY_VERSION'
in
ln
:
return
ln
.
split
()[
-
1
][
1
:
-
1
]
return
ln
.
split
()[
-
1
][
1
:
-
1
]
raise
RuntimeError
(
"Cannot find full version??"
)
raise
RuntimeError
,
"Cannot find full version??"
# The directory we'll use to create the build (will be erased and recreated)
# The directory we'll use to create the build (will be erased and recreated)
WORKDIR
=
"/tmp/_py"
WORKDIR
=
"/tmp/_py"
...
@@ -292,7 +291,7 @@ def runCommand(commandline):
...
@@ -292,7 +291,7 @@ def runCommand(commandline):
xit
=
fd
.
close
()
xit
=
fd
.
close
()
if
xit
is
not
None
:
if
xit
is
not
None
:
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
write
(
data
)
raise
RuntimeError
(
"command failed: %s"
%
(
commandline
,)
)
raise
RuntimeError
,
"command failed: %s"
%
(
commandline
,
)
if
VERBOSE
:
if
VERBOSE
:
sys
.
stdout
.
write
(
data
);
sys
.
stdout
.
flush
()
sys
.
stdout
.
write
(
data
);
sys
.
stdout
.
flush
()
...
@@ -303,7 +302,7 @@ def captureCommand(commandline):
...
@@ -303,7 +302,7 @@ def captureCommand(commandline):
xit
=
fd
.
close
()
xit
=
fd
.
close
()
if
xit
is
not
None
:
if
xit
is
not
None
:
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
write
(
data
)
raise
RuntimeError
(
"command failed: %s"
%
(
commandline
,)
)
raise
RuntimeError
,
"command failed: %s"
%
(
commandline
,
)
return
data
return
data
...
@@ -336,17 +335,17 @@ def parseOptions(args=None):
...
@@ -336,17 +335,17 @@ def parseOptions(args=None):
try
:
try
:
options
,
args
=
getopt
.
getopt
(
args
,
'?hb'
,
options
,
args
=
getopt
.
getopt
(
args
,
'?hb'
,
[
'build-dir='
,
'third-party='
,
'sdk-path='
,
'src-dir='
])
[
'build-dir='
,
'third-party='
,
'sdk-path='
,
'src-dir='
])
except
getopt
.
error
as
msg
:
except
getopt
.
error
,
msg
:
print
(
msg
)
print
msg
sys
.
exit
(
1
)
sys
.
exit
(
1
)
if
args
:
if
args
:
print
(
"Additional arguments"
)
print
"Additional arguments"
sys
.
exit
(
1
)
sys
.
exit
(
1
)
for
k
,
v
in
options
:
for
k
,
v
in
options
:
if
k
in
(
'-h'
,
'-?'
):
if
k
in
(
'-h'
,
'-?'
):
print
(
USAGE
)
print
USAGE
sys
.
exit
(
0
)
sys
.
exit
(
0
)
elif
k
in
(
'-d'
,
'--build-dir'
):
elif
k
in
(
'-d'
,
'--build-dir'
):
...
@@ -362,19 +361,19 @@ def parseOptions(args=None):
...
@@ -362,19 +361,19 @@ def parseOptions(args=None):
SRCDIR
=
v
SRCDIR
=
v
else
:
else
:
raise
NotImplementedError
(
k
)
raise
NotImplementedError
,
k
SRCDIR
=
os
.
path
.
abspath
(
SRCDIR
)
SRCDIR
=
os
.
path
.
abspath
(
SRCDIR
)
WORKDIR
=
os
.
path
.
abspath
(
WORKDIR
)
WORKDIR
=
os
.
path
.
abspath
(
WORKDIR
)
SDKPATH
=
os
.
path
.
abspath
(
SDKPATH
)
SDKPATH
=
os
.
path
.
abspath
(
SDKPATH
)
DEPSRC
=
os
.
path
.
abspath
(
DEPSRC
)
DEPSRC
=
os
.
path
.
abspath
(
DEPSRC
)
print
(
"Settings:"
)
print
"Settings:"
print
(
" * Source directory:"
,
SRCDIR
)
print
" * Source directory:"
,
SRCDIR
print
(
" * Build directory: "
,
WORKDIR
)
print
" * Build directory: "
,
WORKDIR
print
(
" * SDK location: "
,
SDKPATH
)
print
" * SDK location: "
,
SDKPATH
print
(
" * third-party source:"
,
DEPSRC
)
print
" * third-party source:"
,
DEPSRC
print
(
""
)
print
""
...
@@ -419,7 +418,7 @@ def extractArchive(builddir, archiveName):
...
@@ -419,7 +418,7 @@ def extractArchive(builddir, archiveName):
xit
=
fp
.
close
()
xit
=
fp
.
close
()
if
xit
is
not
None
:
if
xit
is
not
None
:
sys
.
stdout
.
write
(
data
)
sys
.
stdout
.
write
(
data
)
raise
RuntimeError
(
"Cannot extract %s"
%
(
archiveName
,)
)
raise
RuntimeError
,
"Cannot extract %s"
%
(
archiveName
,
)
return
os
.
path
.
join
(
builddir
,
retval
)
return
os
.
path
.
join
(
builddir
,
retval
)
...
@@ -441,9 +440,9 @@ def downloadURL(url, fname):
...
@@ -441,9 +440,9 @@ def downloadURL(url, fname):
pass
pass
else
:
else
:
if
KNOWNSIZES
.
get
(
url
)
==
size
:
if
KNOWNSIZES
.
get
(
url
)
==
size
:
print
(
"Using existing file for"
,
url
)
print
"Using existing file for"
,
url
return
return
fpIn
=
urllib
.
request
.
urlopen
(
url
)
fpIn
=
urllib
2
.
urlopen
(
url
)
fpOut
=
open
(
fname
,
'wb'
)
fpOut
=
open
(
fname
,
'wb'
)
block
=
fpIn
.
read
(
10240
)
block
=
fpIn
.
read
(
10240
)
try
:
try
:
...
@@ -480,14 +479,14 @@ def buildRecipe(recipe, basedir, archList):
...
@@ -480,14 +479,14 @@ def buildRecipe(recipe, basedir, archList):
if
os
.
path
.
exists
(
sourceArchive
):
if
os
.
path
.
exists
(
sourceArchive
):
print
(
"Using local copy of %s"
%
(
name
,)
)
print
"Using local copy of %s"
%
(
name
,
)
else
:
else
:
print
(
"Downloading %s"
%
(
name
,)
)
print
"Downloading %s"
%
(
name
,
)
downloadURL
(
url
,
sourceArchive
)
downloadURL
(
url
,
sourceArchive
)
print
(
"Archive for %s stored as %s"
%
(
name
,
sourceArchive
)
)
print
"Archive for %s stored as %s"
%
(
name
,
sourceArchive
)
print
(
"Extracting archive for %s"
%
(
name
,)
)
print
"Extracting archive for %s"
%
(
name
,
)
buildDir
=
os
.
path
.
join
(
WORKDIR
,
'_bld'
)
buildDir
=
os
.
path
.
join
(
WORKDIR
,
'_bld'
)
if
not
os
.
path
.
exists
(
buildDir
):
if
not
os
.
path
.
exists
(
buildDir
):
os
.
mkdir
(
buildDir
)
os
.
mkdir
(
buildDir
)
...
@@ -550,14 +549,14 @@ def buildRecipe(recipe, basedir, archList):
...
@@ -550,14 +549,14 @@ def buildRecipe(recipe, basedir, archList):
configure_args
.
insert
(
0
,
configure
)
configure_args
.
insert
(
0
,
configure
)
configure_args
=
[
shellQuote
(
a
)
for
a
in
configure_args
]
configure_args
=
[
shellQuote
(
a
)
for
a
in
configure_args
]
print
(
"Running configure for %s"
%
(
name
,)
)
print
"Running configure for %s"
%
(
name
,
)
runCommand
(
' '
.
join
(
configure_args
)
+
' 2>&1'
)
runCommand
(
' '
.
join
(
configure_args
)
+
' 2>&1'
)
print
(
"Running install for %s"
%
(
name
,)
)
print
"Running install for %s"
%
(
name
,
)
runCommand
(
'{ '
+
install
+
' ;} 2>&1'
)
runCommand
(
'{ '
+
install
+
' ;} 2>&1'
)
print
(
"Done %s"
%
(
name
,)
)
print
"Done %s"
%
(
name
,
)
print
(
""
)
print
""
os
.
chdir
(
curdir
)
os
.
chdir
(
curdir
)
...
@@ -565,9 +564,9 @@ def buildLibraries():
...
@@ -565,9 +564,9 @@ def buildLibraries():
"""
"""
Build our dependencies into $WORKDIR/libraries/usr/local
Build our dependencies into $WORKDIR/libraries/usr/local
"""
"""
print
(
""
)
print
""
print
(
"Building required libraries"
)
print
"Building required libraries"
print
(
""
)
print
""
universal
=
os
.
path
.
join
(
WORKDIR
,
'libraries'
)
universal
=
os
.
path
.
join
(
WORKDIR
,
'libraries'
)
os
.
mkdir
(
universal
)
os
.
mkdir
(
universal
)
os
.
makedirs
(
os
.
path
.
join
(
universal
,
'usr'
,
'local'
,
'lib'
))
os
.
makedirs
(
os
.
path
.
join
(
universal
,
'usr'
,
'local'
,
'lib'
))
...
@@ -581,7 +580,7 @@ def buildLibraries():
...
@@ -581,7 +580,7 @@ def buildLibraries():
def
buildPythonDocs
():
def
buildPythonDocs
():
# This stores the documentation as Resources/English.lproj/Docuentation
# This stores the documentation as Resources/English.lproj/Docuentation
# inside the framwork. pydoc and IDLE will pick it up there.
# inside the framwork. pydoc and IDLE will pick it up there.
print
(
"Install python documentation"
)
print
"Install python documentation"
rootDir
=
os
.
path
.
join
(
WORKDIR
,
'_root'
)
rootDir
=
os
.
path
.
join
(
WORKDIR
,
'_root'
)
version
=
getVersion
()
version
=
getVersion
()
docdir
=
os
.
path
.
join
(
rootDir
,
'pydocs'
)
docdir
=
os
.
path
.
join
(
rootDir
,
'pydocs'
)
...
@@ -590,13 +589,13 @@ def buildPythonDocs():
...
@@ -590,13 +589,13 @@ def buildPythonDocs():
name
=
'html-%s.tar.bz2'
%
(
getFullVersion
(),)
name
=
'html-%s.tar.bz2'
%
(
getFullVersion
(),)
sourceArchive
=
os
.
path
.
join
(
DEPSRC
,
name
)
sourceArchive
=
os
.
path
.
join
(
DEPSRC
,
name
)
if
os
.
path
.
exists
(
sourceArchive
):
if
os
.
path
.
exists
(
sourceArchive
):
print
(
"Using local copy of %s"
%
(
name
,)
)
print
"Using local copy of %s"
%
(
name
,
)
else
:
else
:
print
"Downloading %s"
%
(
novername
,)
print
"Downloading %s"
%
(
novername
,)
downloadURL
(
'http://www.python.org/ftp/python/doc/%s/%s'
%
(
downloadURL
(
'http://www.python.org/ftp/python/doc/%s/%s'
%
(
getFullVersion
(),
novername
),
sourceArchive
)
getFullVersion
(),
novername
),
sourceArchive
)
print
(
"Archive for %s stored as %s"
%
(
name
,
sourceArchive
)
)
print
"Archive for %s stored as %s"
%
(
name
,
sourceArchive
)
extractArchive
(
os
.
path
.
dirname
(
docdir
),
sourceArchive
)
extractArchive
(
os
.
path
.
dirname
(
docdir
),
sourceArchive
)
...
@@ -607,7 +606,7 @@ def buildPythonDocs():
...
@@ -607,7 +606,7 @@ def buildPythonDocs():
def
buildPython
():
def
buildPython
():
print
(
"Building a universal python"
)
print
"Building a universal python"
buildDir
=
os
.
path
.
join
(
WORKDIR
,
'_bld'
,
'python'
)
buildDir
=
os
.
path
.
join
(
WORKDIR
,
'_bld'
,
'python'
)
rootDir
=
os
.
path
.
join
(
WORKDIR
,
'_root'
)
rootDir
=
os
.
path
.
join
(
WORKDIR
,
'_root'
)
...
@@ -630,24 +629,24 @@ def buildPython():
...
@@ -630,24 +629,24 @@ def buildPython():
# several paths.
# several paths.
version
=
getVersion
()
version
=
getVersion
()
print
(
"Running configure..."
)
print
"Running configure..."
runCommand
(
"%s -C --enable-framework --enable-universalsdk=%s LDFLAGS='-g -L%s/libraries/usr/local/lib' OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"
%
(
runCommand
(
"%s -C --enable-framework --enable-universalsdk=%s LDFLAGS='-g -L%s/libraries/usr/local/lib' OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"
%
(
shellQuote
(
os
.
path
.
join
(
SRCDIR
,
'configure'
)),
shellQuote
(
os
.
path
.
join
(
SRCDIR
,
'configure'
)),
shellQuote
(
SDKPATH
),
shellQuote
(
WORKDIR
)[
1
:
-
1
],
shellQuote
(
SDKPATH
),
shellQuote
(
WORKDIR
)[
1
:
-
1
],
shellQuote
(
WORKDIR
)[
1
:
-
1
]))
shellQuote
(
WORKDIR
)[
1
:
-
1
]))
print
(
"Running make"
)
print
"Running make"
runCommand
(
"make"
)
runCommand
(
"make"
)
print
(
"Running make frameworkinstall"
)
print
"Running make frameworkinstall"
runCommand
(
"make frameworkinstall DESTDIR=%s"
%
(
runCommand
(
"make frameworkinstall DESTDIR=%s"
%
(
shellQuote
(
rootDir
)))
shellQuote
(
rootDir
)))
print
(
"Running make frameworkinstallextras"
)
print
"Running make frameworkinstallextras"
runCommand
(
"make frameworkinstallextras DESTDIR=%s"
%
(
runCommand
(
"make frameworkinstallextras DESTDIR=%s"
%
(
shellQuote
(
rootDir
)))
shellQuote
(
rootDir
)))
print
(
"Copying required shared libraries"
)
print
"Copying required shared libraries"
if
os
.
path
.
exists
(
os
.
path
.
join
(
WORKDIR
,
'libraries'
,
'Library'
)):
if
os
.
path
.
exists
(
os
.
path
.
join
(
WORKDIR
,
'libraries'
,
'Library'
)):
runCommand
(
"mv %s/* %s"
%
(
runCommand
(
"mv %s/* %s"
%
(
shellQuote
(
os
.
path
.
join
(
shellQuote
(
os
.
path
.
join
(
...
@@ -658,7 +657,7 @@ def buildPython():
...
@@ -658,7 +657,7 @@ def buildPython():
'Python.framework'
,
'Versions'
,
getVersion
(),
'Python.framework'
,
'Versions'
,
getVersion
(),
'lib'
))))
'lib'
))))
print
(
"Fix file modes"
)
print
"Fix file modes"
frmDir
=
os
.
path
.
join
(
rootDir
,
'Library'
,
'Frameworks'
,
'Python.framework'
)
frmDir
=
os
.
path
.
join
(
rootDir
,
'Library'
,
'Frameworks'
,
'Python.framework'
)
gid
=
grp
.
getgrnam
(
'admin'
).
gr_gid
gid
=
grp
.
getgrnam
(
'admin'
).
gr_gid
...
@@ -747,7 +746,7 @@ def packageFromRecipe(targetDir, recipe):
...
@@ -747,7 +746,7 @@ def packageFromRecipe(targetDir, recipe):
readme
=
textwrap
.
dedent
(
recipe
[
'readme'
])
readme
=
textwrap
.
dedent
(
recipe
[
'readme'
])
isRequired
=
recipe
.
get
(
'required'
,
True
)
isRequired
=
recipe
.
get
(
'required'
,
True
)
print
(
"- building package %s"
%
(
pkgname
,)
)
print
"- building package %s"
%
(
pkgname
,
)
# Substitute some variables
# Substitute some variables
textvars
=
dict
(
textvars
=
dict
(
...
@@ -1050,9 +1049,9 @@ def main():
...
@@ -1050,9 +1049,9 @@ def main():
shutil
.
copy
(
'../../LICENSE'
,
os
.
path
.
join
(
WORKDIR
,
'installer'
,
'License.txt'
))
shutil
.
copy
(
'../../LICENSE'
,
os
.
path
.
join
(
WORKDIR
,
'installer'
,
'License.txt'
))
fp
=
open
(
os
.
path
.
join
(
WORKDIR
,
'installer'
,
'Build.txt'
),
'w'
)
fp
=
open
(
os
.
path
.
join
(
WORKDIR
,
'installer'
,
'Build.txt'
),
'w'
)
print
(
"# BUILD INFO"
,
file
=
fp
)
print
>>
fp
,
"# BUILD INFO"
print
(
"# Date:"
,
time
.
ctime
(),
file
=
fp
)
print
>>
fp
,
"# Date:"
,
time
.
ctime
(
)
print
(
"# By:"
,
pwd
.
getpwuid
(
os
.
getuid
()).
pw_gecos
,
file
=
fp
)
print
>>
fp
,
"# By:"
,
pwd
.
getpwuid
(
os
.
getuid
()).
pw_gecos
fp
.
close
()
fp
.
close
()
# Custom icon for the DMG, shown when the DMG is mounted.
# Custom icon for the DMG, shown when the DMG is mounted.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment