Python distutils.command.build_ext.build_ext 模块,run() 实例源码

我们从Python开源项目中,提取了以下35个代码示例,用于说明如何使用distutils.command.build_ext.build_ext.run()

项目:atropos    作者:jdidion    | 项目源码 | 文件源码
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
项目:coincurve    作者:ofek    | 项目源码 | 文件源码
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)
项目:pytest-cython    作者:lgpage    | 项目源码 | 文件源码
def run(self):
            try:
                build_ext.run(self)
            except Exception as e:
                self._unavailable(e)
                self.extensions = []  # avoid copying missing files (it would fail).
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
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.")
项目:yarl    作者:aio-libs    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except (DistutilsPlatformError, FileNotFoundError):
            raise BuildFailed()
项目:piqueserver    作者:piqueserver    | 项目源码 | 文件源码
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)
项目:cbor_py    作者:brianolson    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            raise BuildError()
项目:yosai_libauthz    作者:YosaiProject    | 项目源码 | 文件源码
def run(self):
        os.system('rm -vrf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info ./target; py.cleanup -d')
项目:yosai_libauthz    作者:YosaiProject    | 项目源码 | 文件源码
def run(self):
        build_py.run(self)
        build_yosai_libauthz(os.path.join(self.build_lib, *PACKAGE.split('.')))
项目:yosai_libauthz    作者:YosaiProject    | 项目源码 | 文件源码
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))
项目:apm-agent-python    作者:elastic    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            raise BuildExtFailed()
项目:backpack    作者:sdispater    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            raise BuildExtFailed()
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            raise BuildFailed()
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def run(self):
        import sys, subprocess
        raise SystemExit(
            subprocess.call([sys.executable,
                             # Turn on deprecation warnings
                             '-Wd',
                             'simplejson/tests/__init__.py']))
项目:pendulum    作者:sdispater    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except (DistutilsPlatformError, FileNotFoundError):
            raise BuildFailed()
项目:ms_deisotope    作者:mobiusklein    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            traceback.print_exc()
            raise BuildFailed()
项目:atropos    作者:jdidion    | 项目源码 | 文件源码
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)
项目:atropos    作者:jdidion    | 项目源码 | 文件源码
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)
项目:deb-python-wrapt    作者:openstack    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            raise BuildExtFailed()
项目:multidict    作者:aio-libs    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except (DistutilsPlatformError, FileNotFoundError):
            raise BuildFailed()
项目:annotated-py-tornado    作者:hhstore    | 项目源码 | 文件源码
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."))
项目:influxgraph    作者:InfluxGraph    | 项目源码 | 文件源码
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            raise BuildFailed()
项目:aredis    作者:NoneGG    | 项目源码 | 文件源码
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."))
项目:giraffez    作者:capitalone    | 项目源码 | 文件源码
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)
项目:aweasome_learning    作者:Knight-ZXW    | 项目源码 | 文件源码
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."))
项目:durotar    作者:markgao    | 项目源码 | 文件源码
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."))
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
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."))
项目:coincurve    作者:ofek    | 项目源码 | 文件源码
def run(self):
        # Ensure library has been downloaded (sdist might have been skipped)
        download_library(self)

        _egg_info.run(self)
项目:coincurve    作者:ofek    | 项目源码 | 文件源码
def run(self):
        download_library(self)
        _sdist.run(self)
项目:coincurve    作者:ofek    | 项目源码 | 文件源码
def run(self):
            download_library(self)
            _bdist_wheel.run(self)
项目:coincurve    作者:ofek    | 项目源码 | 文件源码
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)
项目:python-dse-driver    作者:datastax    | 项目源码 | 文件源码
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.")
项目:ProgrameFacil    作者:Gpzim98    | 项目源码 | 文件源码
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."))
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
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))
项目:python-dse-driver    作者:datastax    | 项目源码 | 文件源码
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))