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

The following are 30 code examples of setuptools.command.build_ext.build_ext.finalize_options(). 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 quaternion with MIT License 6 votes vote down vote up
def finalize_options(self):
                _build_ext.finalize_options(self)
                # Prevent numpy from thinking it is still in its setup process:
                try:
                    __builtins__.__NUMPY_SETUP__ = False
                except:
                    try:
                        # For python 3
                        import builtins
                        builtins.__NUMPY_SETUP__ = False
                    except:
                        warn("Skipping numpy hack; if installation fails, try installing numpy first")
                import numpy
                self.include_dirs.append(numpy.get_include())
                if numpy.__dict__.get('quaternion') is not None:
                    from distutils.errors import DistutilsError
                    raise DistutilsError('The target NumPy already has a quaternion type') 
Example #2
Source File: setup.py    From pyacvd with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #3
Source File: setup.py    From Fast_Sentence_Embeddings with GNU General Public License v3.0 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        if isinstance(__builtins__, dict):
            __builtins__['__NUMPY_SETUP__'] = False
        else:
            __builtins__.__NUMPY_SETUP__ = False

        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #4
Source File: setup.py    From pyfasttext with GNU General Public License v3.0 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        # prevent numpy from thinking it is still in its setup process
        if USE_NUMPY:
            __builtins__.__NUMPY_SETUP__ = False
            import numpy as np
            self.include_dirs.append(np.get_include()) 
Example #5
Source File: setup.py    From pybm3d with GNU General Public License v3.0 5 votes vote down vote up
def finalize_options(self):
        """Extends default finalize_options method.

        Injects NumPy`s C include directories into the Cython compilation. This
        is done after NumPy was installed through the setuptools setup_requires
        argument which removes NumPy from the necessary preinstalled
        packages."""

        _build_ext.finalize_options(self)
        # prevent numpy from thinking it is still in its setup process
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #6
Source File: setup.py    From cu2qu with Apache License 2.0 5 votes vote down vote up
def finalize_options(self):
        if with_cython:
            if not has_cython:
                from distutils.errors import DistutilsSetupError

                raise DistutilsSetupError(
                    "%s is required when using --with-cython" % required_cython
                )

            from Cython.Build import cythonize

            # optionally enable line tracing for test coverage support
            linetrace = os.environ.get("CYTHON_TRACE") == "1"

            self.distribution.ext_modules[:] = cythonize(
                self.distribution.ext_modules,
                force=linetrace or self.force,
                annotate=os.environ.get("CYTHON_ANNOTATE") == "1",
                quiet=not self.verbose,
                compiler_directives={
                    "linetrace": linetrace,
                    "language_level": 3,
                    "embedsignature": True,
                },
            )
        else:
            # replace *.py/.pyx sources with their pre-generated *.c versions
            for ext in self.distribution.ext_modules:
                ext.sources = [re.sub("\.pyx?$", ".c", n) for n in ext.sources]

        _build_ext.finalize_options(self) 
Example #7
Source File: setup.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def finalize_options(self):
        print("Finalizing options")
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #8
Source File: setup.py    From oecophylla with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include())


# Dealing with Cython 
Example #9
Source File: setup.py    From msprime with GNU General Public License v3.0 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        import builtins

        # Prevent numpy from thinking it is still in its setup process:
        builtins.__NUMPY_SETUP__ = False
        import numpy

        self.include_dirs.append(numpy.get_include()) 
Example #10
Source File: setup.py    From radvel with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #11
Source File: setup.py    From astromodels with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def finalize_options(self):

        _build_ext.finalize_options(self)

        # Prevent numpy from thinking it is still in its setup process:

        __builtins__.__NUMPY_SETUP__ = False

        import numpy

        self.include_dirs.append(numpy.get_include())
        self.include_dirs.append('astromodels/xspec/include') 
Example #12
Source File: setup.py    From pycorels with GNU General Public License v3.0 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #13
Source File: setup.py    From cmarkgfm with MIT License 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        is_windows = platform.system() == 'Windows'
        is_py2 = sys.version_info[0] < 3
        is_py34 = sys.version_info[:2] == (3, 4)
        if self.compiler is None and is_windows and (is_py2 or is_py34):
            self.compiler = 'mingw32' 
Example #14
Source File: setup.py    From science_rcn with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #15
Source File: setup.py    From pyImSegm with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        # __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #16
Source File: setup.py    From aggregation with Apache License 2.0 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #17
Source File: setup.py    From Kaggler with MIT License 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)

        # prevent numpy from thinking it is still in its setup process:
        set_builtin('__NUMPY_SETUP__', False)
        import numpy as np
        self.include_dirs.append(np.get_include()) 
Example #18
Source File: setup.py    From occupancy_flow with MIT License 5 votes vote down vote up
def finalize_options(self):
        '''
        In order to avoid premature import of numpy before it gets installed as a dependency
        get numpy include directories during the extensions building process
        http://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py
        '''
        build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        set_builtin('__NUMPY_SETUP__', False)
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #19
Source File: setup.py    From pairtools with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Fix to work with bootstrapped numpy installation
        # http://stackoverflow.com/a/21621689/579416
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #20
Source File: setup.py    From reverse-geocoder with GNU Lesser General Public License v2.1 5 votes vote down vote up
def finalize_options(self):
      _build_ext.finalize_options(self)
      # Prevent numpy from thinking it is still in its setup process:
      __builtins__.__NUMPY_SETUP__ = False
      import numpy
      self.include_dirs.append(numpy.get_include()) 
Example #21
Source File: setup.py    From tskit with MIT License 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        import builtins

        # Prevent numpy from thinking it is still in its setup process:
        builtins.__NUMPY_SETUP__ = False
        import numpy

        self.include_dirs.append(numpy.get_include()) 
Example #22
Source File: setup.py    From fastdtw with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #23
Source File: setup.py    From cpnest with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include())


# check whether user has Cython 
Example #24
Source File: setup.py    From Python-Wrapper-for-World-Vocoder with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #25
Source File: setup.py    From sparse_dot_topn with Apache License 2.0 5 votes vote down vote up
def my_build_ext(pars):
    # import delayed:
    from setuptools.command.build_ext import build_ext as _build_ext
    class build_ext(_build_ext):
        def finalize_options(self):
            _build_ext.finalize_options(self)
            # Prevent numpy from thinking it is still in its setup process:
            __builtins__.__NUMPY_SETUP__ = False
            import numpy
            self.include_dirs.append(numpy.get_include())

    #object returned:
    return build_ext(pars) 
Example #26
Source File: setup.py    From osqp-python with Apache License 2.0 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #27
Source File: setup.py    From python-pesq with MIT License 5 votes vote down vote up
def finalize_options(self):
        _build_ext.finalize_options(self)
        __builtins__.__NUMPY_SETUP__ = False
        import numpy
        self.include_dirs.append(numpy.get_include()) 
Example #28
Source File: setup.py    From openfst-python with Apache License 2.0 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        self.set_undefined_options("build", ("download_dir", "download_dir")) 
Example #29
Source File: setup.py    From openfst-python with Apache License 2.0 5 votes vote down vote up
def finalize_options(self):
        build.finalize_options(self)
        # self.set_undefined_options("build_ext", ("download_dir", "download_dir"))
        if self.download_dir:
            openfst_tar_gz = os.path.join(self.download_dir, self.openfst_basename)
            assert os.path.isfile(openfst_tar_gz), (
                "File %s does not exist" % openfst_tar_gz
            )
        else:
            self.download_dir = self.build_temp 
Example #30
Source File: setup.py    From rankeval with Mozilla Public License 2.0 5 votes vote down vote up
def finalize_options(self):
        build_ext.finalize_options(self)
        # Prevent numpy from thinking it is still in its setup process:
        # https://docs.python.org/2/library/__builtin__.html#module-__builtin__
        if isinstance(__builtins__, dict):
            __builtins__["__NUMPY_SETUP__"] = False
        else:
            __builtins__.__NUMPY_SETUP__ = False

        import numpy as np
        self.include_dirs.append(np.get_include())