OLD | NEW |
(Empty) | |
| 1 """Pyrex.Distutils.extension |
| 2 |
| 3 Provides a modified Extension class, that understands how to describe |
| 4 Pyrex extension modules in setup scripts.""" |
| 5 |
| 6 __revision__ = "$Id:$" |
| 7 |
| 8 import sys |
| 9 import distutils.extension as _Extension |
| 10 |
| 11 try: |
| 12 import warnings |
| 13 except ImportError: |
| 14 warnings = None |
| 15 |
| 16 |
| 17 class Extension(_Extension.Extension): |
| 18 # When adding arguments to this constructor, be sure to update |
| 19 # user_options.extend in build_ext.py. |
| 20 def __init__(self, name, sources, |
| 21 include_dirs=None, |
| 22 define_macros=None, |
| 23 undef_macros=None, |
| 24 library_dirs=None, |
| 25 libraries=None, |
| 26 runtime_library_dirs=None, |
| 27 extra_objects=None, |
| 28 extra_compile_args=None, |
| 29 extra_link_args=None, |
| 30 export_symbols=None, |
| 31 #swig_opts=None, |
| 32 depends=None, |
| 33 language=None, |
| 34 cython_include_dirs=None, |
| 35 cython_directives=None, |
| 36 cython_create_listing=False, |
| 37 cython_line_directives=False, |
| 38 cython_cplus=False, |
| 39 cython_c_in_temp=False, |
| 40 cython_gen_pxi=False, |
| 41 cython_gdb=False, |
| 42 no_c_in_traceback=False, |
| 43 cython_compile_time_env=None, |
| 44 **kw): |
| 45 |
| 46 # Translate pyrex_X to cython_X for backwards compatibility. |
| 47 had_pyrex_options = False |
| 48 for key in kw.keys(): |
| 49 if key.startswith('pyrex_'): |
| 50 had_pyrex_options = True |
| 51 kw['cython' + key[5:]] = kw.pop(key) |
| 52 if had_pyrex_options: |
| 53 Extension.__init__( |
| 54 self, name, sources, |
| 55 include_dirs=include_dirs, |
| 56 define_macros=define_macros, |
| 57 undef_macros=undef_macros, |
| 58 library_dirs=library_dirs, |
| 59 libraries=libraries, |
| 60 runtime_library_dirs=runtime_library_dirs, |
| 61 extra_objects=extra_objects, |
| 62 extra_compile_args=extra_compile_args, |
| 63 extra_link_args=extra_link_args, |
| 64 export_symbols=export_symbols, |
| 65 #swig_opts=swig_opts, |
| 66 depends=depends, |
| 67 language=language, |
| 68 no_c_in_traceback=no_c_in_traceback, |
| 69 **kw) |
| 70 return |
| 71 |
| 72 _Extension.Extension.__init__( |
| 73 self, name, sources, |
| 74 include_dirs=include_dirs, |
| 75 define_macros=define_macros, |
| 76 undef_macros=undef_macros, |
| 77 library_dirs=library_dirs, |
| 78 libraries=libraries, |
| 79 runtime_library_dirs=runtime_library_dirs, |
| 80 extra_objects=extra_objects, |
| 81 extra_compile_args=extra_compile_args, |
| 82 extra_link_args=extra_link_args, |
| 83 export_symbols=export_symbols, |
| 84 #swig_opts=swig_opts, |
| 85 depends=depends, |
| 86 language=language, |
| 87 **kw) |
| 88 |
| 89 self.cython_include_dirs = cython_include_dirs or [] |
| 90 self.cython_directives = cython_directives or {} |
| 91 self.cython_create_listing = cython_create_listing |
| 92 self.cython_line_directives = cython_line_directives |
| 93 self.cython_cplus = cython_cplus |
| 94 self.cython_c_in_temp = cython_c_in_temp |
| 95 self.cython_gen_pxi = cython_gen_pxi |
| 96 self.cython_gdb = cython_gdb |
| 97 self.no_c_in_traceback = no_c_in_traceback |
| 98 self.cython_compile_time_env = cython_compile_time_env |
| 99 |
| 100 # class Extension |
| 101 |
| 102 read_setup_file = _Extension.read_setup_file |
| 103 |
| 104 |
| 105 # reuse and extend original docstring from base class (if we can) |
| 106 if sys.version_info[0] < 3 and _Extension.Extension.__doc__: |
| 107 # -OO discards docstrings |
| 108 Extension.__doc__ = _Extension.Extension.__doc__ + """\ |
| 109 cython_include_dirs : [string] |
| 110 list of directories to search for Pyrex header files (.pxd) (in |
| 111 Unix form for portability) |
| 112 cython_directives : {string:value} |
| 113 dict of compiler directives |
| 114 cython_create_listing_file : boolean |
| 115 write pyrex error messages to a listing (.lis) file. |
| 116 cython_line_directives : boolean |
| 117 emit pyx line numbers for debugging/profiling |
| 118 cython_cplus : boolean |
| 119 use the C++ compiler for compiling and linking. |
| 120 cython_c_in_temp : boolean |
| 121 put generated C files in temp directory. |
| 122 cython_gen_pxi : boolean |
| 123 generate .pxi file for public declarations |
| 124 cython_gdb : boolean |
| 125 generate Cython debug information for this extension for cygdb |
| 126 no_c_in_traceback : boolean |
| 127 emit the c file and line number from the traceback for exceptions |
| 128 """ |
OLD | NEW |