Python Cython.Distutils.build_ext.run() Examples

The following are 15 code examples of Cython.Distutils.build_ext.run(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module Cython.Distutils.build_ext , or try the search function .
Example #1
Source File: setup.py    From poetry with MIT License 6 votes vote down vote up
def run(self):
        optional = True
        disabled = True
        for ext in self.extensions:
            with_ext = self.distribution.ext_status(ext)
            if with_ext is None:
                disabled = False
            elif with_ext:
                optional = False
                disabled = False
                break
        if disabled:
            return
        try:
            _build_ext.run(self)
        except DistutilsPlatformError:
            exc = sys.exc_info()[1]
            if optional:
                log.warn(str(exc))
                log.warn("skipping build_ext")
            else:
                raise 
Example #2
Source File: setup.py    From YOLO3-4-Py with Apache License 2.0 6 votes vote down vote up
def run(self):
        if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)),"__libdarknet","libdarknet.so")):
            logging.info("removing __libdarknet/libdarknet.so")
            os.remove(os.path.join(os.path.dirname(__file__),"__libdarknet","libdarknet.so"))

        if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "libdarknet.so")):
            logging.info("removing libdarknet.so")
            os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)),"libdarknet.so"))

        if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)),"pydarknet.cpp")):
            logging.info("removing pydarknet.cpp")
            os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)),"pydarknet.cpp"))

        for f in os.listdir(os.path.dirname(os.path.abspath(__file__))):
            if f.startswith("pydarknet.") and f.endswith(".so"):
                logging.info("removing " + f)
                os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)),f))

        clean.run(self) 
Example #3
Source File: setup.py    From poetry with MIT License 5 votes vote down vote up
def run(self):
        build_cmd = self.get_finalized_command("build")
        build_cmd.run()
        sys.path.insert(0, build_cmd.build_lib)
        if sys.version_info[0] < 3:
            sys.path.insert(0, "tests/lib")
        else:
            sys.path.insert(0, "tests/lib3")
        import test_all

        if not test_all.main([]):
            raise DistutilsError("Tests failed") 
Example #4
Source File: setup.py    From pg-sync with GNU Lesser General Public License v3.0 5 votes vote down vote up
def run(self):

        build_ext.run(self)

        build_dir = Path(self.build_lib)
        root_dir = Path(__file__).parent

        target_dir = build_dir if not self.inplace else root_dir

        self.copy_file(
            Path('pgsync') / '__init__.py', root_dir, target_dir
        ) 
Example #5
Source File: setup.py    From pyuvdata with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def run(self):

        # Import numpy here, only when headers are needed
        import numpy

        # Add numpy headers to include_dirs
        self.include_dirs.append(numpy.get_include())

        # Call original build_ext command
        build_ext.run(self) 
Example #6
Source File: setup.py    From mdlp-discretization with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def run(self):
            import numpy
            self.include_dirs.append(numpy.get_include())
            build_ext.run(self) 
Example #7
Source File: setup.py    From pydriver with MIT License 5 votes vote down vote up
def update_version_py():
    """Update version.py using "git describe" command"""
    if not os.path.isdir('.git'):
        print('This does not appear to be a Git repository, leaving version.py unchanged.')
        return False
    try:
        describe_output = subprocess.check_output(['git', 'describe', '--long', '--dirty']).decode('ascii').strip()
    except:
        print('Unable to run Git, leaving version.py unchanged.')
        return False
    # output looks like <version tag>-<commits since tag>-g<hash> and can end with '-dirty', e.g. v0.1.0-14-gd9f10e2-dirty
    # our version tags look like 'v0.1.0' or 'v0.1' and optionally additional segments (e.g. v0.1.0rc1), see PEP 0440
    describe_parts = re.match('^v([0-9]+\.[0-9]+(?:\.[0-9]+)?\S*)-([0-9]+)-g([0-9a-f]+)(?:-(dirty))?$', describe_output)
    assert describe_parts is not None, 'Unexpected output from "git describe": {}'.format(describe_output)
    version_tag, n_commits, commit_hash, dirty_flag = describe_parts.groups()
    version_parts = re.match('^([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(\S*)$', version_tag)
    assert version_parts is not None, 'Unexpected version format: {}'.format(version_tag)
    version_major, version_minor, version_micro, version_segments = version_parts.groups()
    version_major = int(version_major)
    version_minor = int(version_minor)
    version_micro = int(version_micro) if version_micro is not None else 0
    n_commits = int(n_commits)
    if dirty_flag is not None:
        print('WARNING: Uncommitted changes detected.')
    if n_commits > 0:
        # non-exact match, dev version
        version_micro += 1
        version_segments += '.dev{}+{}'.format(n_commits, commit_hash)
    # final version string
    if version_micro > 0:
        version = '{}.{}.{}{}'.format(version_major, version_minor, version_micro, version_segments)
    else:
        version = '{}.{}{}'.format(version_major, version_minor, version_segments)
    with open(version_py_path, 'w') as f:
        f.write(version_py_src.format(version=version))
    print('Set version to: {}'.format(version))
    # success
    return True

# update version.py (if we're in a Git repository) 
Example #8
Source File: setup.py    From pydriver with MIT License 5 votes vote down vote up
def run(self):
        # create build dir if it doesn't exist
        if not os.path.exists(self.cwd_pcl_helper_dir_build):
            os.makedirs(self.cwd_pcl_helper_dir_build)
        # build pcl_helper
        if platform.system() == 'Windows':
            self._build_pcl_helper_windows(self.cwd_pcl_helper_dir_build)
        else:
            self._build_pcl_helper_linux(self.cwd_pcl_helper_dir_build) 
Example #9
Source File: setup.py    From pydriver with MIT License 5 votes vote down vote up
def run(self):
        if not self.skip_pcl_helper:
            # build pcl_helper first
            try:
                self.run_command('build_pcl_helper')
            except:
                print('Error: pcl_helper could not be compiled automatically')
                print('Please compile pcl_helper manually (see %s/pcl/pcl_helper/README.rst for instructions)' % __package__ + \
                    ' and set SKIP_PCL_HELPER in setup.py to True.')
                raise
        # copy pcl_helper library to package build directory
        self.copy_tree(self.cwd_pcl_helper_dir_lib, self.build_pcl_helper_dir_lib)
        _build_ext.run(self) 
Example #10
Source File: setup.py    From pydriver with MIT License 5 votes vote down vote up
def run(self):
        self._remove_dirs('__pycache__')

        self._remove_dir(cwd, 'build')
        self._remove_dir(cwd, 'build_c')
        self._remove_dir(cwd, 'dist')
        self._remove_dir(cwd, '.eggs')
        self._remove_dir(cwd, '{}.egg-info'.format(__package__))
        self._remove_dir(cwd, pcl_helper_dir_build)
        self._remove_dir(cwd, pcl_helper_dir_lib)

        self._remove_files('pyc')
        self._remove_files('pyo')
        self._remove_files('pyd')
        self._remove_files('so') 
Example #11
Source File: setup.py    From pairtools with MIT License 5 votes vote down vote up
def run(self):

        # Import numpy here, only when headers are needed
        import numpy

        # Add numpy headers to include_dirs
        self.include_dirs.append(numpy.get_include())

        # Call original build_ext command
        _build_ext.run(self) 
Example #12
Source File: setup.py    From YOLO3-4-Py with Apache License 2.0 5 votes vote down vote up
def run(self):
        # This is triggered when src distribution is made. Not triggered for build_ext.
        setup_darknet()
        build.run(self) 
Example #13
Source File: setup.py    From YOLO3-4-Py with Apache License 2.0 5 votes vote down vote up
def run(self):
        setup_darknet()
        build_ext.run(self)

        if not "DARKNET_HOME" in os.environ:
            clean_darknet(temp_dir) 
Example #14
Source File: setup.py    From backpack with MIT License 5 votes vote down vote up
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError:
            raise BuildExtFailed() 
Example #15
Source File: setup.py    From jenks with MIT License 5 votes vote down vote up
def run(self):
        # Import numpy here, only when headers are needed
        try:
            import numpy
        except ImportError:
            log.critical("Numpy is required to run setup(). Exiting.")
            sys.exit(1)
        # Add numpy headers to include_dirs
        self.include_dirs.append(numpy.get_include())
        # Call original build_ext command
        build_ext.run(self)