Commit 4439b7c6 authored by Jack Jansen's avatar Jack Jansen

Fixed a few showstoppers in the process of making MacPython use setup.py to...

Fixed a few showstoppers in the process of making MacPython use setup.py to build it's exension modules (in stead of relying on a private mechanism). It definitely doesn't work yet, but it looks promising.
parent ab5320bf
...@@ -18,7 +18,7 @@ def add_dir_to_list(dirlist, dir): ...@@ -18,7 +18,7 @@ def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (at the front) if """Add the directory 'dir' to the list 'dirlist' (at the front) if
1) 'dir' is not already in 'dirlist' 1) 'dir' is not already in 'dirlist'
2) 'dir' actually exists, and is a directory.""" 2) 'dir' actually exists, and is a directory."""
if os.path.isdir(dir) and dir not in dirlist: if dir is not None and os.path.isdir(dir) and dir not in dirlist:
dirlist.insert(0, dir) dirlist.insert(0, dir)
def find_file(filename, std_dirs, paths): def find_file(filename, std_dirs, paths):
...@@ -99,7 +99,7 @@ class PyBuildExt(build_ext): ...@@ -99,7 +99,7 @@ class PyBuildExt(build_ext):
# Platform-dependent module source and include directories # Platform-dependent module source and include directories
platform = self.get_platform() platform = self.get_platform()
if platform == 'darwin': if platform in ('darwin', 'mac'):
# Mac OS X also includes some mac-specific modules # Mac OS X also includes some mac-specific modules
macmoddir = os.path.join(os.getcwd(), srcdir, 'Mac/Modules') macmoddir = os.path.join(os.getcwd(), srcdir, 'Mac/Modules')
moddirlist.append(macmoddir) moddirlist.append(macmoddir)
...@@ -126,20 +126,21 @@ class PyBuildExt(build_ext): ...@@ -126,20 +126,21 @@ class PyBuildExt(build_ext):
if ext.name in sys.builtin_module_names: if ext.name in sys.builtin_module_names:
self.extensions.remove(ext) self.extensions.remove(ext)
# Parse Modules/Setup to figure out which modules are turned if platform != 'mac':
# on in the file. # Parse Modules/Setup to figure out which modules are turned
input = text_file.TextFile('Modules/Setup', join_lines=1) # on in the file.
remove_modules = [] input = text_file.TextFile('Modules/Setup', join_lines=1)
while 1: remove_modules = []
line = input.readline() while 1:
if not line: break line = input.readline()
line = line.split() if not line: break
remove_modules.append( line[0] ) line = line.split()
input.close() remove_modules.append( line[0] )
input.close()
for ext in self.extensions[:]:
if ext.name in remove_modules: for ext in self.extensions[:]:
self.extensions.remove(ext) if ext.name in remove_modules:
self.extensions.remove(ext)
# When you run "make CC=altcc" or something similar, you really want # When you run "make CC=altcc" or something similar, you really want
# those environment variables passed into the setup.py phase. Here's # those environment variables passed into the setup.py phase. Here's
...@@ -258,7 +259,7 @@ class PyBuildExt(build_ext): ...@@ -258,7 +259,7 @@ class PyBuildExt(build_ext):
# Check for MacOS X, which doesn't need libm.a at all # Check for MacOS X, which doesn't need libm.a at all
math_libs = ['m'] math_libs = ['m']
if platform in ['darwin', 'beos']: if platform in ['darwin', 'beos', 'mac']:
math_libs = [] math_libs = []
# XXX Omitted modules: gl, pure, dl, SGI-specific modules # XXX Omitted modules: gl, pure, dl, SGI-specific modules
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment