aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/extension.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2006-01-05 23:14:21 +0000
committerPJ Eby <distutils-sig@python.org>2006-01-05 23:14:21 +0000
commitbda5b372b2b631048897ec5ecee6eee98b3b06a9 (patch)
treec32de3922b34596a9a609c8a4589d174be451a9d /setuptools/extension.py
parentb28da64e5120e9c2fd5b964fb46f7f2ded2eb5a3 (diff)
downloadexternal_python_setuptools-bda5b372b2b631048897ec5ecee6eee98b3b06a9.tar.gz
external_python_setuptools-bda5b372b2b631048897ec5ecee6eee98b3b06a9.tar.bz2
external_python_setuptools-bda5b372b2b631048897ec5ecee6eee98b3b06a9.zip
First draft of shared library build support. See tests/shlib_test
for a trivial example. This has only been tested on Windows with a MinGW compiler, and the Mac OS support isn't finished. Testing w/other platforms+compilers would be helpful. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041927
Diffstat (limited to 'setuptools/extension.py')
-rw-r--r--setuptools/extension.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/setuptools/extension.py b/setuptools/extension.py
index 37b62576..33b870f0 100644
--- a/setuptools/extension.py
+++ b/setuptools/extension.py
@@ -1,19 +1,20 @@
from distutils.core import Extension as _Extension
+from dist import _get_unpatched
+_Extension = _get_unpatched(_Extension)
try:
from Pyrex.Distutils.build_ext import build_ext
-
except ImportError:
+ have_pyrex = False
+else:
+ have_pyrex = True
- # Pyrex isn't around, so fix up the sources
-
- from dist import _get_unpatched
- _Extension = _get_unpatched(_Extension)
-
- class Extension(_Extension):
- """Extension that uses '.c' files in place of '.pyx' files"""
+class Extension(_Extension):
+ """Extension that uses '.c' files in place of '.pyx' files"""
+ if not have_pyrex:
+ # convert .pyx extensions to .c
def __init__(self,*args,**kw):
_Extension.__init__(self,*args,**kw)
sources = []
@@ -24,14 +25,12 @@ except ImportError:
sources.append(s)
self.sources = sources
- import sys, distutils.core, distutils.extension
- distutils.core.Extension = Extension
- distutils.extension.Extension = Extension
- if 'distutils.command.build_ext' in sys.modules:
- sys.modules['distutils.command.build_ext'].Extension = Extension
-
-else:
+class SharedLibrary(Extension):
+ """Just like a regular Extension, but built as a shared library instead"""
- # Pyrex is here, just use regular extension type
- Extension = _Extension
+import sys, distutils.core, distutils.extension
+distutils.core.Extension = Extension
+distutils.extension.Extension = Extension
+if 'distutils.command.build_ext' in sys.modules:
+ sys.modules['distutils.command.build_ext'].Extension = Extension