(self)
| 52 | self.inplace = True |
| 53 | |
| 54 | def finalize_options(self): |
| 55 | # finalize_options() may be called multiple times on the |
| 56 | # same command object, so make sure not to override previously |
| 57 | # set options. |
| 58 | if getattr(self, '_initialized', False): |
| 59 | return |
| 60 | |
| 61 | need_cythonize = self.cython_always |
| 62 | cfiles = {} |
| 63 | |
| 64 | for extension in self.distribution.ext_modules: |
| 65 | for i, sfile in enumerate(extension.sources): |
| 66 | if sfile.endswith('.pyx'): |
| 67 | prefix, ext = os.path.splitext(sfile) |
| 68 | cfile = prefix + '.c' |
| 69 | |
| 70 | if os.path.exists(cfile) and not self.cython_always: |
| 71 | extension.sources[i] = cfile |
| 72 | else: |
| 73 | if os.path.exists(cfile): |
| 74 | cfiles[cfile] = os.path.getmtime(cfile) |
| 75 | else: |
| 76 | cfiles[cfile] = 0 |
| 77 | need_cythonize = True |
| 78 | |
| 79 | if need_cythonize: |
| 80 | try: |
| 81 | import Cython |
| 82 | except ImportError: |
| 83 | import setuptools.build_meta |
| 84 | |
| 85 | raise setuptools.build_meta.SetupRequirementsError([CYTHON_DEPENDENCY]) |
| 86 | |
| 87 | from Cython.Build import cythonize |
| 88 | |
| 89 | directives = {} |
| 90 | if self.cython_directives: |
| 91 | for directive in self.cython_directives.split(','): |
| 92 | k, _, v = directive.partition('=') |
| 93 | if v.lower() == 'false': |
| 94 | v = False |
| 95 | if v.lower() == 'true': |
| 96 | v = True |
| 97 | |
| 98 | directives[k] = v |
| 99 | |
| 100 | self.distribution.ext_modules[:] = cythonize( |
| 101 | self.distribution.ext_modules, |
| 102 | compiler_directives=directives, |
| 103 | annotate=self.cython_annotate) |
| 104 | |
| 105 | super().finalize_options() |
| 106 | |
| 107 | self._initialized = True |
| 108 | |
| 109 | def build_extensions(self): |
| 110 | mod_parser, mod_url_parser = self.distribution.ext_modules |
nothing calls this directly
no outgoing calls
no test coverage detected