summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-03-24 02:19:29 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-03-24 02:19:29 (GMT)
commit1dc54009391974ecc6d18f202be05a230a92ca60 (patch)
treecf31772659cedd334f0fef4a05586ea78bbec8ae /setup.py
parentf8bba8e843451ac479633fe641345ade21149c44 (diff)
downloadcpython-1dc54009391974ecc6d18f202be05a230a92ca60.zip
cpython-1dc54009391974ecc6d18f202be05a230a92ca60.tar.gz
cpython-1dc54009391974ecc6d18f202be05a230a92ca60.tar.bz2
Merged revisions 61820-61823 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61820 | gregory.p.smith | 2008-03-23 23:14:38 +0100 (Sun, 23 Mar 2008) | 2 lines replace calls to get the initial values with the raw constants. ........ r61821 | gregory.p.smith | 2008-03-24 00:43:02 +0100 (Mon, 24 Mar 2008) | 2 lines A bugfix for r61813, it would fail if the data size was >=2**32. ........ r61822 | gregory.p.smith | 2008-03-24 00:45:12 +0100 (Mon, 24 Mar 2008) | 2 lines prevent a warning from the struct module when data size >= 2**32. ........ r61823 | gregory.p.smith | 2008-03-24 01:08:01 +0100 (Mon, 24 Mar 2008) | 4 lines Have the binascii module use zlib's optimized crc32() function when available to reduce our code size (1k data table and tiny bit of code). It falls back to its own without zlib. ........
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index 2365a0b..be34cd1 100644
--- a/setup.py
+++ b/setup.py
@@ -472,9 +472,6 @@ class PyBuildExt(build_ext):
# select(2); not on ancient System V
exts.append( Extension('select', ['selectmodule.c']) )
- # Helper module for various ascii-encoders
- exts.append( Extension('binascii', ['binascii.c']) )
-
# Fred Drake's interface to the Python parser
exts.append( Extension('parser', ['parsermodule.c']) )
@@ -1005,6 +1002,7 @@ class PyBuildExt(build_ext):
# You can upgrade zlib to version 1.1.4 yourself by going to
# http://www.gzip.org/zlib/
zlib_inc = find_file('zlib.h', [], inc_dirs)
+ have_zlib = False
if zlib_inc is not None:
zlib_h = zlib_inc[0] + '/zlib.h'
version = '"0.0.0"'
@@ -1026,6 +1024,7 @@ class PyBuildExt(build_ext):
exts.append( Extension('zlib', ['zlibmodule.c'],
libraries = ['z'],
extra_link_args = zlib_extra_link_args))
+ have_zlib = True
else:
missing.append('zlib')
else:
@@ -1033,6 +1032,21 @@ class PyBuildExt(build_ext):
else:
missing.append('zlib')
+ # Helper module for various ascii-encoders. Uses zlib for an optimized
+ # crc32 if we have it. Otherwise binascii uses its own.
+ if have_zlib:
+ extra_compile_args = ['-DUSE_ZLIB_CRC32']
+ libraries = ['z']
+ extra_link_args = zlib_extra_link_args
+ else:
+ extra_compile_args = []
+ libraries = []
+ extra_link_args = []
+ exts.append( Extension('binascii', ['binascii.c'],
+ extra_compile_args = extra_compile_args,
+ libraries = libraries,
+ extra_link_args = extra_link_args) )
+
# Gustavo Niemeyer's bz2 module.
if (self.compiler.find_library_file(lib_dirs, 'bz2')):
if sys.platform == "darwin":