-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae1f8cd
commit 127f899
Showing
1 changed file
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
from Cython.Build import cythonize | ||
from setuptools import Extension | ||
|
||
try: | ||
from Cython.Build import cythonize | ||
except ImportError: | ||
USE_CYTHON = False | ||
else: | ||
USE_CYTHON = True | ||
|
||
|
||
def build(setup_kwargs): | ||
setup_kwargs.update( | ||
{'ext_modules': cythonize(['streaming_form_data/_parser.pyx'])} | ||
) | ||
file_ext = 'pyx' if USE_CYTHON else 'c' | ||
|
||
extensions = [ | ||
Extension( | ||
'streaming_form_data._parser', | ||
[f'streaming_form_data/_parser.{file_ext}'], | ||
) | ||
] | ||
|
||
if USE_CYTHON: | ||
extensions = cythonize(extensions) | ||
|
||
setup_kwargs.update({'ext_modules': extensions}) |