From 9bf3af55ff0f3ee318e76770659b38e3cc662ff3 Mon Sep 17 00:00:00 2001 From: AbdealiJK Date: Mon, 29 Apr 2019 09:38:16 +0530 Subject: [PATCH] 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. --- setup.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index ee9351e..c8ff569 100644 --- a/setup.py +++ b/setup.py @@ -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],