-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fix the non cython build for cpp extensions #19707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
7666765
0b0f318
ea7c9e2
d1e1a2e
d3a8757
641d0ac
42a80c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,7 +311,6 @@ class CheckSDist(sdist_class): | |
'pandas/_libs/missing.pyx', | ||
'pandas/_libs/reduction.pyx', | ||
'pandas/_libs/testing.pyx', | ||
'pandas/_libs/window.pyx', | ||
'pandas/_libs/skiplist.pyx', | ||
'pandas/_libs/sparse.pyx', | ||
'pandas/_libs/parsers.pyx', | ||
|
@@ -331,19 +330,24 @@ class CheckSDist(sdist_class): | |
'pandas/_libs/writers.pyx', | ||
'pandas/io/sas/sas.pyx'] | ||
|
||
_cpp_pyxfiles = ['pandas/_libs/window.pyx'] | ||
|
||
def initialize_options(self): | ||
sdist_class.initialize_options(self) | ||
|
||
def run(self): | ||
if 'cython' in cmdclass: | ||
self.run_command('cython') | ||
else: | ||
for pyxfile in self._pyxfiles: | ||
cfile = pyxfile[:-3] + 'c' | ||
msg = ("C-source file '{source}' not found.\n" | ||
"Run 'setup.py cython' before sdist.".format( | ||
source=cfile)) | ||
assert os.path.isfile(cfile), msg | ||
pyx_files = [(self._pyxfiles, 'c'), (self._cpp_pyxfiles, 'cpp')] | ||
|
||
for pyxfiles, extension in pyx_files: | ||
for pyxfile in pyxfiles: | ||
sourcefile = pyxfile[:-3] + extension | ||
msg = ("{extension}-source file '{source}' not found.\n" | ||
"Run 'setup.py cython' before sdist.".format( | ||
source=sourcefile, extension=extension)) | ||
assert os.path.isfile(sourcefile), msg | ||
sdist_class.run(self) | ||
|
||
|
||
|
@@ -618,7 +622,8 @@ def pxd(name): | |
'_libs.window': { | ||
'pyxfile': '_libs/window', | ||
'pxdfiles': ['_libs/skiplist', '_libs/src/util'], | ||
'language': 'c++'}, | ||
'language': 'c++', | ||
'suffix': '.cpp'}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rather than adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess I just saw it as more of a configuration piece that belonged in a dictionary over branches in the code. I could do something like: if suffix == '.pyx':
source_suffix = '.pyx'
elif data.get('language', 'c') == 'c++':
source_suffix = '.cpp'
else:
source_suffix = '.c' But that feels a bit verbose. Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a huge deal, but that feels cleaner to me. Reading the config I would probably guess |
||
'_libs.writers': { | ||
'pyxfile': '_libs/writers', | ||
'pxdfiles': ['_libs/src/util']}, | ||
|
@@ -628,7 +633,9 @@ def pxd(name): | |
extensions = [] | ||
|
||
for name, data in ext_data.items(): | ||
sources = [srcpath(data['pyxfile'], suffix=suffix, subdir='')] | ||
source_suffix = suffix if suffix == '.pyx' else data.get('suffix', '.c') | ||
|
||
sources = [srcpath(data['pyxfile'], suffix=source_suffix, subdir='')] | ||
pxds = [pxd(x) for x in data.get('pxdfiles', [])] | ||
if suffix == '.pyx' and pxds: | ||
sources.extend(pxds) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some comments on what is going on here