Skip to content

Commit 50bd1a4

Browse files
committed
Runtime pyrex -> cython option renaming
1 parent 6b3cc5a commit 50bd1a4

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

Cython/Distutils/build_ext.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ class build_ext(_build_ext.build_ext):
103103
"compiler directive overrides"),
104104
('pyrex-gdb', None,
105105
"generate debug information for cygdb"),
106-
('pyrex-compile-time-env', None,
107-
"cython compile time environment"),
108106
])
109107

110108
boolean_options.extend([
@@ -128,6 +126,19 @@ def initialize_options(self):
128126
self.cython_gdb = False
129127
self.no_c_in_traceback = 0
130128
self.cython_compile_time_env = None
129+
130+
def __getattr__(self, name):
131+
if name[:6] == 'pyrex_':
132+
return getattr(self, 'cython_' + name[6:])
133+
else:
134+
return _build_ext.build_ext.__getattr__(self, name)
135+
136+
def __setattr__(self, name, value):
137+
if name[:6] == 'pyrex_':
138+
return setattr(self, 'cython_' + name[6:], value)
139+
else:
140+
# _build_ext.build_ext.__setattr__(self, name, value)
141+
self.__dict__[name] = value
131142

132143
def finalize_options (self):
133144
_build_ext.build_ext.finalize_options(self)

Cython/Distutils/extension.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Extension(_Extension.Extension):
4040

4141
# When adding arguments to this constructor, be sure to update
4242
# user_options.extend in build_ext.py.
43-
def __init__ (self, name, sources,
43+
def __init__(self, name, sources,
4444
include_dirs = None,
4545
define_macros = None,
4646
undef_macros = None,
@@ -65,6 +65,31 @@ def __init__ (self, name, sources,
6565
no_c_in_traceback = False,
6666
cython_compile_time_env = None,
6767
**kw):
68+
69+
# Translate pyrex_X to cython_X for backwards compatibility.
70+
had_pyrex_options = False
71+
for key in kw.keys():
72+
if key.startswith('pyrex_'):
73+
had_pyrex_options = True
74+
kw['cython' + key[5:]] = kw.pop(key)
75+
if had_pyrex_options:
76+
Extension.__init__(self, name, sources,
77+
include_dirs = include_dirs,
78+
define_macros = define_macros,
79+
undef_macros = undef_macros,
80+
library_dirs = library_dirs,
81+
libraries = libraries,
82+
runtime_library_dirs = runtime_library_dirs,
83+
extra_objects = extra_objects,
84+
extra_compile_args = extra_compile_args,
85+
extra_link_args = extra_link_args,
86+
export_symbols = export_symbols,
87+
#swig_opts = swig_opts,
88+
depends = depends,
89+
language = language,
90+
no_c_in_traceback = no_c_in_traceback,
91+
**kw)
92+
return
6893

6994
_Extension.Extension.__init__(self, name, sources,
7095
include_dirs = include_dirs,

0 commit comments

Comments
 (0)