Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(269)

Delta Between Two Patch Sets: setup.py

Issue 7652: Merge C version of decimal into py3k.
Left Patch Set: Created 7 years, 6 months ago
Right Patch Set: Created 7 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « pyconfig.h.in ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Autodetecting setup.py script for building the Python extensions 1 # Autodetecting setup.py script for building the Python extensions
2 # 2 #
3 3
4 import sys, os, imp, re, optparse 4 import sys, os, imp, re, optparse
5 from glob import glob 5 from glob import glob
6 import sysconfig 6 import sysconfig
7 7
8 from distutils import log 8 from distutils import log
9 from distutils import text_file 9 from distutils import text_file
10 from distutils.errors import * 10 from distutils.errors import *
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 # Platform-dependent module source and include directories 189 # Platform-dependent module source and include directories
190 platform = self.get_platform() 190 platform = self.get_platform()
191 191
192 # Fix up the paths for scripts, too 192 # Fix up the paths for scripts, too
193 self.distribution.scripts = [os.path.join(srcdir, filename) 193 self.distribution.scripts = [os.path.join(srcdir, filename)
194 for filename in self.distribution.scripts] 194 for filename in self.distribution.scripts]
195 195
196 # Python header files 196 # Python header files
197 headers = [sysconfig.get_config_h_filename()] 197 headers = [sysconfig.get_config_h_filename()]
198 headers += glob(os.path.join(sysconfig.get_path('platinclude'), "*.h")) 198 headers += glob(os.path.join(sysconfig.get_path('include'), "*.h"))
199 199
200 for ext in self.extensions[:]: 200 for ext in self.extensions[:]:
201 ext.sources = [ find_module_file(filename, moddirlist) 201 ext.sources = [ find_module_file(filename, moddirlist)
202 for filename in ext.sources ] 202 for filename in ext.sources ]
203 if ext.depends is not None: 203 if ext.depends is not None:
204 ext.depends = [find_module_file(filename, moddirlist) 204 ext.depends = [find_module_file(filename, moddirlist)
205 for filename in ext.depends] 205 for filename in ext.depends]
206 else: 206 else:
207 ext.depends = [] 207 ext.depends = []
208 # re-compile extensions if a header file has been changed 208 # re-compile extensions if a header file has been changed
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 exts.append( Extension("_heapq", ["_heapqmodule.c"]) ) 523 exts.append( Extension("_heapq", ["_heapqmodule.c"]) )
524 # C-optimized pickle replacement 524 # C-optimized pickle replacement
525 exts.append( Extension("_pickle", ["_pickle.c"]) ) 525 exts.append( Extension("_pickle", ["_pickle.c"]) )
526 # atexit 526 # atexit
527 exts.append( Extension("atexit", ["atexitmodule.c"]) ) 527 exts.append( Extension("atexit", ["atexitmodule.c"]) )
528 # _json speedups 528 # _json speedups
529 exts.append( Extension("_json", ["_json.c"]) ) 529 exts.append( Extension("_json", ["_json.c"]) )
530 # Python C API test module 530 # Python C API test module
531 exts.append( Extension('_testcapi', ['_testcapimodule.c'], 531 exts.append( Extension('_testcapi', ['_testcapimodule.c'],
532 depends=['testcapi_long.h']) ) 532 depends=['testcapi_long.h']) )
533 # Python PEP-3118 (buffer protocol) test module
534 exts.append( Extension('_testbuffer', ['_testbuffer.c']) )
533 # profiler (_lsprof is for cProfile.py) 535 # profiler (_lsprof is for cProfile.py)
534 exts.append( Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']) ) 536 exts.append( Extension('_lsprof', ['_lsprof.c', 'rotatingtree.c']) )
535 # static Unicode character database 537 # static Unicode character database
536 exts.append( Extension('unicodedata', ['unicodedata.c']) ) 538 exts.append( Extension('unicodedata', ['unicodedata.c']) )
537 539
538 # Modules with some UNIX dependencies -- on by default: 540 # Modules with some UNIX dependencies -- on by default:
539 # (If you have a really backward UNIX, select and socket may not be 541 # (If you have a really backward UNIX, select and socket may not be
540 # supported...) 542 # supported...)
541 543
542 # fcntl(2) and ioctl(2) 544 # fcntl(2) and ioctl(2)
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 break 1791 break
1790 1792
1791 if ffi_inc and ffi_lib: 1793 if ffi_inc and ffi_lib:
1792 ext.include_dirs.extend(ffi_inc) 1794 ext.include_dirs.extend(ffi_inc)
1793 ext.libraries.append(ffi_lib) 1795 ext.libraries.append(ffi_lib)
1794 self.use_system_libffi = True 1796 self.use_system_libffi = True
1795 1797
1796 def _decimal_ext(self): 1798 def _decimal_ext(self):
1797 sources = [ 1799 sources = [
1798 '_decimal/_decimal.c', 1800 '_decimal/_decimal.c',
1799 '_decimal/basearith.c', 1801 '_decimal/libmpdec/basearith.c',
1800 '_decimal/constants.c', 1802 '_decimal/libmpdec/constants.c',
1801 '_decimal/context.c', 1803 '_decimal/libmpdec/context.c',
1802 '_decimal/convolute.c', 1804 '_decimal/libmpdec/convolute.c',
1803 '_decimal/crt.c', 1805 '_decimal/libmpdec/crt.c',
1804 '_decimal/difradix2.c', 1806 '_decimal/libmpdec/difradix2.c',
1805 '_decimal/fnt.c', 1807 '_decimal/libmpdec/fnt.c',
1806 '_decimal/fourstep.c', 1808 '_decimal/libmpdec/fourstep.c',
1807 '_decimal/io.c', 1809 '_decimal/libmpdec/io.c',
1808 '_decimal/memory.c', 1810 '_decimal/libmpdec/memory.c',
1809 '_decimal/mpdecimal.c', 1811 '_decimal/libmpdec/mpdecimal.c',
1810 '_decimal/numbertheory.c', 1812 '_decimal/libmpdec/numbertheory.c',
1811 '_decimal/sixstep.c', 1813 '_decimal/libmpdec/sixstep.c',
1812 '_decimal/transpose.c', 1814 '_decimal/libmpdec/transpose.c',
1813 ] 1815 ]
1814 depends = [ 1816 depends = [
1815 '_decimal/basearith.h',
1816 '_decimal/bits.h',
1817 '_decimal/constants.h',
1818 '_decimal/convolute.h',
1819 '_decimal/crt.h',
1820 '_decimal/difradix2.h',
1821 '_decimal/docstrings.h', 1817 '_decimal/docstrings.h',
1822 '_decimal/fnt.h', 1818 '_decimal/libmpdec/basearith.h',
1823 '_decimal/fourstep.h', 1819 '_decimal/libmpdec/bits.h',
1824 '_decimal/io.h', 1820 '_decimal/libmpdec/constants.h',
1825 '_decimal/memory.h', 1821 '_decimal/libmpdec/convolute.h',
1826 '_decimal/mpdecimal.h', 1822 '_decimal/libmpdec/crt.h',
1827 '_decimal/mptypes.h', 1823 '_decimal/libmpdec/difradix2.h',
1828 '_decimal/numbertheory.h', 1824 '_decimal/libmpdec/fnt.h',
1829 '_decimal/sixstep.h', 1825 '_decimal/libmpdec/fourstep.h',
1830 '_decimal/transpose.h', 1826 '_decimal/libmpdec/io.h',
1831 '_decimal/typearith.h', 1827 '_decimal/libmpdec/memory.h',
1832 '_decimal/umodarith.h', 1828 '_decimal/libmpdec/mpdecimal.h',
1829 '_decimal/libmpdec/numbertheory.h',
1830 '_decimal/libmpdec/sixstep.h',
1831 '_decimal/libmpdec/transpose.h',
1832 '_decimal/libmpdec/typearith.h',
1833 '_decimal/libmpdec/umodarith.h',
1833 ] 1834 ]
1834 config = { 1835 config = {
1835 'x64': [('CONFIG_64','1'), ('ASM','1')], 1836 'x64': [('CONFIG_64','1'), ('ASM','1')],
1836 'uint128': [('CONFIG_64','1'), ('ANSI','1'), ('HAVE_UINT128_T','1')], 1837 'uint128': [('CONFIG_64','1'), ('ANSI','1'), ('HAVE_UINT128_T','1')],
1837 'ansi64': [('CONFIG_64','1'), ('ANSI','1')], 1838 'ansi64': [('CONFIG_64','1'), ('ANSI','1')],
1838 'ppro': [('CONFIG_32','1'), ('PPRO','1'), ('ASM','1')], 1839 'ppro': [('CONFIG_32','1'), ('PPRO','1'), ('ASM','1')],
1839 'ansi32': [('CONFIG_32','1'), ('ANSI','1')], 1840 'ansi32': [('CONFIG_32','1'), ('ANSI','1')],
1840 'ansi-legacy': [('CONFIG_32','1'), ('ANSI','1'), 1841 'ansi-legacy': [('CONFIG_32','1'), ('ANSI','1'),
1841 ('LEGACY_COMPILER','1')], 1842 ('LEGACY_COMPILER','1')],
1842 'universal': [('UNIVERSAL','1')] 1843 'universal': [('UNIVERSAL','1')]
1843 } 1844 }
1844 1845
1846 include_dirs = ['./Modules/_decimal/libmpdec']
1845 extra_compile_args = [] 1847 extra_compile_args = []
1846 undef_macros=['NDEBUG'] 1848 undef_macros=['NDEBUG']
1847 1849
1848 platform = self.get_platform() 1850 platform = self.get_platform()
1849 cc = sysconfig.get_config_var('CC') 1851 cc = sysconfig.get_config_var('CC')
1850 sizeof_size_t = sysconfig.get_config_var('SIZEOF_SIZE_T') 1852 sizeof_size_t = sysconfig.get_config_var('SIZEOF_SIZE_T')
1851 machine = os.environ.get('PYTHON_DECIMAL_WITH_MACHINE') 1853 machine = os.environ.get('PYTHON_DECIMAL_WITH_MACHINE')
1852 1854
1853 if machine: 1855 if machine:
1854 # Override automatic configuration to facilitate testing. 1856 # Override automatic configuration to facilitate testing.
(...skipping 29 matching lines...) Expand all
1884 extra_compile_args.append('-fno-ipa-pure-const') 1886 extra_compile_args.append('-fno-ipa-pure-const')
1885 if sysconfig.get_config_var('HAVE_GLIBC_MEMMOVE_BUG'): 1887 if sysconfig.get_config_var('HAVE_GLIBC_MEMMOVE_BUG'):
1886 # _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect: 1888 # _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect:
1887 # http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html 1889 # http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
1888 undef_macros.append('_FORTIFY_SOURCE') 1890 undef_macros.append('_FORTIFY_SOURCE')
1889 1891
1890 # Faster version without thread local contexts: 1892 # Faster version without thread local contexts:
1891 if not sysconfig.get_config_var('WITH_THREAD'): 1893 if not sysconfig.get_config_var('WITH_THREAD'):
1892 define_macros.append(('WITHOUT_THREADS', 1)) 1894 define_macros.append(('WITHOUT_THREADS', 1))
1893 1895
1896 # Uncomment for extra functionality:
1897 #define_macros.append(('EXTRA_FUNCTIONALITY', 1))
1894 ext = Extension ( 1898 ext = Extension (
1895 '_decimal', 1899 '_decimal',
1900 include_dirs=include_dirs,
1896 define_macros=define_macros, 1901 define_macros=define_macros,
1897 undef_macros=undef_macros, 1902 undef_macros=undef_macros,
1898 extra_compile_args=extra_compile_args, 1903 extra_compile_args=extra_compile_args,
1899 sources=sources, 1904 sources=sources,
1900 depends=depends 1905 depends=depends
1901 ) 1906 )
1902 return ext 1907 return ext
1903 1908
1904 class PyBuildInstall(install): 1909 class PyBuildInstall(install):
1905 # Suppress the warning about installation into the lib_dynload 1910 # Suppress the warning about installation into the lib_dynload
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 # If you change the scripts installed here, you also need to 2032 # If you change the scripts installed here, you also need to
2028 # check the PyBuildScripts command above, and change the links 2033 # check the PyBuildScripts command above, and change the links
2029 # created by the bininstall target in Makefile.pre.in 2034 # created by the bininstall target in Makefile.pre.in
2030 scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", 2035 scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
2031 "Tools/scripts/2to3", "Tools/scripts/pysetup3"] 2036 "Tools/scripts/2to3", "Tools/scripts/pysetup3"]
2032 ) 2037 )
2033 2038
2034 # --install-platlib 2039 # --install-platlib
2035 if __name__ == '__main__': 2040 if __name__ == '__main__':
2036 main() 2041 main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+