Skip to content

Commit

Permalink
adjust poetry build script
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantgoel committed Aug 1, 2019
1 parent ae1f8cd commit 127f899
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions build.py
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})

0 comments on commit 127f899

Please sign in to comment.