3030# Adapted from Cython's new_build_ext
3131class build_ext (_build_ext ):
3232 def finalize_options (self ):
33- # Check dependencies
34- try :
35- from Cython .Build .Dependencies import cythonize
36- except ImportError as E :
37- sys .stderr .write ("Error: {0}\n " .format (E ))
38- sys .stderr .write ("The installation of cypari2 requires Cython\n " )
39- sys .exit (1 )
40-
41- try :
42- # We need the header files for cysignals at compile-time
43- import cysignals
44- except ImportError as E :
45- sys .stderr .write ("Error: {0}\n " .format (E ))
46- sys .stderr .write ("The installation of cypari2 requires cysignals\n " )
47- sys .exit (1 )
48-
4933 # Generate auto-generated sources from pari.desc
5034 rebuild ()
5135
@@ -56,11 +40,16 @@ def finalize_options(self):
5640 "language_level" : 2 ,
5741 }
5842
43+ _build_ext .finalize_options (self )
44+
45+ def run (self ):
46+ # Run Cython
47+ from Cython .Build .Dependencies import cythonize
5948 self .distribution .ext_modules [:] = cythonize (
6049 self .distribution .ext_modules ,
6150 compiler_directives = self .directives )
6251
63- _build_ext .finalize_options (self )
52+ _build_ext .run (self )
6453
6554
6655class no_egg (_bdist_egg ):
@@ -79,6 +68,8 @@ def run(self):
7968setup (
8069 name = 'cypari2' ,
8170 version = VERSION ,
71+ setup_requires = ['Cython>=0.28' ],
72+ install_requires = ['cysignals>=1.7' ],
8273 description = "A Python interface to the number theory library PARI/GP" ,
8374 long_description = README ,
8475 url = 'https://github.com/defeo/cypari2' ,
0 commit comments