Skip to content

Commit

Permalink
Take the language into account when setting the source file if cython…
Browse files Browse the repository at this point in the history
… isn't available.

Addresses #405
  • Loading branch information
jamadden committed Jul 17, 2020
1 parent af57d6c commit 7297068
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
3.1.3 (unreleased)
==================

- Nothing changed yet.
- Source distributions: Fix installation when Cython isn't available.
Previously it incorrectly assumed a '.c' extension which lead to
compiler errors. See :issue:`405`.


3.1.2 (2020-07-14)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _dummy_cythonize(extensions, **_kwargs):
for sfile in extension.sources:
path, ext = os.path.splitext(sfile)
if ext in ('.pyx', '.py'):
ext = '.c'
ext = '.cpp' if extension.language == 'c++' else '.c'
sfile = path + ext
sources.append(sfile)
extension.sources[:] = sources
Expand All @@ -34,7 +34,7 @@ def _dummy_cythonize(extensions, **_kwargs):
try:
from Cython.Build import cythonize
except ImportError:
# The .c files had better already exist.
# The generated source files had better already exist.
cythonize = _dummy_cythonize


Expand Down

0 comments on commit 7297068

Please sign in to comment.