Python setuptools.command.build_ext.build_ext.run() Examples

The following are 30 code examples of setuptools.command.build_ext.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 setuptools.command.build_ext.build_ext , or try the search function .
Example #1
Source File: setup.py    From supersqlite with MIT License 6 votes vote down vote up
def run(self):
        if not(download_and_install_wheel()):
            custom_compile(THIRD_PARTY, INTERNAL)
            install_req_wheels()
            open(BUILT_LOCAL, 'w+').close()
        print("Running install...")
        p = Process(target=install.run, args=(self,))
        p.start()
        p.join()
        print("Done running install")
        if not(download_and_install_wheel()):
            print("Running egg_install...")
            p = Process(target=install.do_egg_install, args=(self,))
            p.start()
            p.join()
            install_requirements()
            print("Done running egg_install")
        else:
            print("Skipping egg_install")
        copy_custom_compile() 
Example #2
Source File: setup.py    From tartiflette with MIT License 6 votes vote down vote up
def _build_libgraphqlparser():
    os.chdir("./libgraphqlparser/.")
    subprocess.run(["cmake", "."], stdout=subprocess.PIPE)
    subprocess.run(["make"], stdout=subprocess.PIPE)
    os.chdir("..")

    artifact_path = _find_libgraphqlparser_artifact()

    if not artifact_path:
        print("Libgraphqlparser compilation has failed")
        sys.exit(-1)

    os.rename(
        artifact_path,
        "tartiflette/language/parsers/libgraphqlparser/cffi/%s"
        % os.path.basename(artifact_path),
    ) 
Example #3
Source File: setup.py    From pymoo with Apache License 2.0 6 votes vote down vote up
def construct_build_ext(build_ext):
    class WrappedBuildExt(build_ext):
        def run(self):
            try:
                build_ext.run(self)
            except BaseException as e:
                raise CompilingFailed(e)

        def build_extension(self, ext):
            try:
                build_ext.build_extension(self, ext)
            except BaseException as e:
                raise CompilingFailed(e)

    return WrappedBuildExt


# ============================================================
# SETUP
# ============================================================ 
Example #4
Source File: setup.py    From renku-python with Apache License 2.0 6 votes vote down vote up
def run(self):
        from renku.core.commands.init import fetch_template, \
            read_template_manifest

        with TemporaryDirectory() as tempdir:
            # download and extract template data
            temppath = Path(tempdir)
            print('downloading Renku templates...')
            fetch_template(URL, REFERENCE, temppath)
            read_template_manifest(temppath, checkout=True)

            # copy templates
            current_path = Path.cwd()
            template_path = current_path / 'renku' / 'templates'
            if template_path.exists():
                shutil.rmtree(str(template_path))
            shutil.copytree(
                str(temppath),
                str(template_path),
                ignore=shutil.ignore_patterns('.git')
            ) 
Example #5
Source File: setup.py    From azure-uamqp-python with MIT License 6 votes vote down vote up
def run(self):
        monkey.patch_all()
        cmake_build_dir = None
        for ext in self.extensions:
            if isinstance(ext, UAMQPExtension):
                self.build_cmake(ext)
                # Now I have built in ext.cmake_build_dir
                cmake_build_dir = self.cmake_build_dir
            else:
                ext.library_dirs += [
                    cmake_build_dir,
                    cmake_build_dir + "/deps/azure-c-shared-utility/",
                    cmake_build_dir + "/Debug/",
                    cmake_build_dir + "/Release/",
                    cmake_build_dir + "/deps/azure-c-shared-utility/Debug/",
                    cmake_build_dir + "/deps/azure-c-shared-utility/Release/"
                ]

        if is_win and is_27:
            ext.library_dirs.extend([lib for lib in get_msvc_env(9.0)['LIB'].split(';') if lib])
            ext.library_dirs.extend(get_latest_windows_sdk())

        build_ext_orig.run(self) 
Example #6
Source File: cuda_setup.py    From implicit with MIT License 6 votes vote down vote up
def run(self):
        if CUDA is not None:
            def wrap_new_compiler(func):
                def _wrap_new_compiler(*args, **kwargs):
                    try:
                        return func(*args, **kwargs)
                    except errors.DistutilsPlatformError:
                        if not sys.platform == 'win32':
                            CCompiler = _UnixCCompiler
                        else:
                            CCompiler = _MSVCCompiler
                        return CCompiler(
                            None, kwargs['dry_run'], kwargs['force'])
                return _wrap_new_compiler
            ccompiler.new_compiler = wrap_new_compiler(ccompiler.new_compiler)
            # Intentionally causes DistutilsPlatformError in
            # ccompiler.new_compiler() function to hook.
            self.compiler = 'nvidia'

        setuptools_build_ext.run(self) 
Example #7
Source File: setup.py    From pycbc with GNU General Public License v3.0 6 votes vote down vote up
def run(self):
        import pkg_resources

        # At this point we can be sure pip has already installed numpy
        numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')

        for ext in self.extensions:
            if (hasattr(ext, 'include_dirs') and
                    numpy_incl not in ext.include_dirs):
                ext.include_dirs.append(numpy_incl)

        _build_ext.run(self)


# Add swig-generated files to the list of things to clean, so they
# get regenerated each time. 
Example #8
Source File: setup.py    From medaka with Mozilla Public License 2.0 5 votes vote down vote up
def run(self):

        def compile_hts():
            subprocess.check_call(['make', 'libhts.a'])

        self.execute(compile_hts, [], 'Compiling htslib using Makefile')
        build_ext.run(self)

# Nasty hack to get binaries into bin path 
Example #9
Source File: setup.py    From supersqlite with MIT License 5 votes vote down vote up
def run(self):
        if not(download_and_install_wheel()):
            print("Running build_ext...")
            p = Process(target=build_ext.run, args=(self,))
            p.start()
            p.join()
            print("Done running build_ext")
        else:
            print("Skipping build_ext...") 
Example #10
Source File: setup.py    From supersqlite with MIT License 5 votes vote down vote up
def run(self):
            if not(download_and_install_wheel()):
                custom_compile(THIRD_PARTY, INTERNAL)
                build_req_wheels()
                open(BUILT_LOCAL, 'w+').close()
            print("Running wheel...")
            bdist_wheel_.run(self)
            print("Done running wheel")
            copy_custom_compile() 
Example #11
Source File: setup.py    From medaka with Mozilla Public License 2.0 5 votes vote down vote up
def get_setuptools_script_dir():
    # Run the above class just to get paths
    dist = Distribution({'cmdclass': {'install': GetPaths}})
    dist.dry_run = True
    dist.parse_config_files()
    command = dist.get_command_obj('install')
    command.ensure_finalized()
    command.run()

    print(dist.install_libbase)
    src_dir = glob(os.path.join(dist.install_libbase, 'medaka-*', 'exes'))[0]
    for exe in (os.path.join(src_dir, x) for x in os.listdir(src_dir)):
        print("Copying", os.path.basename(exe), '->', dist.install_scripts)
        shutil.copy(exe, dist.install_scripts)
    return dist.install_libbase, dist.install_scripts 
Example #12
Source File: setup.py    From medaka with Mozilla Public License 2.0 5 votes vote down vote up
def run(self):
        self.distribution.install_scripts = self.install_scripts
        self.distribution.install_libbase = self.install_libbase 
Example #13
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 #14
Source File: setup.py    From dwave-neal with Apache License 2.0 5 votes vote down vote up
def run(self):
        import numpy

        self.include_dirs.append(numpy.get_include())

        build_ext.run(self) 
Example #15
Source File: setup.py    From cookiecutter-pylibrary with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def run(self):
        try:
            build_ext.run(self)
        except Exception as e:
            self._unavailable(e)
            self.extensions = []  # avoid copying missing files (it would fail). 
Example #16
Source File: setup.py    From brotlipy with MIT License 5 votes vote down vote up
def run(self):
        self.run_command("build_clib")
        build_ext.run(self) 
Example #17
Source File: setup.py    From python-hunter with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def run(self):
        try:
            if 'SETUPPY_NOEXT' in os.environ:
                raise Exception('C extensions disabled (SETUPPY_NOEXT)!')
            build_ext.run(self)
        except Exception as e:
            self._unavailable(e)
            self.extensions = []  # avoid copying missing files (it would fail). 
Example #18
Source File: setup.py    From python-lazy-object-proxy with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def run(self):
        try:
            build_ext.run(self)
        except Exception as e:
            self._unavailable(e)
            self.extensions = []  # avoid copying missing files (it would fail). 
Example #19
Source File: setup.py    From python-igraph with GNU General Public License v2.0 5 votes vote down vote up
def preprocess_fallback_config():
    """Preprocesses the fallback include and library paths depending on the
    platform."""
    global LIBIGRAPH_FALLBACK_INCLUDE_DIRS
    global LIBIGRAPH_FALLBACK_LIBRARY_DIRS
    global LIBIGRAPH_FALLBACK_LIBRARIES

    if platform.system() == "Windows" and distutils.ccompiler.get_default_compiler() == "msvc":
        # if this setup is run in the source checkout *and* the igraph msvc was build,
        # this code adds the right library and include dir
        msvc_builddir = find_msvc_source_folder(os.path.join("..", ".."), requires_built=True)

        if msvc_builddir is not None:
            print("Using MSVC build dir: %s\n\n" % msvc_builddir)
            LIBIGRAPH_FALLBACK_INCLUDE_DIRS = [
                os.path.join(msvc_builddir, "include")
            ]
            LIBIGRAPH_FALLBACK_LIBRARY_DIRS = [
                os.path.join(msvc_builddir, "Release")
            ]
            return True
        else:
            return False

    else:
        return True 
Example #20
Source File: setup.py    From python-igraph with GNU General Public License v2.0 5 votes vote down vote up
def build_c_core(self):
        """Returns a class representing a custom setup.py command that builds
        the C core of igraph.

        This is used in CI environments where we want to build the C core of
        igraph once and then build the Python interface for various Python
        versions without having to recompile the C core all the time.

        If is also used as a custom building block of `build_ext`.
        """

        buildcfg = self

        class build_c_core(Command):
            description = "Compile the C core of igraph only"
            user_options = []

            def initialize_options(self):
                pass

            def finalize_options(self):
                pass

            def run(self):
                buildcfg.c_core_built = buildcfg.compile_igraph_from_vendor_source()

        return build_c_core 
Example #21
Source File: setup.py    From python-igraph with GNU General Public License v2.0 5 votes vote down vote up
def sdist(self):
        """Returns a class that can be used as a replacement for the
        ``sdist`` command in ``setuptools`` and that will clean up
        ``vendor/source/igraph`` before running the original ``sdist``
        command.
        """
        from setuptools.command.sdist import sdist
        from distutils.sysconfig import get_python_inc

        buildcfg = self

        class custom_sdist(sdist):
            def run(self):
                # Clean up vendor/source/igraph with git
                cwd = os.getcwd()
                try:
                    os.chdir(os.path.join("vendor", "source", "igraph"))
                    if os.path.exists(".git"):
                        retcode = subprocess.call("git clean -dfx", shell=True)
                        if retcode:
                            print("Failed to clean vendor/source/igraph with git")
                            print("")
                            return False
                finally:
                    os.chdir(cwd)

                # Run the original sdist command
                sdist.run(self)

        return custom_sdist 
Example #22
Source File: setup.py    From deap with GNU Lesser General Public License v3.0 5 votes vote down vote up
def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError as e:
            print(e)
            raise BuildFailed() 
Example #23
Source File: setup.py    From pycbc with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        _clean.run(self)
        for f in self.clean_files:
            try:
                os.unlink(f)
                print('removed {0}'.format(f))
            except:
                pass

        for fol in self.clean_folders:
            shutil.rmtree(fol, ignore_errors=True)
            print('removed {0}'.format(fol))

# write versioning info 
Example #24
Source File: setup.py    From pycbc with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        subprocess.check_call("cd docs; cp Makefile.std Makefile; sphinx-apidoc "
                              " -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html",
                            stderr=subprocess.STDOUT, shell=True) 
Example #25
Source File: setup.py    From pycbc with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        subprocess.check_call("mkdir -p _gh-pages/latest && touch _gh-pages/.nojekyll && "
                              "cd docs; cp Makefile.gh_pages Makefile; sphinx-apidoc "
                              " -o ./ -f -A 'PyCBC dev team' -V '0.1' ../pycbc && make html",
                            stderr=subprocess.STDOUT, shell=True) 
Example #26
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) 
Example #27
Source File: setup.py    From Fast_Sentence_Embeddings with GNU General Public License v3.0 5 votes vote down vote up
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.') 
Example #28
Source File: setup.py    From yass with Apache License 2.0 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 #29
Source File: setup.py    From nfstream with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        self.run_command('nDPI')
        build_py.run(self) 
Example #30
Source File: setup.py    From simnibs with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        develop.run(self)
        if sys.platform == 'win32':
            for f in glob.glob(os.path.join('simnibs', 'lib', 'win', '*')):
                shutil.copy(
                    f,
                    os.path.join('simnibs', 'cython_code', os.path.basename(f)))
        if sys.platform == 'darwin':
            for f in glob.glob(os.path.join('simnibs', 'lib', 'osx', '*')):
                shutil.copy(
                    f,
                    os.path.join('simnibs', 'cython_code', os.path.basename(f)))