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
64585988
Commit
64585988
authored
Jan 01, 2005
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create the wrapper scripts for gcc/g++ too.
parent
f791d7a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
26 deletions
+50
-26
Mac/OSX/fixapplepython23.py
Mac/OSX/fixapplepython23.py
+50
-26
No files found.
Mac/OSX/fixapplepython23.py
View file @
64585988
...
@@ -16,10 +16,26 @@ import os
...
@@ -16,10 +16,26 @@ import os
import
gestalt
import
gestalt
MAKEFILE
=
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/Makefile'
MAKEFILE
=
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/Makefile'
OLD_LDSHARED
=
'LDSHARED=
\
t
$(CC) $(LDFLAGS) -bundle -framework $(PYTHONFRAMEWORK)
\
n
'
CHANGES
=
((
OLD_BLDSHARED
=
'B'
+
OLD_LDSHARED
'LDSHARED=
\
t
$(CC) $(LDFLAGS) -bundle -framework $(PYTHONFRAMEWORK)
\
n
'
,
NEW_LDSHARED
=
'LDSHARED=
\
t
env MACOSX_DEPLOYMENT_TARGET=10.3 $(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup
\
n
'
'LDSHARED=
\
t
$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup
\
n
'
NEW_BLDSHARED
=
'B'
+
NEW_LDSHARED
),(
'BLDSHARED=
\
t
$(CC) $(LDFLAGS) -bundle -framework $(PYTHONFRAMEWORK)
\
n
'
,
'BLDSHARED=
\
t
$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup
\
n
'
),(
'CC=
\
t
\
t
gcc
\
n
'
,
'CC=
\
t
\
t
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-gcc
\
n
'
),(
'CXX=
\
t
\
t
c++
\
n
'
,
'CXX=
\
t
\
t
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-g++
\
n
'
))
GCC_SCRIPT
=
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-gcc'
GXX_SCRIPT
=
'/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-g++'
SCRIPT
=
"""#!/bin/sh
export MACOSX_DEPLOYMENT_TARGET=10.3
exec %s "${@}"
"""
def
findline
(
lines
,
start
):
def
findline
(
lines
,
start
):
"""return line starting with given string or -1"""
"""return line starting with given string or -1"""
...
@@ -33,28 +49,19 @@ def fix(makefile, do_apply):
...
@@ -33,28 +49,19 @@ def fix(makefile, do_apply):
fixed
=
False
fixed
=
False
lines
=
open
(
makefile
).
readlines
()
lines
=
open
(
makefile
).
readlines
()
i
=
findline
(
lines
,
'LDSHARED='
)
for
old
,
new
in
CHANGES
:
if
i
<
0
:
i
=
findline
(
lines
,
new
)
print
'fixapplepython23: Python installation not fixed (appears broken, no LDSHARED)'
if
i
>=
0
:
return
2
# Already fixed
if
lines
[
i
]
==
OLD_LDSHARED
:
continue
lines
[
i
]
=
NEW_LDSHARED
i
=
findline
(
lines
,
old
)
fixed
=
True
if
i
<
0
:
elif
lines
[
i
]
!=
NEW_LDSHARED
:
print
'fixapplepython23: Python installation not fixed (appears broken)'
print
'fixapplepython23: Python installation not fixed (appears modified, unexpected LDSHARED)'
print
'fixapplepython23: missing line:'
,
old
return
2
return
2
lines
[
i
]
=
new
i
=
findline
(
lines
,
'BLDSHARED='
)
if
i
<
0
:
print
'fixapplepython23: Python installation not fixed (appears broken, no BLDSHARED)'
return
2
if
lines
[
i
]
==
OLD_BLDSHARED
:
lines
[
i
]
=
NEW_BLDSHARED
fixed
=
True
fixed
=
True
elif
lines
[
i
]
!=
NEW_BLDSHARED
:
print
'fixapplepython23: Python installation not fixed (appears modified, unexpected BLDSHARED)'
return
2
if
fixed
:
if
fixed
:
if
do_apply
:
if
do_apply
:
print
'fixapplepython23: Fix to Apple-installed Python 2.3 applied'
print
'fixapplepython23: Fix to Apple-installed Python 2.3 applied'
...
@@ -68,6 +75,17 @@ def fix(makefile, do_apply):
...
@@ -68,6 +75,17 @@ def fix(makefile, do_apply):
print
'fixapplepython23: No fix needed, appears to have been applied before'
print
'fixapplepython23: No fix needed, appears to have been applied before'
return
0
return
0
def
makescript
(
filename
,
compiler
):
"""Create a wrapper script for a compiler"""
dirname
=
os
.
path
.
split
(
filename
)[
0
]
if
not
os
.
access
(
dirname
,
os
.
X_OK
):
os
.
mkdir
(
dirname
,
0755
)
fp
=
open
(
filename
,
'w'
)
fp
.
write
(
SCRIPT
%
compiler
)
fp
.
close
()
os
.
chmod
(
filename
,
0755
)
print
'fixapplepython23: Created'
,
filename
def
main
():
def
main
():
# Check for -n option
# Check for -n option
if
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
'-n'
:
if
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
==
'-n'
:
...
@@ -86,7 +104,13 @@ def main():
...
@@ -86,7 +104,13 @@ def main():
if
do_apply
and
not
os
.
access
(
MAKEFILE
,
os
.
W_OK
):
if
do_apply
and
not
os
.
access
(
MAKEFILE
,
os
.
W_OK
):
print
'fixapplepython23: No write permission, please run with "sudo"'
print
'fixapplepython23: No write permission, please run with "sudo"'
sys
.
exit
(
2
)
sys
.
exit
(
2
)
# And finally fix it
# Create the shell scripts
if
do_apply
:
if
not
os
.
access
(
GCC_SCRIPT
,
os
.
X_OK
):
makescript
(
GCC_SCRIPT
,
"gcc"
)
if
not
os
.
access
(
GXX_SCRIPT
,
os
.
X_OK
):
makescript
(
GXX_SCRIPT
,
"g++"
)
# Finally fix the makefile
rv
=
fix
(
MAKEFILE
,
do_apply
)
rv
=
fix
(
MAKEFILE
,
do_apply
)
sys
.
exit
(
rv
)
sys
.
exit
(
rv
)
...
...
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