我们从Python开源项目中,提取了以下35个代码示例,用于说明如何使用distutils.command.build_ext.build_ext.run()。
def out_of_date(extensions): """ Check whether any pyx source is newer than the corresponding generated C source or whether any C source is missing. """ for extension in extensions: for pyx in extension.sources: path, ext = os.path.splitext(pyx) if ext not in ('.pyx', '.py'): continue if extension.language == 'c++': csource = path + '.cpp' else: csource = path + '.c' # When comparing modification times, allow five seconds slack: # If the installation is being run from pip, modification # times are not preserved and therefore depends on the order in # which files were unpacked. if not os.path.exists(csource) or ( os.path.getmtime(pyx) > os.path.getmtime(csource) + 5): return True return False
def run(self): if self.distribution.has_c_libraries(): _build_clib = self.get_finalized_command('build_clib') self.include_dirs.append( os.path.join(_build_clib.build_clib, 'include'), ) self.include_dirs.extend(_build_clib.build_flags['include_dirs']) self.library_dirs.append( os.path.join(_build_clib.build_clib, 'lib'), ) self.library_dirs.extend(_build_clib.build_flags['library_dirs']) self.define = _build_clib.build_flags['define'] return _build_ext.run(self)
def run(self): try: build_ext.run(self) except Exception as e: self._unavailable(e) self.extensions = [] # avoid copying missing files (it would fail).
def run(self): try: self._setup_extensions() build_ext.run(self) except DistutilsPlatformError as exc: sys.stderr.write('%s\n' % str(exc)) warnings.warn(self.error_message % "C extensions.")
def run(self): try: build_ext.run(self) except (DistutilsPlatformError, FileNotFoundError): raise BuildFailed()
def run(self): from Cython.Build import cythonize compiler_directives = {} if linetrace: compiler_directives['linetrace'] = True self.extensions = cythonize(self.extensions, compiler_directives=compiler_directives) _build_ext.run(self) run_setup(os.path.join(os.getcwd(), "setup.py"), ['build_py'] + extra_args)
def run(self): try: build_ext.run(self) except DistutilsPlatformError: raise BuildError()
def run(self): os.system('rm -vrf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info ./target; py.cleanup -d')
def run(self): build_py.run(self) build_yosai_libauthz(os.path.join(self.build_lib, *PACKAGE.split('.')))
def run(self): build_ext.run(self) if self.inplace: build_py = self.get_finalized_command('build_py') build_yosai_libauthz(build_py.get_package_dir(PACKAGE))
def run(self): try: build_ext.run(self) except DistutilsPlatformError: raise BuildExtFailed()
def run(self): try: build_ext.run(self) except DistutilsPlatformError: raise BuildFailed()
def run(self): import sys, subprocess raise SystemExit( subprocess.call([sys.executable, # Turn on deprecation warnings '-Wd', 'simplejson/tests/__init__.py']))
def run(self): try: build_ext.run(self) except DistutilsPlatformError: traceback.print_exc() raise BuildFailed()
def run(self): # If we encounter a PKG-INFO file, then this is likely a .tar.gz/.zip # file retrieved from PyPI that already includes the pre-cythonized # extension modules, and then we do not need to run cythonize(). if os.path.exists('PKG-INFO'): no_cythonize(extensions) else: # Otherwise, this is a 'developer copy' of the code, and then the # only sensible thing is to require Cython to be installed. check_cython_version() from Cython.Build import cythonize self.extensions = cythonize(self.extensions) _build_ext.run(self)
def run(self): # Make sure the compiled Cython files in the distribution are up-to-date from Cython.Build import cythonize check_cython_version() cythonize(extensions) versioneer_sdist.run(self)
def run(self): try: build_ext.run(self) except Exception: e = sys.exc_info()[1] sys.stdout.write('%s\n' % str(e)) warnings.warn(self.warning_message % ("Extension modules", "There was an issue with " "your platform configuration" " - see above."))
def run(self): # Disabling parallel build for now. It causes issues on multiple # platforms with concurrent file access causing odd build errors #self.parallel = multiprocessing.cpu_count() build_ext.run(self)
def run(self): try: build_ext.run(self) except Exception: e = sys.exc_info()[1] sys.stdout.write("%s\n" % (str(e),)) warnings.warn(self.warning_message % ("Extension modules", "There was an issue with " "your platform configuration" " - see above."))
def run(self): # Ensure library has been downloaded (sdist might have been skipped) download_library(self) _egg_info.run(self)
def run(self): download_library(self) _sdist.run(self)
def run(self): download_library(self) _bdist_wheel.run(self)
def run(self): if not has_system_lib(): raise DistutilsError( "This library is not usable in 'develop' mode when using the " 'bundled libsecp256k1. See README for details.') _develop.run(self)
def run(self): if self.test: path = "docs/_build/doctest" mode = "doctest" else: path = "docs/_build/%s" % __version__ mode = "html" try: os.makedirs(path) except: pass if has_subprocess: # Prevent run with in-place extensions because cython-generated objects do not carry docstrings # http://docs.cython.org/src/userguide/special_methods.html#docstrings import glob for f in glob.glob("cassandra/*.so"): print("Removing '%s' to allow docs to run on pure python modules." %(f,)) os.unlink(f) # Build io extension to make import and docstrings work try: output = subprocess.check_output( ["python", "setup.py", "build_ext", "--inplace", "--force", "--no-murmur3", "--no-cython"], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: raise RuntimeError("Documentation step '%s' failed: %s: %s" % ("build_ext", exc, exc.output)) else: print(output) try: output = subprocess.check_output( ["sphinx-build", "-b", mode, "docs", path], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: raise RuntimeError("Documentation step '%s' failed: %s: %s" % (mode, exc, exc.output)) else: print(output) print("") print("Documentation step '%s' performed, results here:" % mode) print(" file://%s/%s/index.html" % (os.path.dirname(os.path.realpath(__file__)), path))
def run(self): if self.test: path = "docs/_build/doctest" mode = "doctest" else: path = "docs/_build/%s" % __version__ mode = "html" try: os.makedirs(path) except: pass if has_subprocess: # Prevent run with in-place extensions because cython-generated objects do not carry docstrings # http://docs.cython.org/src/userguide/special_methods.html#docstrings import glob for f in glob.glob("dse/*.so"): print("Removing '%s' to allow docs to run on pure python modules." %(f,)) os.unlink(f) # Build io extension to make import and docstrings work try: output = subprocess.check_output( ["python", "setup.py", "build_ext", "--inplace", "--force", "--no-murmur3", "--no-cython"], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: raise RuntimeError("Documentation step '%s' failed: %s: %s" % ("build_ext", exc, exc.output)) else: print(output) try: output = subprocess.check_output( ["sphinx-build", "-b", mode, "docs", path], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: raise RuntimeError("Documentation step '%s' failed: %s: %s" % (mode, exc, exc.output)) else: print(output) print("") print("Documentation step '%s' performed, results here:" % mode) print(" file://%s/%s/index.html" % (os.path.dirname(os.path.realpath(__file__)), path))