setup.py: Add cython to setup_requires

setup_requires is a method to add libraries that are needed during
the setup.py execution. This is picked up by easy_install and is
installed in the build directory for the build to occur.

This simplifies the installation of pyjnius from source
distributions as the cython dependency for build is managed by the
python package management toolchain.
This commit is contained in:
AbdealiJK 2019-04-29 09:38:16 +05:30
parent 6553ad4409
commit 9bf3af55ff
1 changed files with 8 additions and 5 deletions

View File

@ -53,6 +53,7 @@ LIB_LOCATION = None
EXTRA_LINK_ARGS = []
INCLUDE_DIRS = []
INSTALL_REQUIRES = ['six>=1.7.0']
SETUP_REQUIRES = []
# detect Python for android
PLATFORM = sys.platform
@ -71,11 +72,12 @@ except ImportError:
except ImportError:
from distutils.command.build_ext import build_ext
if PLATFORM != 'android':
print('\n\nYou need Cython to compile Pyjnius.\n\n')
raise
# On Android we expect to see 'c' files lying about.
# and we go ahead with the 'desktop' file? Odd.
FILES = [fn[:-3] + 'c' for fn in FILES if fn.endswith('pyx')]
SETUP_REQUIRES.append('cython')
INSTALL_REQUIRES.append('cython')
else:
# On Android we expect to see 'c' files lying about.
# and we go ahead with the 'desktop' file? Odd.
FILES = [fn[:-3] + 'c' for fn in FILES if fn.endswith('pyx')]
def find_javac(possible_homes):
@ -262,6 +264,7 @@ SETUP_KWARGS['py_modules'].remove('setup')
setup(
cmdclass={'build_ext': build_ext},
install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES,
ext_modules=[
Extension(
'jnius', [join('jnius', x) for x in FILES],