コード例 #1
0
def get_distribution(always=False):
    dist = distutils.core._setup_distribution
    # XXX Hack to get numpy installable with easy_install.
    # The problem is easy_install runs it's own setup(), which
    # sets up distutils.core._setup_distribution. However,
    # when our setup() runs, that gets overwritten and lost.
    # We can't use isinstance, as the DistributionWithoutHelpCommands
    # class is local to a function in setuptools.command.easy_install
    if dist is not None and "DistributionWithoutHelpCommands" in repr(dist):
        dist = None
    if always and dist is None:
        dist = NumpyDistribution()
    return dist
コード例 #2
0
ファイル: test_ccompiler.py プロジェクト: rushabh-v/numpy
def test_ccompiler():
    '''
    scikit-image/scikit-image issue 4369
    We unconditionally add ``-std-c99`` to the gcc compiler in order
    to support c99 with very old gcc compilers. However the same call
    is used to get the flags for the c++ compiler, just with a kwarg.
    Make sure in this case, where it would not be legal, the option is **not** added
    '''
    dist = NumpyDistribution()
    compiler = new_compiler()
    compiler.customize(dist)
    if hasattr(compiler, 'compiler') and 'gcc' in compiler.compiler[0]:
        assert 'c99' in ' '.join(compiler.compiler)

    compiler = new_compiler()
    compiler.customize(dist, need_cxx=True)
    if hasattr(compiler, 'compiler') and 'gcc' in compiler.compiler[0]:
        assert 'c99' not in ' '.join(compiler.compiler)
コード例 #3
0
ファイル: build_distutils.py プロジェクト: dagss/Bento
def build_extensions(pkg):
    if not pkg.extensions:
        return {}

    # XXX: import here because numpy import time slows down everything
    # otherwise. This is ugly, but using numpy.distutils is temporary
    # anyway
    try:
        import numpy
        use_numpy_distutils = True
    except ImportError:
        use_numpy_distutils = False

    # FIXME: import done here to avoid clashing with monkey-patch as done by
    # the convert subcommand.
    if use_numpy_distutils:
        from numpy.distutils.numpy_distribution \
            import \
                NumpyDistribution as Distribution
        from numpy.distutils.command.build_ext \
            import \
                build_ext
        from numpy.distutils.command.build_src \
            import \
                build_src
        from numpy.distutils.command.scons \
            import \
                scons
        from numpy.distutils import log
        import distutils.core
    else:
        from distutils.dist \
            import \
                Distribution
        from distutils.command.build_ext \
            import \
                build_ext
        from distutils import log
    import distutils.errors

    log.set_verbosity(1)

    dist = Distribution()
    if use_numpy_distutils:
        dist.cmdclass['build_src'] = build_src
        dist.cmdclass['scons'] = scons
        distutils.core._setup_distribution = dist

    dist.ext_modules = [toyext_to_distext(e) for e in
                        pkg.extensions.values()]

    try:
        bld_cmd = build_ext(dist)
        bld_cmd.initialize_options()
        bld_cmd.finalize_options()
        bld_cmd.run()

        ret = {}
        for ext in bld_cmd.extensions:
            # FIXME: do package -> location translation correctly
            pkg_dir = os.path.dirname(ext.name.replace('.', os.path.sep))
            target = os.path.join('$sitedir', pkg_dir)
            fullname = bld_cmd.get_ext_fullname(ext.name)
            ext_target = os.path.join(bld_cmd.build_lib,
                                     bld_cmd.get_ext_filename(fullname))
            srcdir = os.path.dirname(ext_target)
            section = InstalledSection("extensions", fullname, srcdir,
                                        target, [os.path.basename(ext_target)])
            ret[fullname] = section
        return ret
    except distutils.errors.DistutilsError, e:
        raise CommandExecutionFailure(str(e))
コード例 #4
0
ファイル: core.py プロジェクト: balarsen/pysysdevel
    def __init__(self, attrs=None):
        old_attrs = attrs
        ## setup the environment for custom commands
        self.environment = attrs.get('environment')
        if self.environment != None:
            del old_attrs['environment']
        else:
            self.environment = dict()
        ## PYJS web extensions
        self.web_ext_modules = attrs.get('web_ext_modules')
        if self.web_ext_modules != None:
            del old_attrs['web_ext_modules']
        ## Sphinx documentation
        self.doc_modules = attrs.get('doc_modules')
        if self.doc_modules != None:
            del old_attrs['doc_modules']
        ## Py++ extensions
        self.pypp_ext_modules = attrs.get('pypp_ext_modules')
        if self.pypp_ext_modules != None:
            del old_attrs['pypp_ext_modules']
        ## Shared libraries
        self.sh_libraries = attrs.get('sh_libraries')
        if self.sh_libraries != None:
            del old_attrs['sh_libraries']
        ## ANTLR parser/lexers
        self.antlr_modules = attrs.get('antlr_modules')
        if self.antlr_modules != None:
            del old_attrs['antlr_modules']
        ## Native executables
        self.native_executables = attrs.get('native_executables')
        if self.native_executables != None:
            del old_attrs['native_executables']
        ## Data to install to 'share'
        self.data_dirs = attrs.get('data_dirs')
        if self.data_dirs != None:
            del old_attrs['data_dirs']
        ## Non-stock libraries to install to 'lib' or 'lib64'
        self.extra_install_libraries = attrs.get('extra_install_libraries')
        if self.extra_install_libraries != None:
            del old_attrs['extra_install_libraries']
        ## Non-stock python packages to co-install
        self.extra_install_modules = attrs.get('extra_install_modules')
        if self.extra_install_modules != None:
            del old_attrs['extra_install_modules']
        ## Boilerplate scripts to create
        self.create_scripts = attrs.get('create_scripts')
        if self.create_scripts != None:
            del old_attrs['create_scripts']
        ## SysDevel support modules
        self.devel_support = attrs.get('devel_support')
        if self.devel_support != None:
            del old_attrs['devel_support']
        ## Files to delete upon 'clean'
        self.generated_files = attrs.get('generated_files')
        if self.generated_files != None:
            del old_attrs['generated_files']
        ## Separate packages with their own setup.py
        self.subpackages = attrs.get('subpackages')
        if self.subpackages != None:
            del old_attrs['subpackages']
        ## Whether to quit if a subpackage build fails
        self.quit_on_error = attrs.get('quit_on_error')
        if self.quit_on_error != None:
            del old_attrs['quit_on_error']
        else:
            self.quit_on_error = True
        ## Enable parallel building
        self.parallel_build = attrs.get('parallel_build')
        if self.parallel_build != None:
            del old_attrs['parallel_build']
        ## Unit testing
        self.tests = attrs.get('tests')
        if self.tests != None:
            del old_attrs['tests']


        ## py2exe options
        self.ctypes_com_server = attrs.pop("ctypes_com_server", [])
        self.com_server = attrs.pop("com_server", [])
        self.service = attrs.pop("service", [])
        self.windows = attrs.pop("windows", [])
        self.console = attrs.pop("console", [])
        self.isapi = attrs.pop("isapi", [])
        self.zipfile = attrs.pop("zipfile", util.default_py2exe_library)

        oldDistribution.__init__(self, old_attrs)
コード例 #5
0
ファイル: core.py プロジェクト: balarsen/pysysdevel
 def has_c_libraries(self):
     return oldDistribution.has_c_libraries(self) or self.has_shared_libs()
コード例 #6
0
ファイル: core.py プロジェクト: balarsen/pysysdevel
 def has_scripts(self):
     return oldDistribution.has_scripts(self) or \
         (self.create_scripts != None and len(self.create_scripts) > 0)
コード例 #7
0
ファイル: core.py プロジェクト: sean-m-brennan/pysysdevel
 def has_sources(self):
     return oldDistribution.has_ext_modules(self) or \
         (self.antlr_modules != None and len(self.antlr_modules) > 0) or \
         (self.sysdevel_server != None and len(self.sysdevel_server) > 0)