コード例 #1
0
ファイル: bdist_wininst.py プロジェクト: B-Rich/breve
    def get_exe_bytes(self):
        from distutils.msvccompiler import get_build_version

        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = "6"
                else:
                    bv = "7.1"
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?
        filename = os.path.join(directory, "wininst-%s.exe" % bv)
        return open(filename, "rb").read()
コード例 #2
0
    def get_exe_bytes(self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = 6.0
                else:
                    bv = 7.1
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?

        # if plat_name starts with "win" but is not "win32"
        # we want to strip "win" and leave the rest (e.g. -amd64)
        # for all other cases, we don't want any suffix
        if self.plat_name != 'win32' and self.plat_name[:3] == 'win':
            sfix = self.plat_name[3:]
        else:
            sfix = ''

        filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
        try:
            f = open(filename, "rb")
        except IOError as e:
            raise DistutilsFileError(str(e) + ', %s not included in the Debian packages.' % filename)
        try:
            return f.read()
        finally:
            f.close()
コード例 #3
0
ファイル: utils.py プロジェクト: EvanMcNabb/ITK
    def get_version():
        if "nt" != os.name:
            return None  # not implemented yet
        else:
            from distutils import msvccompiler

            return ("msvc", str(msvccompiler.get_build_version()))
コード例 #4
0
    def test_reg_class(self):
        if sys.platform != 'win32':
            # this test is only for win32
            return
        from distutils.msvccompiler import get_build_version
        if get_build_version() < 8.0:
            # this test is only for MSVC8.0 or above
            return

        from distutils.msvc9compiler import Reg
        self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')

        # looking for values that should exist on all
        # windows registeries versions.
        path = r'Software\Microsoft\Notepad'
        v = Reg.get_value(path, u"lfitalic")
        self.assertTrue(v in (0, 1))

        import _winreg
        HKCU = _winreg.HKEY_CURRENT_USER
        keys = Reg.read_keys(HKCU, 'xxxx')
        self.assertEquals(keys, None)

        keys = Reg.read_keys(HKCU, r'Software\Microsoft')
        self.assertTrue('Notepad' in keys)
コード例 #5
0
ファイル: wininst_utils.py プロジェクト: pberkes/Bento
def get_exe_bytes (target_version=None, plat_name=None):
    if target_version is None:
        target_version = ""
    if plat_name is None:
        plat_name = get_platform()
    from distutils.msvccompiler import get_build_version
    # If a target-version other than the current version has been
    # specified, then using the MSVC version from *this* build is no good.
    # Without actually finding and executing the target version and parsing
    # its sys.version, we just hard-code our knowledge of old versions.
    # NOTE: Possible alternative is to allow "--target-version" to
    # specify a Python executable rather than a simple version string.
    # We can then execute this program to obtain any info we need, such
    # as the real sys.version string for the build.
    cur_version = get_python_version()
    if target_version and target_version != cur_version:
        raise NotImplementedError("target_version handling not implemented yet.")
        # If the target version is *later* than us, then we assume they
        # use what we use
        # string compares seem wrong, but are what sysconfig.py itself uses
        if self.target_version > cur_version:
            bv = get_build_version()
        else:
            if self.target_version < "2.4":
                bv = 6.0
            else:
                bv = 7.1
    else:
        # for current version - use authoritative check.
        bv = get_build_version()

    # wininst-x.y.exe directory
    # XXX: put those somewhere else, and per-python version preferably
    directory = WININST_DIR
    # we must use a wininst-x.y.exe built with the same C compiler
    # used for python.  XXX What about mingw, borland, and so on?

    # if plat_name starts with "win" but is not "win32"
    # we want to strip "win" and leave the rest (e.g. -amd64)
    # for all other cases, we don't want any suffix
    if plat_name != 'win32' and plat_name[:3] == 'win':
        sfix = plat_name[3:]
    else:
        sfix = ''

    filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
    return open(filename, "rb").read()
コード例 #6
0
    def get_exe_bytes(self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = 6.0
                else:
                    bv = 7.1
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?

        # if plat_name starts with "win" but is not "win32"
        # we want to strip "win" and leave the rest (e.g. -amd64)
        # for all other cases, we don't want any suffix
        if self.plat_name != 'win32' and self.plat_name[:3] == 'win':
            sfix = self.plat_name[3:]
        else:
            sfix = ''

        filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
        f = open(filename, "rb")
        try:
            return f.read()
        finally:
            f.close()
コード例 #7
0
def get_config():
    from setup_common import get_metadata_and_options, create_release_file

    metadata, options = get_metadata_and_options()

    connector = options["connector"]

    extra_objects = []

    # client = "mysqlclient"
    client = "mariadbclient"

    vcversion = int(get_build_version())
    if client == "mariadbclient":
        library_dirs = [os.path.join(connector, "lib", "mariadb")]
        libraries = [
            "kernel32",
            "advapi32",
            "wsock32",
            "shlwapi",
            "Ws2_32",
            "crypt32",
            "secur32",
            "bcrypt",
            client,
        ]
        include_dirs = [os.path.join(connector, "include", "mariadb")]
    else:
        library_dirs = [
            os.path.join(connector, r"lib\vs%d" % vcversion),
            os.path.join(connector, "lib"),
        ]
        libraries = ["kernel32", "advapi32", "wsock32", client]
        include_dirs = [os.path.join(connector, r"include")]

    extra_compile_args = ["/Zl", "/D_CRT_SECURE_NO_WARNINGS"]
    extra_link_args = ["/MANIFEST"]

    name = "mysqlclient"
    metadata["name"] = name

    define_macros = [
        ("version_info", metadata["version_info"]),
        ("__version__", metadata["version"]),
    ]
    create_release_file(metadata)
    del metadata["version_info"]
    ext_options = dict(
        library_dirs=library_dirs,
        libraries=libraries,
        extra_compile_args=extra_compile_args,
        extra_link_args=extra_link_args,
        include_dirs=include_dirs,
        extra_objects=extra_objects,
        define_macros=define_macros,
    )
    return metadata, ext_options
コード例 #8
0
    def build_extension_cmake(self, ext):
        extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
        cfg = 'Debug' if self.debug else 'Release'

        PYTHON_VERSION = "{}.{}".format(sys.version_info.major, sys.version_info.minor)

        cmake_args = [
            '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + os.path.abspath(os.path.join(extdir, 'perspective', 'table')).replace('\\', '/'),
            '-DCMAKE_BUILD_TYPE=' + cfg,
            '-DPSP_CPP_BUILD=1',
            '-DPSP_WASM_BUILD=0',
            '-DPSP_PYTHON_BUILD=1',
            '-DPSP_PYTHON_VERSION={}'.format(PYTHON_VERSION),
            '-DPython_ADDITIONAL_VERSIONS={}'.format(PYTHON_VERSION),
            '-DPython_FIND_VERSION={}'.format(PYTHON_VERSION),
            '-DPSP_PYTHON_ARROWINSTALLDIR={}'.format(os.environ.get('PSP_PYTHON_ARROWINSTALLDIR', os.path.join(sysconfig.get_python_lib(), 'pyarrow').replace('\\', '/'))),
            '-DPython_EXECUTABLE={}'.format(sys.executable).replace('\\', '/'),
            '-DPython_ROOT_DIR={}'.format(sys.prefix).replace('\\', '/'),
            '-DPython_ROOT={}'.format(sys.prefix).replace('\\', '/'),
            '-DPSP_CMAKE_MODULE_PATH={folder}'.format(folder=os.path.join(ext.sourcedir, 'cmake')).replace('\\', '/'),
            '-DPSP_CPP_SRC={folder}'.format(folder=ext.sourcedir).replace('\\', '/'),
            '-DPSP_PYTHON_SRC={folder}'.format(folder=os.path.join(ext.sourcedir, "..", 'perspective').replace('\\', '/'))
        ]

        build_args = ['--config', cfg]

        if platform.system() == "Windows":
            import distutils.msvccompiler as dm
            msvc = {'12': 'Visual Studio 12 2013',
                    '14': 'Visual Studio 14 2015',
                    '14.1': 'Visual Studio 15 2017'}.get(dm.get_build_version(), 'Visual Studio 15 2017')

            cmake_args.extend([
                '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(
                    cfg.upper(),
                    extdir).replace('\\', '/'),
                '-G', os.environ.get('PSP_GENERATOR', msvc)])

            if sys.maxsize > 2**32:
                # build 64 bit to match python
                cmake_args += ['-A', 'x64']

            build_args += ['--', '/m:{}'.format(CPU_COUNT), '/p:Configuration={}'.format(cfg)]
        else:
            cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
            build_args += ['--', '-j2' if os.environ.get('DOCKER', '') else '-j{}'.format(CPU_COUNT)]

        env = os.environ.copy()
        env['PSP_ENABLE_PYTHON'] = '1'
        env['OSX_DEPLOYMENT_TARGET'] = '10.9'

        if not os.path.exists(self.build_temp):
            os.makedirs(self.build_temp)

        subprocess.check_call([self.cmake_cmd, os.path.abspath(ext.sourcedir)] + cmake_args, cwd=self.build_temp, env=env, stderr=subprocess.STDOUT)
        subprocess.check_call([self.cmake_cmd, '--build', '.'] + build_args, cwd=self.build_temp, env=env, stderr=subprocess.STDOUT)
        print()  # Add an empty line for cleaner output
コード例 #9
0
    def get_exe_bytes(self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = "6"
                else:
                    bv = "7.1"
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?

        # The uninstallers need to be available in $PYEXT_CROSS/uninst/*.exe
        # Use http://oss.itsystementwicklung.de/hg/pyext_cross_linux_to_win32/
        # and copy it alongside your pysqlite checkout.
        if self.target_version in ("2.3", "2.4"):
            uninst_ver = "6"
        else:
            uninst_ver = "7.1"

        filename = os.path.join(
            directory,
            os.path.join(os.environ["PYEXT_CROSS"], "uninst",
                         "wininst-%s.exe" % uninst_ver))
        return open(filename, "rb").read()
コード例 #10
0
ファイル: setup.py プロジェクト: kosniaz/athena-spaCy
def setup_package():
    write_git_info_py()

    root = os.path.abspath(os.path.dirname(__file__))

    if hasattr(sys, "argv") and len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with io.open(os.path.join(root, "spacy", "about.py"), encoding="utf8") as f:
            about = {}
            exec(f.read(), about)

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "include"),
        ]

        if (
            ccompiler.new_compiler().compiler_type == "msvc"
            and msvccompiler.get_build_version() == 9
        ):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            extra_link_args = []
            # ???
            # Imported from patch from @mikepb
            # See Issue #267. Running blind here...
            if sys.platform == "darwin":
                dylib_path = [".." for _ in range(mod_name.count("."))]
                dylib_path = "/".join(dylib_path)
                dylib_path = "@loader_path/%s/spacy/platform/darwin/lib" % dylib_path
                extra_link_args.append("-Wl,-rpath,%s" % dylib_path)
            ext_modules.append(
                Extension(
                    mod_name,
                    [mod_path],
                    language="c++",
                    include_dirs=include_dirs,
                    extra_link_args=extra_link_args,
                )
            )

        if not is_source_release(root):
            generate_cython(root, "spacy")

        setup(
            name="spacy",
            packages=PACKAGES,
            version=about["__version__"],
            ext_modules=ext_modules,
            cmdclass={"build_ext": build_ext_subclass},
        )
コード例 #11
0
def get_config():
    from setup_common import get_metadata_and_options, enabled, create_release_file

    interpreter_arch = get_build_architecture()
    machine_arch = platform.machine()
    metadata, options = get_metadata_and_options()

    connector = options.get('connector')
    if not connector and machine_arch == 'AMD64' and interpreter_arch == 'Intel':
        connector = 'C:\Program Files (x86)\MySQL\MySQL Connector C 6.1'
    elif not connector:
        connector = 'C:\Program Files\MySQL\MySQL Connector C 6.1'

    extra_objects = []

    client = "mysqlclient"
    # client = "mariadbclient"

    vcversion = int(get_build_version())
    if client == "mariadbclient":
        library_dirs = [os.path.join(connector, 'lib', 'mariadb')]
        libraries = [
            'kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', client
        ]
        include_dirs = [os.path.join(connector, 'include', 'mariadb')]
    else:
        library_dirs = [
            os.path.join(connector, r'lib\vs%d' % vcversion),
            os.path.join(connector, "lib")
        ]
        libraries = ['kernel32', 'advapi32', 'wsock32', client]
        include_dirs = [os.path.join(connector, r'include')]

    extra_compile_args = ['/Zl', '/D_CRT_SECURE_NO_WARNINGS']
    extra_link_args = ['/MANIFEST']

    name = "mysqlclient"
    metadata['name'] = name

    define_macros = [
        ('version_info', metadata['version_info']),
        ('__version__', metadata['version']),
    ]
    create_release_file(metadata)
    del metadata['version_info']
    ext_options = dict(
        library_dirs=library_dirs,
        libraries=libraries,
        extra_compile_args=extra_compile_args,
        extra_link_args=extra_link_args,
        include_dirs=include_dirs,
        extra_objects=extra_objects,
        define_macros=define_macros,
    )
    return metadata, ext_options
コード例 #12
0
def find_vcvarsall2():

    PLAT_TO_VCVARS = {
        'win32': 'x86',
        'win-amd64': 'amd64',
    }
    build_version = get_build_version()
    plat_name = get_platform()
    plat_spec = PLAT_TO_VCVARS[plat_name]
    vcvarsall = msvc.msvc9_find_vcvarsall(build_version)
    return vcvarsall, plat_spec
コード例 #13
0
    def get_exe_bytes (self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = "6"
                else:
                    bv = "7.1"
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?

        # The uninstallers need to be available in $PYEXT_CROSS/uninst/*.exe
        # Use http://oss.itsystementwicklung.de/hg/pyext_cross_linux_to_win32/
        # and copy it alongside your pysqlite checkout.
        if self.target_version in ("2.3", "2.4"):
            uninst_ver = "6"
        else:
            uninst_ver = "7.1"

        filename = os.path.join(directory, os.path.join(os.environ["PYEXT_CROSS"], "uninst", "wininst-%s.exe" % uninst_ver))
        return open(filename, "rb").read()
コード例 #14
0
 def get_exe_bytes(self):
     from distutils.msvccompiler import get_build_version
     cur_version = get_python_version()
     if self.target_version and self.target_version != cur_version:
         if self.target_version > cur_version:
             bv = get_build_version()
         elif self.target_version < '2.4':
             bv = 6.0
         else:
             bv = 7.1
     else:
         bv = get_build_version()
     directory = os.path.dirname(__file__)
     if self.plat_name != 'win32' and self.plat_name[:3] == 'win':
         sfix = self.plat_name[3:]
     else:
         sfix = ''
     filename = os.path.join(directory, 'wininst-%.1f%s.exe' % (bv, sfix))
     f = open(filename, 'rb')
     try:
         return f.read()
     finally:
         f.close()
コード例 #15
0
 def get_exe_bytes(self):
     from distutils.msvccompiler import get_build_version
     cur_version = get_python_version()
     if self.target_version and self.target_version != cur_version:
         if self.target_version > cur_version:
             bv = get_build_version()
         elif self.target_version < '2.4':
             bv = 6.0
         else:
             bv = 7.1
     else:
         bv = get_build_version()
     directory = os.path.dirname(__file__)
     if self.plat_name != 'win32' and self.plat_name[:3] == 'win':
         sfix = self.plat_name[3:]
     else:
         sfix = ''
     filename = os.path.join(directory, 'wininst-%.1f%s.exe' % (bv, sfix))
     f = open(filename, 'rb')
     try:
         return f.read()
     finally:
         f.close()
コード例 #16
0
def get_config():
    from setup_common import get_metadata_and_options, enabled, create_release_file

    metadata, options = get_metadata_and_options()

    connector = options["connector"]

    extra_objects = []

    # client = "mysqlclient"
    client = "mariadbclient"

    vcversion = int(get_build_version())
    if client == "mariadbclient":
        library_dirs = [os.path.join(connector, 'lib', 'mariadb')]
        libraries = [
            'kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', client
        ]
        include_dirs = [os.path.join(connector, 'include', 'mariadb')]
    else:
        library_dirs = [
            os.path.join(connector, r'lib\vs%d' % vcversion),
            os.path.join(connector, "lib")
        ]
        libraries = ['kernel32', 'advapi32', 'wsock32', client]
        include_dirs = [os.path.join(connector, r'include')]

    extra_compile_args = ['/Zl', '/D_CRT_SECURE_NO_WARNINGS']
    extra_link_args = ['/MANIFEST']

    name = "mysqlclient"
    metadata['name'] = name

    define_macros = [
        ('version_info', metadata['version_info']),
        ('__version__', metadata['version']),
    ]
    create_release_file(metadata)
    del metadata['version_info']
    ext_options = dict(
        library_dirs=library_dirs,
        libraries=libraries,
        extra_compile_args=extra_compile_args,
        extra_link_args=extra_link_args,
        include_dirs=include_dirs,
        extra_objects=extra_objects,
        define_macros=define_macros,
    )
    return metadata, ext_options
コード例 #17
0
ファイル: util.py プロジェクト: abostroem/astropy
            def find_msvcrt():
                version = get_build_version()
                if version is None:
                    # better be safe than sorry
                    return None
                if version <= 6:
                    clibname = 'msvcrt'
                else:
                    clibname = 'msvcr%d' % (version * 10)

                # If python was built with in debug mode
                import imp
                if imp.get_suffixes()[0][0] == '_d.pyd':
                    clibname += 'd'
                return clibname+'.dll'
コード例 #18
0
            def find_msvcrt():
                version = get_build_version()
                if version is None:
                    # better be safe than sorry
                    return None
                if version <= 6:
                    clibname = 'msvcrt'
                else:
                    clibname = 'msvcr%d' % (version * 10)

                # If python was built with in debug mode
                import imp
                if imp.get_suffixes()[0][0] == '_d.pyd':
                    clibname += 'd'
                return clibname + '.dll'
コード例 #19
0
ファイル: vim.py プロジェクト: pfmoore/builder-vim
def get_vsvars(python):
    sdk_dir = None
    if python:
        from distutils.msvccompiler import get_build_version
        vc = int(get_build_version()) * 10
        vclist = (vc,)
    else:
        vclist = (140, 100, 90)
    for vc in vclist:
        env = 'VS{}COMNTOOLS'.format(vc)
        if env in os.environ:
            bat = os.path.join(os.environ[env], '..', '..', 'VC', 'vcvarsall.bat')
            if os.path.exists(bat):
                return bat, vc
    raise RuntimeError("Cannot find a suitable version of Visual Studio")
コード例 #20
0
def get_config():
    from setup_common import get_metadata_and_options, enabled, create_release_file

    metadata, options = get_metadata_and_options()

    connector = options["connector"]

    extra_objects = []

    # client = "mysqlclient"
    client = "mariadbclient"

    vcversion = int(get_build_version())
    if client == "mariadbclient":
        library_dirs = [os.path.join(connector, 'lib', 'mariadb')]
        libraries = ['kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', client ]
        include_dirs = [os.path.join(connector, 'include', 'mariadb')]
    else:
        library_dirs = [os.path.join(connector, r'lib\vs%d' % vcversion),
                        os.path.join(connector, "lib")]
        libraries = ['kernel32', 'advapi32', 'wsock32', client ]
        include_dirs = [os.path.join(connector, r'include')]

    extra_compile_args = ['/Zl', '/D_CRT_SECURE_NO_WARNINGS' ]
    extra_link_args = ['/MANIFEST']

    name = "mysqlclient"
    metadata['name'] = name

    define_macros = [
        ('version_info', metadata['version_info']),
        ('__version__', metadata['version']),
        ]
    create_release_file(metadata)
    del metadata['version_info']
    ext_options = dict(
        library_dirs = library_dirs,
        libraries = libraries,
        extra_compile_args = extra_compile_args,
        extra_link_args = extra_link_args,
        include_dirs = include_dirs,
        extra_objects = extra_objects,
        define_macros = define_macros,
    )
    return metadata, ext_options
コード例 #21
0
ファイル: utils.py プロジェクト: nalinimsingh/ITK_4D
    def get_version():
        """
        Get the version of the compiler used to build the Python executable.

        Deprecated since 1.8.0. Will be removed in 1.9.0.

        Returns:
            tuple:
             * name of compiler (str): mscv
             * compiler version (str): msvccompiler.get_build_version()
        """
        warnings.warn("native_compiler.get_version is deprecated.\n",
                      DeprecationWarning)
        if 'nt' != os.name:
            return None  # not implemented yet
        else:
            from distutils import msvccompiler
            return 'msvc', str(msvccompiler.get_build_version())
コード例 #22
0
ファイル: utils.py プロジェクト: PlutoniumHeart/ITK
    def get_version():
        """
        Get the version of the compiler used to build the Python executable.

        Deprecated since 1.8.0. Will be removed in 1.9.0.

        Returns:
            tuple:
             * name of compiler (str): mscv
             * compiler version (str): msvccompiler.get_build_version()
        """
        warnings.warn(
            "native_compiler.get_version is deprecated.\n",
            DeprecationWarning)
        if 'nt' != os.name:
            return None  # not implemented yet
        else:
            from distutils import msvccompiler
            return 'msvc', str(msvccompiler.get_build_version())
コード例 #23
0
def get_config():
    from setup_common import get_metadata_and_options, enabled, create_release_file

    metadata, options = get_metadata_and_options()

    connector = options["connector"]

    extra_objects = []

    if enabled(options, 'embedded'):
        client = "mysqld"
    else:
        client = "mysqlclient"

    vcversion = int(get_build_version())
    library_dirs = [ os.path.join(connector, r'lib\vs%d' % vcversion) ]
    libraries = [ 'kernel32', 'advapi32', 'wsock32', client ]
    include_dirs = [ os.path.join(connector, r'include') ]
    extra_compile_args = [ '/Zl' ]
    extra_link_args = ['/MANIFEST']

    name = "mysqlclient"
    if enabled(options, 'embedded'):
        name = name + "-embedded"
    metadata['name'] = name

    define_macros = [
        ('version_info', metadata['version_info']),
        ('__version__', metadata['version']),
        ]
    create_release_file(metadata)
    del metadata['version_info']
    ext_options = dict(
        name = "_mysql",
        library_dirs = library_dirs,
        libraries = libraries,
        extra_compile_args = extra_compile_args,
        extra_link_args = extra_link_args,
        include_dirs = include_dirs,
        extra_objects = extra_objects,
        define_macros = define_macros,
        )
    return metadata, ext_options
コード例 #24
0
    def test_no_compiler(self):
        # makes sure query_vcvarsall throws
        # a DistutilsPlatformError if the compiler
        # is not found
        from distutils.msvccompiler import get_build_version
        if get_build_version() < 8.0:
            # this test is only for MSVC8.0 or above
            return
        from distutils.msvc9compiler import query_vcvarsall
        def _find_vcvarsall(version):
            return None

        from distutils import msvc9compiler
        old_find_vcvarsall = msvc9compiler.find_vcvarsall
        msvc9compiler.find_vcvarsall = _find_vcvarsall
        try:
            self.assertRaises(DistutilsPlatformError, query_vcvarsall,
                             'wont find this version')
        finally:
            msvc9compiler.find_vcvarsall = old_find_vcvarsall
コード例 #25
0
    def test_no_compiler(self):
        # makes sure query_vcvarsall throws
        # a DistutilsPlatformError if the compiler
        # is not found
        from distutils.msvccompiler import get_build_version
        if get_build_version() < 8.0:
            # this test is only for MSVC8.0 or above
            return
        from distutils.msvc9compiler import query_vcvarsall

        def _find_vcvarsall(version):
            return None

        from distutils import msvc9compiler
        old_find_vcvarsall = msvc9compiler.find_vcvarsall
        msvc9compiler.find_vcvarsall = _find_vcvarsall
        try:
            self.assertRaises(DistutilsPlatformError, query_vcvarsall,
                              'wont find this version')
        finally:
            msvc9compiler.find_vcvarsall = old_find_vcvarsall
コード例 #26
0
def get_config():
    from setup_common import get_metadata_and_options, enabled

    metadata, options = get_metadata_and_options()

    connector = options["connector"]

    extra_objects = []

    if enabled(options, 'embedded'):
        client = "mariadbd"
    else:
        client = "mariadbclient"

    vcversion = int(get_build_version())
    if client == "mariadbclient":
        library_dirs = [os.path.join(connector, 'lib', 'mariadb')]
        libraries = ['kernel32', 'advapi32', 'wsock32', 'shlwapi', 'Ws2_32', client ]
        include_dirs = [os.path.join(connector, 'include', 'mariadb')]
    else:
        library_dirs = [os.path.join(connector, r'lib\vs%d' % vcversion),
                        os.path.join(connector, "lib")]
        libraries = ['kernel32', 'advapi32', 'wsock32', client ]
        include_dirs = [os.path.join(connector, r'include')]

    extra_compile_args = ['/Zl', '/D_CRT_SECURE_NO_WARNINGS' ]
    extra_link_args = ['/MANIFEST']

    name = "tiledb-sql"
    metadata['name'] = name

    ext_options = dict(
        library_dirs = library_dirs,
        libraries = libraries,
        extra_compile_args = extra_compile_args,
        extra_link_args = extra_link_args,
        include_dirs = include_dirs,
        extra_objects = extra_objects,
    )
    return metadata, ext_options
コード例 #27
0
    def test_reg_class(self):
        from distutils.msvccompiler import get_build_version
        if get_build_version() < 8.0:
            # this test is only for MSVC8.0 or above
            return

        from distutils.msvc9compiler import Reg
        self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')

        # looking for values that should exist on all
        # windows registeries versions.
        path = r'Control Panel\Desktop'
        v = Reg.get_value(path, 'dragfullwindows')
        self.assertTrue(v in ('0', '1', '2'))

        import winreg
        HKCU = winreg.HKEY_CURRENT_USER
        keys = Reg.read_keys(HKCU, 'xxxx')
        self.assertEquals(keys, None)

        keys = Reg.read_keys(HKCU, r'Control Panel')
        self.assertTrue('Desktop' in keys)
コード例 #28
0
    def test_reg_class(self):
        from distutils.msvccompiler import get_build_version
        if get_build_version() < 8.0:
            # this test is only for MSVC8.0 or above
            return

        from distutils.msvc9compiler import Reg
        self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')

        # looking for values that should exist on all
        # windows registeries versions.
        path = r'Control Panel\Desktop'
        v = Reg.get_value(path, u'dragfullwindows')
        self.assertTrue(v in (u'0', u'1', u'2'))

        import _winreg
        HKCU = _winreg.HKEY_CURRENT_USER
        keys = Reg.read_keys(HKCU, 'xxxx')
        self.assertEquals(keys, None)

        keys = Reg.read_keys(HKCU, r'Control Panel')
        self.assertTrue('Desktop' in keys)
コード例 #29
0
                    headers.append(filename)

    if sys.platform == 'win32':
        from distutils.msvc9compiler import get_build_version
        vscomntools_env = 'VS{}{}COMNTOOLS'.format(
            int(get_build_version()),
            int(get_build_version() * 10) % 10,
        )
        try:
            os.environ[vscomntools_env] = os.environ['VS140COMNTOOLS']
        except KeyError:
            distutils.log.warn(
                'You probably need Visual Studio 2015 (14.0) '
                'or higher', )
        from distutils import msvccompiler, msvc9compiler
        if msvccompiler.get_build_version() < 14.0:
            msvccompiler.get_build_version = lambda: 14.0
        if get_build_version() < 14.0:
            msvc9compiler.get_build_version = lambda: 14.0
            msvc9compiler.VERSION = 14.0
    elif platform.system() in ('Darwin', 'FreeBSD'):
        # Dirty workaround to avoid link error...
        # Python distutils doesn't provide any way
        # to configure different flags for each cc and c++.
        cencode_path = os.path.join(LIBSASS_SOURCE_DIR, 'cencode.c')
        cencode_body = ''
        with open(cencode_path) as f:
            cencode_body = f.read()
        with open(cencode_path, 'w') as f:
            f.write('#ifdef __cplusplus\n' 'extern "C" {\n' '#endif\n', )
            f.write(cencode_body)
コード例 #30
0
ファイル: setup.py プロジェクト: xu-neva/spaCy
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == 'clean':
        return clean(root)

    with chdir(root):
        with io.open(os.path.join(root, 'spacy', 'about.py'), encoding='utf8') as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, 'README.rst'), encoding='utf8') as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'include')]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
        and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace('.', '/') + '.cpp'
            extra_link_args = []
            # ???
            # Imported from patch from @mikepb
            # See Issue #267. Running blind here...
            if sys.platform == 'darwin':
                dylib_path = ['..' for _ in range(mod_name.count('.'))]
                dylib_path = '/'.join(dylib_path)
                dylib_path = '@loader_path/%s/spacy/platform/darwin/lib' % dylib_path
                extra_link_args.append('-Wl,-rpath,%s' % dylib_path)
            ext_modules.append(
                Extension(mod_name, [mod_path],
                    language='c++', include_dirs=include_dirs,
                    extra_link_args=extra_link_args))

        if not is_source_release(root):
            generate_cython(root, 'spacy')

        setup(
            name=about['__title__'],
            zip_safe=False,
            packages=PACKAGES,
            package_data=PACKAGE_DATA,
            description=about['__summary__'],
            long_description=readme,
            author=about['__author__'],
            author_email=about['__email__'],
            version=about['__version__'],
            url=about['__uri__'],
            license=about['__license__'],
            ext_modules=ext_modules,
            install_requires=[
                'numpy>=1.7',
                'murmurhash>=0.26,<0.27',
                'cymem>=1.30,<1.32',
                'preshed>=1.0.0,<2.0.0',
                'thinc>=6.5.0,<6.6.0',
                'plac<1.0.0,>=0.9.6',
                'six',
                'pathlib',
                'ujson>=1.35',
                'dill>=0.2,<0.3',
                'requests>=2.13.0,<3.0.0'],
            classifiers=[
                'Development Status :: 5 - Production/Stable',
                'Environment :: Console',
                'Intended Audience :: Developers',
                'Intended Audience :: Science/Research',
                'License :: OSI Approved :: MIT License',
                'Operating System :: POSIX :: Linux',
                'Operating System :: MacOS :: MacOS X',
                'Operating System :: Microsoft :: Windows',
                'Programming Language :: Cython',
                'Programming Language :: Python :: 2.6',
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.3',
                'Programming Language :: Python :: 3.4',
                'Programming Language :: Python :: 3.5',
                'Programming Language :: Python :: 3.6',
                'Topic :: Scientific/Engineering'],
            cmdclass = {
                'build_ext': build_ext_subclass},
        )
コード例 #31
0
ファイル: setup.py プロジェクト: roger-mahler/spaCy
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == 'clean':
        return clean(root)

    with chdir(root):
        with io.open(os.path.join(root, 'spacy', 'about.py'), encoding='utf8') as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, 'README.rst'), encoding='utf8') as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'include')]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
        and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace('.', '/') + '.cpp'
            extra_link_args = []
            # ???
            # Imported from patch from @mikepb
            # See Issue #267. Running blind here...
            if sys.platform == 'darwin':
                dylib_path = ['..' for _ in range(mod_name.count('.'))]
                dylib_path = '/'.join(dylib_path)
                dylib_path = '@loader_path/%s/spacy/platform/darwin/lib' % dylib_path
                extra_link_args.append('-Wl,-rpath,%s' % dylib_path)
            ext_modules.append(
                Extension(mod_name, [mod_path],
                    language='c++', include_dirs=include_dirs,
                    extra_link_args=extra_link_args))

        if not is_source_release(root):
            generate_cython(root, 'spacy')

        setup(
            name=about['__title__'],
            zip_safe=False,
            packages=PACKAGES,
            package_data=PACKAGE_DATA,
            description=about['__summary__'],
            long_description=readme,
            author=about['__author__'],
            author_email=about['__email__'],
            version=about['__version__'],
            url=about['__uri__'],
            license=about['__license__'],
            ext_modules=ext_modules,
            scripts=['bin/spacy'],
            install_requires=[
                'numpy>=1.7',
                'murmurhash>=0.28,<0.29',
                'cymem>=1.30,<1.32',
                'preshed>=1.0.0,<2.0.0',
                'thinc>=6.10.1,<6.11.0',
                'plac<1.0.0,>=0.9.6',
                'six',
                'html5lib==1.0b8',
                'pathlib',
                'ujson>=1.35',
                'dill>=0.2,<0.3',
                'requests>=2.13.0,<3.0.0',
                'regex==2017.4.5',
                'ftfy>=4.4.2,<5.0.0',
                'msgpack-python',
                'msgpack-numpy==0.4.1'],
            classifiers=[
                'Development Status :: 5 - Production/Stable',
                'Environment :: Console',
                'Intended Audience :: Developers',
                'Intended Audience :: Science/Research',
                'License :: OSI Approved :: MIT License',
                'Operating System :: POSIX :: Linux',
                'Operating System :: MacOS :: MacOS X',
                'Operating System :: Microsoft :: Windows',
                'Programming Language :: Cython',
                'Programming Language :: Python :: 2',
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3',
                'Programming Language :: Python :: 3.4',
                'Programming Language :: Python :: 3.5',
                'Programming Language :: Python :: 3.6',
                'Topic :: Scientific/Engineering'],
            cmdclass = {
                'build_ext': build_ext_subclass},
        )
コード例 #32
0
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == 'clean':
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, 'murmurhash', 'about.py')) as f:
            about = {}
            exec(f.read(), about)

        with open(os.path.join(root, 'README.rst')) as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'murmurhash', 'include')]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
            and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace('.', '/') + '.cpp'
            ext_modules.append(
                Extension(mod_name, [mod_path,
                                     'murmurhash/MurmurHash2.cpp',
                                     'murmurhash/MurmurHash3.cpp'],
                    language='c++', include_dirs=include_dirs))

        if not is_source_release(root):
            generate_cython(root, 'murmurhash')

        setup(
            name=about['__title__'],
            zip_safe=False,
            packages=PACKAGES,
            package_data={'': ['*.pyx', '*.pxd', 'include/murmurhash/*.h']},
            description=about['__summary__'],
            long_description=readme,
            author=about['__author__'],
            author_email=about['__email__'],
            version=about['__version__'],
            url=about['__uri__'],
            license=about['__license__'],
            ext_modules=ext_modules,
            classifiers=[
                'Development Status :: 4 - Beta',
                'Environment :: Console',
                'Intended Audience :: Developers',
                'Intended Audience :: Science/Research',
                'License :: OSI Approved :: MIT License',
                'Operating System :: POSIX :: Linux',
                'Operating System :: MacOS :: MacOS X',
                'Operating System :: Microsoft :: Windows',
                'Programming Language :: Cython',
                'Programming Language :: Python :: 2.6',
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.3',
                'Programming Language :: Python :: 3.4',
                'Programming Language :: Python :: 3.5',
                'Topic :: Scientific/Engineering'],
            cmdclass = {
                'build_ext': build_ext_subclass},
        )
コード例 #33
0
ファイル: setup.py プロジェクト: xcbat/spaCy
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == 'clean':
        return clean(root)

    with chdir(root):
        with io.open(os.path.join(root, 'spacy', 'about.py'), encoding='utf8') as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, 'README.rst'), encoding='utf8') as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'include')]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
            and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace('.', '/') + '.cpp'
            ext_modules.append(
                Extension(mod_name, [mod_path],
                    language='c++', include_dirs=include_dirs))

        if not is_source_release(root):
            generate_cython(root, 'spacy')

        setup(
            name=about['__title__'],
            zip_safe=False,
            packages=PACKAGES,
            package_data={'': ['*.pyx', '*.pxd', '*.txt', '*.tokens', 'data']},
            description=about['__summary__'],
            long_description=readme,
            author=about['__author__'],
            author_email=about['__email__'],
            version=about['__version__'],
            url=about['__uri__'],
            license=about['__license__'],
            ext_modules=ext_modules,
            install_requires=[
                'numpy>=1.7',
                'murmurhash>=0.26,<0.27',
                'cymem>=1.30,<1.32',
                'preshed>=0.46.0,<0.47.0',
                'thinc>=5.0.0,<5.1.0',
                'plac',
                'six',
                'cloudpickle',
                'pathlib',
                'sputnik>=0.9.2,<0.10.0'],
            classifiers=[
                'Development Status :: 5 - Production/Stable',
                'Environment :: Console',
                'Intended Audience :: Developers',
                'Intended Audience :: Science/Research',
                'License :: OSI Approved :: MIT License',
                'Operating System :: POSIX :: Linux',
                'Operating System :: MacOS :: MacOS X',
                'Operating System :: Microsoft :: Windows',
                'Programming Language :: Cython',
                'Programming Language :: Python :: 2.6',
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.3',
                'Programming Language :: Python :: 3.4',
                'Programming Language :: Python :: 3.5',
                'Topic :: Scientific/Engineering'],
            cmdclass = {
                'build_ext': build_ext_subclass},
        )
コード例 #34
0
ファイル: setup.py プロジェクト: thrasibule/pyql
from distutils import log
from distutils.sysconfig import customize_compiler

import glob
import os
import platform
import sys

from Cython.Distutils import build_ext
from Cython.Build import cythonize

if sys.platform == 'win32':
    VC_INCLUDE_REDIST = False  # Set to True to include C runtime dlls in distribution.
    from distutils import msvccompiler
    from platform import architecture
    VC_VERSION = msvccompiler.get_build_version()
    ARCH = "x64" if architecture()[0] == "64bit" else "x86"

try:
    import numpy
    HAS_NUMPY = True
except ImportError:
    HAS_NUMPY = False

DEBUG = False

SUPPORT_CODE_INCLUDE = './cpp_layer'

QL_LIBRARY = 'QuantLib'

# FIXME: would be good to be able to customize the path with environment
コード例 #35
0
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == 'clean':
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, 'thinc', 'about.py')) as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, 'README.rst'), encoding='utf8') as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'include')
        ]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
                and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            if mod_name.endswith('gpu_ops'):
                continue
            mod_path = mod_name.replace('.', '/') + '.cpp'
            ext_modules.append(
                Extension(mod_name, [mod_path],
                          language='c++',
                          include_dirs=include_dirs))
        if CUDA is None:
            pass
            #ext_modules.append(
            #    Extension("thinc.neural.gpu_ops",
            #        sources=["thinc/neural/gpu_ops.cpp"],
            #        language='c++',
            #        include_dirs=include_dirs))
        else:
            with chdir(root):
                ext_modules.append(
                    Extension(
                        "thinc.neural.gpu_ops",
                        sources=[
                            "thinc/neural/gpu_ops.cpp", "include/_cuda_shim.cu"
                        ],
                        library_dirs=[CUDA['lib64']],
                        libraries=['cudart'],
                        language='c++',
                        runtime_library_dirs=[CUDA['lib64']],
                        # this syntax is specific to this build system
                        # we're only going to use certain compiler args with nvcc and not with gcc
                        # the implementation of this trick is in customize_compiler() below
                        extra_compile_args=[
                            '-arch=sm_20', '--ptxas-options=-v', '-c',
                            '--compiler-options', "'-fPIC'"
                        ],
                        include_dirs=include_dirs + [CUDA['include']]))

        if not is_source_release(root):
            generate_cython(root, 'thinc')

        setup(
            name=about['__title__'],
            zip_safe=False,
            packages=PACKAGES,
            package_data={'': ['*.pyx', '*.pxd', '*.pxi', '*.cpp']},
            description=about['__summary__'],
            long_description=readme,
            author=about['__author__'],
            author_email=about['__email__'],
            version=about['__version__'],
            url=about['__uri__'],
            license=about['__license__'],
            ext_modules=ext_modules,
            install_requires=[
                'wrapt', 'numpy>=1.7', 'murmurhash>=0.28,<0.29',
                'cymem>=1.30,<1.32', 'preshed>=1.0.0,<2.0.0',
                'tqdm>=4.10.0,<5.0.0', 'cytoolz>=0.8,<0.9',
                'plac>=0.9.6,<1.0.0', 'six>=1.10.0,<2.0.0', 'dill',
                'termcolor', 'pathlib>=1.0.0,<2.0.0', 'msgpack-python',
                'msgpack-numpy'
            ],
            classifiers=[
                'Development Status :: 5 - Production/Stable',
                'Environment :: Console', 'Intended Audience :: Developers',
                'Intended Audience :: Science/Research',
                'License :: OSI Approved :: MIT License',
                'Operating System :: POSIX :: Linux',
                'Operating System :: MacOS :: MacOS X',
                'Operating System :: Microsoft :: Windows',
                'Programming Language :: Cython',
                'Programming Language :: Python :: 2.6',
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.3',
                'Programming Language :: Python :: 3.4',
                'Programming Language :: Python :: 3.5',
                'Programming Language :: Python :: 3.6',
                'Topic :: Scientific/Engineering'
            ],
            cmdclass={'build_ext': build_ext_subclass},
        )
コード例 #36
0
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))
    with chdir(root):
        if not is_source_release(root):
            generate_cython(root, 'neuralcoref')

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'include')
        ]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
                and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace('.', '/') + '.cpp'
            extra_link_args = []
            # ???
            # Imported from patch from @mikepb
            # See Issue #267. Running blind here...
            if sys.platform == 'darwin':
                dylib_path = ['..' for _ in range(mod_name.count('.'))]
                dylib_path = '/'.join(dylib_path)
                dylib_path = '@loader_path/%s/neuralcoref/platform/darwin/lib' % dylib_path
                extra_link_args.append('-Wl,-rpath,%s' % dylib_path)
            ext_modules.append(
                Extension(mod_name, [mod_path],
                          language='c++',
                          include_dirs=include_dirs,
                          extra_link_args=extra_link_args))

        setup(
            name='neuralcoref',
            version='4.0',
            description="Coreference Resolution in spaCy with Neural Networks",
            url='https://github.com/huggingface/neuralcoref',
            author='Thomas Wolf',
            author_email='*****@*****.**',
            ext_modules=ext_modules,
            classifiers=[
                'Development Status :: 3 - Alpha',
                'Environment :: Console',
                'Intended Audience :: Developers',
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Programming Language :: Python :: 3.8",
                "Topic :: Scientific/Engineering",
            ],
            install_requires=[
                "numpy>=1.15.0", "boto3", "requests>=2.13.0,<3.0.0",
                "spacy>=2.1.0", "cython>=0.25"
            ],
            setup_requires=['wheel', 'spacy>=2.1.0', "cython>=0.25"],
            python_requires=">=3.6",
            packages=PACKAGES,
            package_data=PACKAGE_DATA,
            keywords='NLP chatbots coreference resolution',
            license='MIT',
            zip_safe=False,
            platforms='any',
            cmdclass={"build_ext": build_ext_subclass})
コード例 #37
0
ファイル: setup.py プロジェクト: subliminal-ai/sense2vec
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))
    src_path = "sense2vec"

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with io.open(os.path.join(root, src_path, "about.py"),
                     encoding="utf8") as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, "README.md"), encoding="utf8") as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "include"),
        ]

        if (ccompiler.new_compiler().compiler_type == "msvc"
                and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            ext_modules.append(
                Extension(mod_name, [mod_path],
                          language="c++",
                          include_dirs=include_dirs))

        if not is_source_release(root):
            generate_cython(root, src_path)

        setup(
            name="sense2vec",
            zip_safe=False,
            packages=PACKAGES,
            package_data={"": ["*.pyx", "*.pxd", "*.h"]},
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=ext_modules,
            install_requires=[
                "numpy>=1.15.0",
                "srsly>=0.1.0,<1.1.0",
                "preshed>=2.0.1,<2.1.0",
                "murmurhash>=0.28.0,<1.1.0",
                "cymem>=2.0.2,<2.1.0",
            ],
            entry_points={
                "prodigy_recipes": [
                    "teach = prodigy_recipes:teach",
                    "to_patterns = prodigy_recipes:to_patterns"
                ]
            },
            classifiers=[
                "Development Status :: 4 - Beta",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3",
                "Programming Language :: Python :: 3.4",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )
コード例 #38
0
__revision__ = "$Id$"

import sys, os, string, re
from types import *
from site import USER_BASE, USER_SITE
from distutils.core import Command
from distutils.errors import *
from distutils.sysconfig import customize_compiler, get_python_version
from distutils.dep_util import newer_group
from distutils.extension import Extension
from distutils.util import get_platform
from distutils import log

if os.name == 'nt':
    from distutils.msvccompiler import get_build_version
    MSVC_VERSION = int(get_build_version())

# An extension name is just a dot-separated list of Python NAMEs (ie.
# the same as a fully-qualified module name).
extension_name_re = re.compile \
    (r'^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$')


def show_compilers ():
    from distutils.ccompiler import show_compilers
    show_compilers()


class build_ext (Command):

    description = "build C/C++ extensions (compile/link to build directory)"
コード例 #39
0
ファイル: __init__.py プロジェクト: Noitidart/osxtypes
 def get_version():
     if 'win' not in sys.platform:
         return None #not implemented yet
     else:
         from distutils import msvccompiler
         return ( 'msvc', str( msvccompiler.get_build_version() ) )
コード例 #40
0
ファイル: setup.py プロジェクト: dahlia/libsass-python
    if sys.platform == 'win32':
        from distutils.msvc9compiler import get_build_version
        vscomntools_env = 'VS{}{}COMNTOOLS'.format(
            int(get_build_version()),
            int(get_build_version() * 10) % 10,
        )
        try:
            os.environ[vscomntools_env] = os.environ['VS140COMNTOOLS']
        except KeyError:
            distutils.log.warn(
                'You probably need Visual Studio 2015 (14.0) '
                'or higher',
            )
        from distutils import msvccompiler, msvc9compiler
        if msvccompiler.get_build_version() < 14.0:
            msvccompiler.get_build_version = lambda: 14.0
        if get_build_version() < 14.0:
            msvc9compiler.get_build_version = lambda: 14.0
            msvc9compiler.VERSION = 14.0
    elif platform.system() in ('Darwin', 'FreeBSD'):
        # Dirty workaround to avoid link error...
        # Python distutils doesn't provide any way
        # to configure different flags for each cc and c++.
        cencode_path = os.path.join(LIBSASS_SOURCE_DIR, 'cencode.c')
        cencode_body = ''
        with open(cencode_path) as f:
            cencode_body = f.read()
        with open(cencode_path, 'w') as f:
            f.write(
                '#ifdef __cplusplus\n'
コード例 #41
0
ファイル: setup.py プロジェクト: spacy-io/thinc
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, "thinc", "about.py")) as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, "README.md"), encoding="utf8") as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "include"),
        ]

        if (
            ccompiler.new_compiler().compiler_type == "msvc"
            and msvccompiler.get_build_version() == 9
        ):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            if mod_name.endswith("gpu_ops"):
                continue
            mod_path = mod_name.replace(".", "/") + ".cpp"
            ext_modules.append(
                Extension(
                    mod_name, [mod_path], language="c++", include_dirs=include_dirs
                )
            )
        ext_modules.append(
            Extension('thinc.extra.wrapt._wrappers', ['thinc/extra/wrapt/_wrappers.c'],
                      include_dirs=include_dirs)
        )

        if not is_source_release(root):
            generate_cython(root, "thinc")

        setup(
            name=about["__title__"],
            zip_safe=False,
            packages=PACKAGES,
            package_data={"": ["*.pyx", "*.pxd", "*.pxi", "*.cpp"]},
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=ext_modules,
            setup_requires=["numpy>=1.7.0"],
            install_requires=[
                # Explosion-provided dependencies
                "murmurhash>=0.28.0,<1.1.0",
                "cymem>=2.0.2,<2.1.0",
                "preshed>=1.0.1,<2.1.0",
                "blis>=0.2.1,<0.3.0",
                "wasabi>=0.0.9,<1.1.0",
                "srsly>=0.0.5,<1.1.0",
                # Third-party dependencies
                "numpy>=1.7.0",
                "plac>=0.9.6,<1.0.0",
                "tqdm>=4.10.0,<5.0.0",
                'pathlib==1.0.1; python_version < "3.4"',
            ],
            extras_require={
                "cuda": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy>=5.0.0b4"],
                "cuda80": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda80>=5.0.0b4"],
                "cuda90": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda90>=5.0.0b4"],
                "cuda91": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda91>=5.0.0b4"],
                "cuda92": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda92>=5.0.0b4"],
                "cuda100": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda100>=5.0.0b4"],
            },
            classifiers=[
                "Development Status :: 5 - Production/Stable",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2.6",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3.3",
                "Programming Language :: Python :: 3.4",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )
コード例 #42
0
ファイル: __init__.py プロジェクト: Noitidart/osxtypes
 def get_version():
     if 'win' not in sys.platform:
         return None  #not implemented yet
     else:
         from distutils import msvccompiler
         return ('msvc', str(msvccompiler.get_build_version()))
コード例 #43
0
ファイル: setup.py プロジェクト: pmnyc/Source_Codes_Collected
from distutils import log
from distutils.sysconfig import customize_compiler

import glob
import os
import platform
import sys

from Cython.Distutils import build_ext
from Cython.Build import cythonize

if sys.platform == 'win32':
    VC_INCLUDE_REDIST = False  # Set to True to include C runtime dlls in distribution.
    from distutils import msvccompiler
    from platform import architecture
    VC_VERSION = msvccompiler.get_build_version()
    ARCH = "x64" if architecture()[0] == "64bit" else "x86"

try:
    import numpy
    HAS_NUMPY = True
except ImportError:
    HAS_NUMPY = False

DEBUG = False

SUPPORT_CODE_INCLUDE = './cpp_layer'

QL_LIBRARY = 'QuantLib'

# FIXME: would be good to be able to customize the path with environment
コード例 #44
0
  </trustInfo>
  <dependency>

  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.MFC"
        version="9.0.21022.8" processorArchitecture="x86"
        publicKeyToken="XXXX"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>"""

if sys.platform == "win32":
    from distutils.msvccompiler import get_build_version
    if get_build_version() >= 8.0:
        SKIP_MESSAGE = None
    else:
        SKIP_MESSAGE = "These tests are only for MSVC8.0 or above"
else:
    SKIP_MESSAGE = "These tests are only for win32"


@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
class msvc9compilerTestCase(support.TempdirManager, unittest.TestCase):
    def test_no_compiler(self):
        # makes sure query_vcvarsall raises
        # a DistutilsPlatformError if the compiler
        # is not found
        from distutils.msvc9compiler import query_vcvarsall
コード例 #45
0
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == 'clean':
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, 'murmurhash', 'about.py')) as f:
            about = {}
            exec(f.read(), about)

        with open(os.path.join(root, 'README.rst')) as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'murmurhash', 'include')
        ]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
                and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace('.', '/') + '.cpp'
            ext_modules.append(
                Extension(mod_name, [
                    mod_path, 'murmurhash/MurmurHash2.cpp',
                    'murmurhash/MurmurHash3.cpp'
                ],
                          language='c++',
                          include_dirs=include_dirs))

        if not is_source_release(root):
            generate_cython(root, 'murmurhash')

        setup(
            name=about['__title__'],
            zip_safe=False,
            packages=PACKAGES,
            package_data={'': ['*.pyx', '*.pxd', 'include/murmurhash/*.h']},
            description=about['__summary__'],
            long_description=readme,
            author=about['__author__'],
            author_email=about['__email__'],
            version=about['__version__'],
            url=about['__uri__'],
            license=about['__license__'],
            ext_modules=ext_modules,
            classifiers=[
                'Development Status :: 4 - Beta', 'Environment :: Console',
                'Intended Audience :: Developers',
                'Intended Audience :: Science/Research',
                'License :: OSI Approved :: MIT License',
                'Operating System :: POSIX :: Linux',
                'Operating System :: MacOS :: MacOS X',
                'Operating System :: Microsoft :: Windows',
                'Programming Language :: Cython',
                'Programming Language :: Python :: 2.6',
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.3',
                'Programming Language :: Python :: 3.4',
                'Programming Language :: Python :: 3.5',
                'Topic :: Scientific/Engineering'
            ],
            cmdclass={'build_ext': build_ext_subclass},
        )
コード例 #46
0
ファイル: setup.py プロジェクト: stjordanis/murmurhash
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, "murmurhash", "about.py")) as f:
            about = {}
            exec(f.read(), about)

        with open(os.path.join(root, "README.md")) as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "murmurhash", "include"),
        ]

        if (ccompiler.new_compiler().compiler_type == "msvc"
                and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".pyx"
            ext_modules.append(
                Extension(
                    mod_name,
                    [
                        mod_path,
                        "murmurhash/MurmurHash2.cpp",
                        "murmurhash/MurmurHash3.cpp",
                    ],
                    language="c++",
                    include_dirs=include_dirs,
                ))

        setup(
            name="murmurhash",
            zip_safe=False,
            packages=PACKAGES,
            package_data={"": ["*.pyx", "*.pxd", "include/murmurhash/*.h"]},
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=cythonize(ext_modules, language_level=2),
            setup_requires=["cython>=0.25"],
            classifiers=[
                "Development Status :: 5 - Production/Stable",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2.6",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3.3",
                "Programming Language :: Python :: 3.4",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Programming Language :: Python :: 3.8",
                "Programming Language :: Python :: 3.9",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )
コード例 #47
0
	def __init__(self, sources, plat_name = None, include_dirs = [], library_dirs = [], compiler_options = ""):
		self.sources = sources
		self.include_dirs = include_dirs
		self.library_dirs = library_dirs
		self.compiler_options = compiler_options

		if not plat_name:
			plat_name = get_platform()

		self.plat_name = plat_name

		py_include = sysconfig.get_python_inc()
		plat_py_include = sysconfig.get_python_inc(plat_specific=1)

		if not py_include in self.include_dirs:
			self.include_dirs.append(py_include)

		# Put the Python "system" include dir at the end, so that
		# any local include dirs take precedence.
		if not plat_py_include in self.include_dirs:
			self.include_dirs.append(plat_py_include)

		if os.name == 'nt':
			from distutils.msvccompiler import get_build_version
			MSVC_VERSION = int(get_build_version())
			
			# the 'libs' directory is for binary installs - we assume that
			# must be the *native* platform.  But we don't really support
			# cross-compiling via a binary install anyway, so we let it go.
			self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))

			# Append the source distribution include and library directories,
			# this allows distutils on windows to work in the source tree
			include_dirs.append(os.path.join(sys.exec_prefix, 'PC'))
			if MSVC_VERSION == 9:
				# Use the .lib files for the correct architecture
				if plat_name == 'win32':
					suffix = ''
				else:
					# win-amd64 or win-ia64
					suffix = plat_name[4:]
				new_lib = os.path.join(sys.exec_prefix, 'PCbuild')
				if suffix:
					new_lib = os.path.join(new_lib, suffix)
				self.library_dirs.append(new_lib)

			elif MSVC_VERSION == 8:
				self.library_dirs.append(os.path.join(sys.exec_prefix,
										 'PC', 'VS8.0'))
			elif MSVC_VERSION == 7:
				self.library_dirs.append(os.path.join(sys.exec_prefix,
										 'PC', 'VS7.1'))
			else:
				self.library_dirs.append(os.path.join(sys.exec_prefix,
										 'PC', 'VC6'))
		# OS/2 (EMX) doesn't support Debug vs Release builds, but has the
		# import libraries in its "Config" subdirectory
		if os.name == 'os2':
			self.library_dirs.append(os.path.join(sys.exec_prefix, 'Config'))
			# for extensions under Cygwin and AtheOS Python's library directory must be
			# appended to library_dirs

		if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
			if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
				# building third party extensions
				self.library_dirs.append(os.path.join(sys.prefix, "lib",
													  "python" + get_python_version(),
													  "config"))
			else:
				# building python standard extensions
				self.library_dirs.append('.')
コード例 #48
0
# Embedded file name: scripts/common/Lib/distutils/tests/test_msvc9compiler.py
"""Tests for distutils.msvc9compiler."""
import sys
import unittest
import os
from distutils.errors import DistutilsPlatformError
from distutils.tests import support
from test.test_support import run_unittest

_MANIFEST_WITH_ONLY_MSVC_REFERENCE = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<assembly xmlns="urn:schemas-microsoft-com:asm.v1"\n          manifestVersion="1.0">\n  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">\n    <security>\n      <requestedPrivileges>\n        <requestedExecutionLevel level="asInvoker" uiAccess="false">\n        </requestedExecutionLevel>\n      </requestedPrivileges>\n    </security>\n  </trustInfo>\n  <dependency>\n    <dependentAssembly>\n      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT"\n         version="9.0.21022.8" processorArchitecture="x86"\n         publicKeyToken="XXXX">\n      </assemblyIdentity>\n    </dependentAssembly>\n  </dependency>\n</assembly>\n'
_MANIFEST_WITH_MULTIPLE_REFERENCES = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<assembly xmlns="urn:schemas-microsoft-com:asm.v1"\n          manifestVersion="1.0">\n  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">\n    <security>\n      <requestedPrivileges>\n        <requestedExecutionLevel level="asInvoker" uiAccess="false">\n        </requestedExecutionLevel>\n      </requestedPrivileges>\n    </security>\n  </trustInfo>\n  <dependency>\n    <dependentAssembly>\n      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT"\n         version="9.0.21022.8" processorArchitecture="x86"\n         publicKeyToken="XXXX">\n      </assemblyIdentity>\n    </dependentAssembly>\n  </dependency>\n  <dependency>\n    <dependentAssembly>\n      <assemblyIdentity type="win32" name="Microsoft.VC90.MFC"\n        version="9.0.21022.8" processorArchitecture="x86"\n        publicKeyToken="XXXX"></assemblyIdentity>\n    </dependentAssembly>\n  </dependency>\n</assembly>\n'
_CLEANED_MANIFEST = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<assembly xmlns="urn:schemas-microsoft-com:asm.v1"\n          manifestVersion="1.0">\n  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">\n    <security>\n      <requestedPrivileges>\n        <requestedExecutionLevel level="asInvoker" uiAccess="false">\n        </requestedExecutionLevel>\n      </requestedPrivileges>\n    </security>\n  </trustInfo>\n  <dependency>\n\n  </dependency>\n  <dependency>\n    <dependentAssembly>\n      <assemblyIdentity type="win32" name="Microsoft.VC90.MFC"\n        version="9.0.21022.8" processorArchitecture="x86"\n        publicKeyToken="XXXX"></assemblyIdentity>\n    </dependentAssembly>\n  </dependency>\n</assembly>'
if sys.platform == "win32":
    from distutils.msvccompiler import get_build_version

    if get_build_version() >= 8.0:
        SKIP_MESSAGE = None
    else:
        SKIP_MESSAGE = "These tests are only for MSVC8.0 or above"
else:
    SKIP_MESSAGE = "These tests are only for win32"


@unittest.skipUnless(SKIP_MESSAGE is None, SKIP_MESSAGE)
class msvc9compilerTestCase(support.TempdirManager, unittest.TestCase):
    def test_no_compiler(self):
        from distutils.msvc9compiler import query_vcvarsall

        def _find_vcvarsall(version):
            return None
コード例 #49
0
ファイル: setup.py プロジェクト: sambozek/spaCy
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == 'clean':
        return clean(root)

    with chdir(root):
        with io.open(os.path.join(root, 'spacy', 'about.py'), encoding='utf8') as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, 'README.rst'), encoding='utf8') as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, 'include')]

        if (ccompiler.new_compiler().compiler_type == 'msvc'
            and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, 'include', 'msvc9'))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace('.', '/') + '.cpp'
            ext_modules.append(
                Extension(mod_name, [mod_path],
                    language='c++', include_dirs=include_dirs))

        if not is_source_release(root):
            generate_cython(root, 'spacy')

        setup(
            name=about['__title__'],
            zip_safe=False,
            packages=PACKAGES,
            package_data={'': ['*.pyx', '*.pxd', '*.txt', '*.tokens']},
            description=about['__summary__'],
            long_description=readme,
            author=about['__author__'],
            author_email=about['__email__'],
            version=about['__version__'],
            url=about['__uri__'],
            license=about['__license__'],
            ext_modules=ext_modules,
            install_requires=[
                'numpy>=1.7',
                'murmurhash>=0.26,<0.27',
                'cymem>=1.30,<1.32',
                'preshed>=0.46.0,<0.47.0',
                'thinc>=5.0.0,<5.1.0',
                'plac',
                'six',
                'cloudpickle',
                'pathlib',
                'sputnik>=0.9.2,<0.10.0',
                'ujson>=1.35'],
            classifiers=[
                'Development Status :: 5 - Production/Stable',
                'Environment :: Console',
                'Intended Audience :: Developers',
                'Intended Audience :: Science/Research',
                'License :: OSI Approved :: MIT License',
                'Operating System :: POSIX :: Linux',
                'Operating System :: MacOS :: MacOS X',
                'Operating System :: Microsoft :: Windows',
                'Programming Language :: Cython',
                'Programming Language :: Python :: 2.6',
                'Programming Language :: Python :: 2.7',
                'Programming Language :: Python :: 3.3',
                'Programming Language :: Python :: 3.4',
                'Programming Language :: Python :: 3.5',
                'Topic :: Scientific/Engineering'],
            cmdclass = {
                'build_ext': build_ext_subclass},
        )
コード例 #50
0
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with io.open(os.path.join(root, "spacy", "about.py"),
                     encoding="utf8") as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, "README.md"), encoding="utf8") as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "include"),
        ]

        if (ccompiler.new_compiler().compiler_type == "msvc"
                and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            extra_link_args = []
            extra_compile_args = []
            # ???
            # Imported from patch from @mikepb
            # See Issue #267. Running blind here...
            if sys.platform == "darwin":
                dylib_path = [".." for _ in range(mod_name.count("."))]
                dylib_path = "/".join(dylib_path)
                dylib_path = "@loader_path/%s/spacy/platform/darwin/lib" % dylib_path
                extra_link_args.append("-Wl,-rpath,%s" % dylib_path)
            ext_modules.append(
                Extension(
                    mod_name,
                    [mod_path],
                    language="c++",
                    include_dirs=include_dirs,
                    extra_link_args=extra_link_args,
                ))

        if not is_source_release(root):
            generate_cython(root, "spacy")

        setup(
            name="spacy",
            zip_safe=False,
            packages=PACKAGES,
            package_data=PACKAGE_DATA,
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=ext_modules,
            scripts=["bin/spacy"],
            install_requires=[
                "numpy>=1.15.0",
                "murmurhash>=0.28.0,<1.1.0",
                "cymem>=2.0.2,<2.1.0",
                "preshed>=2.0.1,<2.1.0",
                "thinc>=7.0.2,<7.1.0",
                "blis>=0.2.2,<0.3.0",
                "plac<1.0.0,>=0.9.6",
                "requests>=2.13.0,<3.0.0",
                "jsonschema>=2.6.0,<3.1.0",
                "wasabi>=0.2.0,<1.1.0",
                "srsly>=0.0.5,<1.1.0",
                'pathlib==1.0.1; python_version < "3.4"',
            ],
            setup_requires=["wheel"],
            extras_require={
                "cuda": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy>=5.0.0b4"],
                "cuda80":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda80>=5.0.0b4"],
                "cuda90":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda90>=5.0.0b4"],
                "cuda91":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda91>=5.0.0b4"],
                "cuda92":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda92>=5.0.0b4"],
                "cuda100":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda100>=5.0.0b4"],
                # Language tokenizers with external dependencies
                "ja": ["mecab-python3==0.7"],
            },
            python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
            classifiers=[
                "Development Status :: 5 - Production/Stable",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3",
                "Programming Language :: Python :: 3.4",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )
コード例 #51
0
    def build_extension_cmake(self, ext):
        extdir = os.path.abspath(
            os.path.dirname(self.get_ext_fullpath(ext.name)))
        cfg = "Debug" if self.debug else "Release"

        PYTHON_VERSION = "{}.{}".format(sys.version_info.major,
                                        sys.version_info.minor)

        cmake_args = [
            "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" +
            os.path.abspath(os.path.join(extdir, "perspective",
                                         "table")).replace("\\", "/"),
            "-DCMAKE_BUILD_TYPE=" + cfg,
            "-DPSP_CPP_BUILD=1",
            "-DPSP_WASM_BUILD=0",
            "-DPSP_PYTHON_BUILD=1",
            "-DPSP_PYTHON_VERSION={}".format(PYTHON_VERSION),
            "-DPython_ADDITIONAL_VERSIONS={}".format(PYTHON_VERSION),
            "-DPython_FIND_VERSION={}".format(PYTHON_VERSION),
            "-DPSP_PYTHON_ARROWINSTALLDIR={}".format(
                os.environ.get(
                    "PSP_PYTHON_ARROWINSTALLDIR",
                    os.path.join(sysconfig.get_python_lib(),
                                 "pyarrow").replace("\\", "/"),
                )),
            "-DPython_EXECUTABLE={}".format(sys.executable).replace("\\", "/"),
            "-DPython_ROOT_DIR={}".format(sys.prefix).replace("\\", "/"),
            "-DPython_ROOT={}".format(sys.prefix).replace("\\", "/"),
            "-DPSP_CMAKE_MODULE_PATH={folder}".format(
                folder=os.path.join(ext.sourcedir, "cmake")).replace(
                    "\\", "/"),
            "-DPSP_CPP_SRC={folder}".format(folder=ext.sourcedir).replace(
                "\\", "/"),
            "-DPSP_PYTHON_SRC={folder}".format(folder=os.path.join(
                ext.sourcedir, "..", "perspective").replace("\\", "/")),
        ]

        build_args = ["--config", cfg]

        if platform.system() == "Windows":
            import distutils.msvccompiler as dm

            msvc = {
                "12": "Visual Studio 12 2013",
                "14": "Visual Studio 14 2015",
                "14.1": "Visual Studio 15 2017",
            }.get(dm.get_build_version(), "Visual Studio 15 2017")

            cmake_args.extend([
                "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}".format(
                    cfg.upper(), extdir).replace("\\", "/"),
                "-G",
                os.environ.get("PSP_GENERATOR", msvc),
            ])

            if sys.maxsize > 2**32:
                # build 64 bit to match python
                cmake_args += ["-A", "x64"]

            build_args += [
                "--",
                "/m:{}".format(CPU_COUNT),
                "/p:Configuration={}".format(cfg),
            ]
        else:
            cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]
            build_args += [
                "--",
                "-j2"
                if os.environ.get("DOCKER", "") else "-j{}".format(CPU_COUNT),
            ]

        env = os.environ.copy()
        env["PSP_ENABLE_PYTHON"] = "1"
        env["OSX_DEPLOYMENT_TARGET"] = "10.9"

        if not os.path.exists(self.build_temp):
            os.makedirs(self.build_temp)

        subprocess.check_call(
            [self.cmake_cmd, os.path.abspath(ext.sourcedir)] + cmake_args,
            cwd=self.build_temp,
            env=env,
            stderr=subprocess.STDOUT,
        )
        subprocess.check_call(
            [self.cmake_cmd, "--build", "."] + build_args,
            cwd=self.build_temp,
            env=env,
            stderr=subprocess.STDOUT,
        )
        print()  # Add an empty line for cleaner output
コード例 #52
0
def run(sources, outname, debug = False, plat_name = None):
	from distutils.util import get_platform
	from distutils.core import setup
	from distutils import sysconfig
	import os
	import sys
	
	if not plat_name:
		plat_name = get_platform()
	include_dirs = []
	library_dirs = []
	py_include = sysconfig.get_python_inc()
	plat_py_include = sysconfig.get_python_inc(plat_specific=1)

	include_dirs.append(py_include)

	# Put the Python "system" include dir at the end, so that
	# any local include dirs take precedence.
	if plat_py_include != py_include:
		include_dirs.append(plat_py_include)

	if os.name == 'nt':
		from distutils.msvccompiler import get_build_version
		MSVC_VERSION = int(get_build_version())
		
		# the 'libs' directory is for binary installs - we assume that
		# must be the *native* platform.  But we don't really support
		# cross-compiling via a binary install anyway, so we let it go.
		library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))

		# Append the source distribution include and library directories,
		# this allows distutils on windows to work in the source tree
		include_dirs.append(os.path.join(sys.exec_prefix, 'PC'))
		if MSVC_VERSION == 9:
			# Use the .lib files for the correct architecture
			if plat_name == 'win32':
				suffix = ''
			else:
				# win-amd64 or win-ia64
				suffix = plat_name[4:]
			new_lib = os.path.join(sys.exec_prefix, 'PCbuild')
			if suffix:
				new_lib = os.path.join(new_lib, suffix)
			library_dirs.append(new_lib)

		elif MSVC_VERSION == 8:
			library_dirs.append(os.path.join(sys.exec_prefix,
									 'PC', 'VS8.0'))
		elif MSVC_VERSION == 7:
			library_dirs.append(os.path.join(sys.exec_prefix,
									 'PC', 'VS7.1'))
		else:
			library_dirs.append(os.path.join(sys.exec_prefix,
									 'PC', 'VC6'))
	# OS/2 (EMX) doesn't support Debug vs Release builds, but has the
	# import libraries in its "Config" subdirectory
	if os.name == 'os2':
		library_dirs.append(os.path.join(sys.exec_prefix, 'Config'))
		# for extensions under Cygwin and AtheOS Python's library directory must be
		# appended to library_dirs

	if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
		if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
			# building third party extensions
			library_dirs.append(os.path.join(sys.prefix, "lib",
												  "python" + get_python_version(),
												  "config"))
		else:
			# building python standard extensions
			library_dirs.append('.')
	
	script_args = ['build_clib', '--debug']#, "--plat-name="+plat_name],
	if debug:
		script_args.append('--debug')
	script_args.append('--macros=/O1')
	setup(
	  name = outname,
	  libraries = [(outname, {'sources' : sources, 'include_dirs' : include_dirs})],
	  script_args = script_args,
	)
コード例 #53
0
ファイル: setup.py プロジェクト: spacy-io/preshed
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, "preshed", "about.py")) as f:
            about = {}
            exec(f.read(), about)

        with open(os.path.join(root, "README.md")) as f:
            readme = f.read()

        include_dirs = [get_python_inc(plat_specific=True)]

        if (
            ccompiler.new_compiler().compiler_type == "msvc"
            and msvccompiler.get_build_version() == 9
        ):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            ext_modules.append(
                Extension(
                    mod_name, [mod_path], language="c++", include_dirs=include_dirs
                )
            )

        if not is_source_release(root):
            generate_cython(root, "preshed")

        setup(
            name=about["__title__"],
            zip_safe=False,
            packages=PACKAGES,
            package_data={"": ["*.pyx", "*.pxd"]},
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=ext_modules,
            setup_requires=["wheel>=0.32.0,<0.33.0"],
            install_requires=["cymem>=2.0.2,<2.1.0"],
            classifiers=[
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )
コード例 #54
0
ファイル: build_ext.py プロジェクト: d3vgru/tgs-dist
__revision__ = "$Id$"

import sys, os, string, re
from types import *
from site import USER_BASE, USER_SITE
from distutils.core import Command
from distutils.errors import *
from distutils.sysconfig import customize_compiler, get_python_version
from distutils.dep_util import newer_group
from distutils.extension import Extension
from distutils.util import get_platform
from distutils import log

if os.name == 'nt':
    from distutils.msvccompiler import get_build_version
    MSVC_VERSION = int(get_build_version())

# An extension name is just a dot-separated list of Python NAMEs (ie.
# the same as a fully-qualified module name).
extension_name_re = re.compile \
    (r'^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$')


def show_compilers ():
    from distutils.ccompiler import show_compilers
    show_compilers()


class build_ext (Command):

    description = "build C/C++ extensions (compile/link to build directory)"
コード例 #55
0
ファイル: setup.py プロジェクト: tlmnb/thinc
def setup_package():
    root = os.path.abspath(os.path.dirname(__file__))

    if len(sys.argv) > 1 and sys.argv[1] == "clean":
        return clean(root)

    with chdir(root):
        with open(os.path.join(root, "thinc", "about.py")) as f:
            about = {}
            exec(f.read(), about)

        with io.open(os.path.join(root, "README.md"), encoding="utf8") as f:
            readme = f.read()

        include_dirs = [
            get_python_inc(plat_specific=True),
            os.path.join(root, "include"),
        ]

        if (ccompiler.new_compiler().compiler_type == "msvc"
                and msvccompiler.get_build_version() == 9):
            include_dirs.append(os.path.join(root, "include", "msvc9"))

        ext_modules = []
        for mod_name in MOD_NAMES:
            mod_path = mod_name.replace(".", "/") + ".cpp"
            if mod_name.endswith("gpu_ops"):
                continue
            mod_path = mod_name.replace(".", "/") + ".cpp"
            ext_modules.append(
                Extension(mod_name, [mod_path],
                          language="c++",
                          include_dirs=include_dirs))
        ext_modules.append(
            Extension(
                "thinc.extra.wrapt._wrappers",
                ["thinc/extra/wrapt/_wrappers.c"],
                include_dirs=include_dirs,
            ))

        if not is_source_release(root):
            generate_cython(root, "thinc")

        setup(
            name="thinc",
            zip_safe=False,
            packages=PACKAGES,
            package_data={"": ["*.pyx", "*.pxd", "*.pxi", "*.cpp"]},
            description=about["__summary__"],
            long_description=readme,
            long_description_content_type="text/markdown",
            author=about["__author__"],
            author_email=about["__email__"],
            version=about["__version__"],
            url=about["__uri__"],
            license=about["__license__"],
            ext_modules=ext_modules,
            setup_requires=["numpy>=1.7.0"],
            install_requires=[
                # Explosion-provided dependencies
                "murmurhash>=0.28.0,<1.1.0",
                "cymem>=2.0.2,<2.1.0",
                "preshed>=1.0.1,<3.1.0",
                "blis>=0.4.0,<0.5.0",
                "wasabi>=0.0.9,<1.1.0",
                "srsly>=0.0.6,<1.1.0",
                # Third-party dependencies
                "numpy>=1.7.0",
                "plac>=0.9.6,<1.0.0",
                "tqdm>=4.10.0,<5.0.0",
                'pathlib==1.0.1; python_version < "3.4"',
            ],
            extras_require={
                "cuda": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy>=5.0.0b4"],
                "cuda80":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda80>=5.0.0b4"],
                "cuda90":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda90>=5.0.0b4"],
                "cuda91":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda91>=5.0.0b4"],
                "cuda92":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda92>=5.0.0b4"],
                "cuda100":
                ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda100>=5.0.0b4"],
            },
            classifiers=[
                "Development Status :: 5 - Production/Stable",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "Intended Audience :: Science/Research",
                "License :: OSI Approved :: MIT License",
                "Operating System :: POSIX :: Linux",
                "Operating System :: MacOS :: MacOS X",
                "Operating System :: Microsoft :: Windows",
                "Programming Language :: Cython",
                "Programming Language :: Python :: 2.6",
                "Programming Language :: Python :: 2.7",
                "Programming Language :: Python :: 3.3",
                "Programming Language :: Python :: 3.4",
                "Programming Language :: Python :: 3.5",
                "Programming Language :: Python :: 3.6",
                "Programming Language :: Python :: 3.7",
                "Topic :: Scientific/Engineering",
            ],
            cmdclass={"build_ext": build_ext_subclass},
        )