• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python sysconfig.get_python_version函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sysconfig.get_python_version函数的典型用法代码示例。如果您正苦于以下问题:Python get_python_version函数的具体用法?Python get_python_version怎么用?Python get_python_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_python_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: finalize_options

    def finalize_options(self):
        self.set_undefined_options("bdist", ("skip_build", "skip_build"))
        if self.bdist_dir is None:
            bdist_base = self.get_finalized_command("bdist").bdist_base
            self.bdist_dir = os.path.join(bdist_base, "msi")
        short_version = get_python_version()
        if not self.target_version and self.distribution.has_ext_modules():
            self.target_version = short_version
        if self.target_version:
            self.versions = [self.target_version]
            if not self.skip_build and self.distribution.has_ext_modules() and self.target_version != short_version:
                raise DistutilsOptionError, "target version can only be %s, or the '--skip-build' option must be specified" % (
                    short_version,
                )
        else:
            self.versions = list(self.all_versions)
        self.set_undefined_options("bdist", ("dist_dir", "dist_dir"), ("plat_name", "plat_name"))
        if self.pre_install_script:
            raise DistutilsOptionError, "the pre-install-script feature is not yet implemented"
        if self.install_script:
            for script in self.distribution.scripts:
                if self.install_script == os.path.basename(script):
                    break
            else:
                raise DistutilsOptionError, "install_script '%s' not found in scripts" % self.install_script

        self.install_script_key = None
        return
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:28,代码来源:bdist_msi.py


示例2: get_install_args

    def get_install_args(
        self,
        global_options,  # type: Sequence[str]
        record_filename,  # type: str
        root,  # type: Optional[str]
        prefix,  # type: Optional[str]
        pycompile  # type: bool
    ):
        # type: (...) -> List[str]
        install_args = [sys.executable, "-u"]
        install_args.append('-c')
        install_args.append(SETUPTOOLS_SHIM % self.setup_py)
        install_args += list(global_options) + \
            ['install', '--record', record_filename]
        install_args += ['--single-version-externally-managed']

        if root is not None:
            install_args += ['--root', root]
        if prefix is not None:
            install_args += ['--prefix', prefix]

        if pycompile:
            install_args += ["--compile"]
        else:
            install_args += ["--no-compile"]

        if running_under_virtualenv():
            py_ver_str = 'python' + sysconfig.get_python_version()
            install_args += ['--install-headers',
                             os.path.join(sys.prefix, 'include', 'site',
                                          py_ver_str, self.name)]

        return install_args
开发者ID:pfmoore,项目名称:pip,代码行数:33,代码来源:req_install.py


示例3: finalize_options

    def finalize_options(self):
        self.set_undefined_options("bdist", ("skip_build", "skip_build"))

        if self.bdist_dir is None:
            if self.skip_build and self.plat_name:
                # If build is skipped and plat_name is overridden, bdist will
                # not see the correct 'plat_name' - so set that up manually.
                bdist = self.distribution.get_command_obj("bdist")
                bdist.plat_name = self.plat_name
                # next the command will be initialized using that name
            bdist_base = self.get_finalized_command("bdist").bdist_base
            self.bdist_dir = os.path.join(bdist_base, "wininst")

        if not self.target_version:
            self.target_version = ""

        if not self.skip_build and self.distribution.has_ext_modules():
            short_version = get_python_version()
            if self.target_version and self.target_version != short_version:
                raise DistutilsOptionError, "target version can only be %s, or the '--skip-build'" " option must be specified" % (
                    short_version,
                )
            self.target_version = short_version

        self.set_undefined_options("bdist", ("dist_dir", "dist_dir"), ("plat_name", "plat_name"))

        if self.install_script:
            for script in self.distribution.scripts:
                if self.install_script == os.path.basename(script):
                    break
            else:
                raise DistutilsOptionError, "install_script '%s' not found in scripts" % self.install_script
开发者ID:kappaIO-Dev,项目名称:kappaIO-toolchain-crosscompile-armhf,代码行数:32,代码来源:bdist_wininst.py


示例4: sysconfig2

def sysconfig2():
    # import sysconfig module - Provide access to Python’s configuration information
    import sysconfig

    # returns an installation path corresponding to the path name
    print("Path Name : ", sysconfig.get_path("stdlib"))
    print()

    # returns a string that identifies the current platform.
    print("Current Platform : ", sysconfig.get_platform())
    print()

    # returns the MAJOR.MINOR Python version number as a string
    print("Python Version Number : ", sysconfig.get_python_version())
    print()

    # returns a tuple containing all path names
    print("Path Names : ", sysconfig.get_path_names())
    print()

    # returns a tuple containing all schemes
    print("Scheme Names : ", sysconfig.get_scheme_names())
    print()

    # returns the value of a single variable name.
    print("Variable name LIBDIR : ", sysconfig.get_config_var('LIBDIR'))

    # returns the value of a single variable name.
    print("Variable name LIBDEST : ", sysconfig.get_config_var('LIBDEST'))
开发者ID:mcclayac,项目名称:LearnSmart1,代码行数:29,代码来源:sysconfigExample.py


示例5: run

 def run(self):
     if not self.skip_build:
         self.run_command('build')
     install = self.reinitialize_command('install', reinit_subcommands=1)
     install.root = self.bdist_dir
     install.skip_build = self.skip_build
     install.warn_dir = 0
     log.info('installing to %s' % self.bdist_dir)
     self.run_command('install')
     archive_basename = '%s.%s' % (self.distribution.get_fullname(), self.plat_name)
     if os.name == 'os2':
         archive_basename = archive_basename.replace(':', '-')
     pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
     if not self.relative:
         archive_root = self.bdist_dir
     elif self.distribution.has_ext_modules() and install.install_base != install.install_platbase:
         raise DistutilsPlatformError, "can't make a dumb built distribution where base and platbase are different (%s, %s)" % (repr(install.install_base), repr(install.install_platbase))
     else:
         archive_root = os.path.join(self.bdist_dir, ensure_relative(install.install_base))
     filename = self.make_archive(pseudoinstall_root, self.format, root_dir=archive_root, owner=self.owner, group=self.group)
     if self.distribution.has_ext_modules():
         pyversion = get_python_version()
     else:
         pyversion = 'any'
     self.distribution.dist_files.append(('bdist_dumb', pyversion, filename))
     if not self.keep_temp:
         remove_tree(self.bdist_dir, dry_run=self.dry_run)
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:27,代码来源:bdist_dumb.py


示例6: main

def main():
    ''' main function '''

    parser = argparse.ArgumentParser(description='lvdb wrapper for gdb. Assumes .gdbinit contains at least "set logging on."')
    parser.add_argument("fname", help='a binary that to be called with gdb')
    parser.add_argument("-d", "--debug", action="store_true", help="whether to output debugging information in gdb_monitor.log")
    args = parser.parse_args()

    # start monitor with same version of python in the background
    # this is in case the default system version (say 2.6) does not have
    # IPython installed
    python_bin = 'python' + str(sysconfig.get_python_version())
    pid = subprocess.Popen([python_bin, '-c', "import lvdb; lvdb.monitor_gdb_file({})".format(args.debug)]).pid

    # start gdb (waiting until it exits)
    subprocess.call(['gdb', '-x', '.gdbinit', args.fname])

    # kill the gdb monitor and remove temporary files
    subprocess.call(['kill', str(pid)])

    for f in ['.debug_gdb_objs', '.debug_location', '.debug_breakpoint']:
        try:
            os.remove(f)
        except OSError:
            pass
开发者ID:esquires,项目名称:vim-pdb,代码行数:25,代码来源:vim_gdb.py


示例7: finalize_options

    def finalize_options (self):
        if self.bdist_dir is None:
            bdist_base = self.get_finalized_command('bdist').bdist_base
            self.bdist_dir = os.path.join(bdist_base, 'msi')
        short_version = get_python_version()
        if (not self.target_version) and self.distribution.has_ext_modules():
            self.target_version = short_version
        if self.target_version:
            self.versions = [self.target_version]
            if not self.skip_build and self.distribution.has_ext_modules()\
               and self.target_version != short_version:
                raise DistutilsOptionError, \
                      "target version can only be %s, or the '--skip_build'" \
                      " option must be specified" % (short_version,)
        else:
            self.versions = list(self.all_versions)

        self.set_undefined_options('bdist',
                                   ('dist_dir', 'dist_dir'),
                                   ('plat_name', 'plat_name'),
                                   )

        if self.pre_install_script:
            raise DistutilsOptionError, "the pre-install-script feature is not yet implemented"

        if self.install_script:
            for script in self.distribution.scripts:
                if self.install_script == os.path.basename(script):
                    break
            else:
                raise DistutilsOptionError, \
                      "install_script '%s' not found in scripts" % \
                      self.install_script
        self.install_script_key = None
开发者ID:TimSC,项目名称:PyEmbed,代码行数:34,代码来源:bdist_msi.py


示例8: test_editable_egg_conflict

def test_editable_egg_conflict(tmpdir):
    conflicting_package = tmpdir / 'tmp/conflicting_package'
    many_versions_package_2 = tmpdir / 'tmp/many_versions_package_2'

    from shutil import copytree
    copytree(
        str(T.TOP / 'tests/testing/packages/conflicting_package'),
        str(conflicting_package),
    )

    copytree(
        str(T.TOP / 'tests/testing/packages/many_versions_package_2'),
        str(many_versions_package_2),
    )

    with many_versions_package_2.as_cwd():
        from sys import executable as python
        T.run(python, 'setup.py', 'bdist_egg', '--dist-dir', str(conflicting_package))

    with tmpdir.as_cwd():
        T.requirements('-r %s/requirements.d/coverage.txt' % T.TOP)
        T.venv_update()

        T.requirements('-e %s' % conflicting_package)
        with pytest.raises(CalledProcessError) as excinfo:
            T.venv_update()
        assert excinfo.value.returncode == 1
        out, err = excinfo.value.result

        err = T.strip_coverage_warnings(err)
        assert err == ''

        out = T.uncolor(out)
        expected = '\nSuccessfully installed many-versions-package conflicting-package\n'
        assert expected in out
        rest = out.rsplit(expected, 1)[-1]

        if True:  # :pragma:nocover:pylint:disable=using-constant-test
            # Debian de-vendorizes the version of pip it ships
            try:
                from sysconfig import get_python_version
            except ImportError:  # <= python2.6
                from distutils.sysconfig import get_python_version
        assert (
            '''\
Cleaning up...
Error: version conflict: many-versions-package 2 (tmp/conflicting_package/many_versions_package-2-py{0}.egg)'''
            ''' <-> many-versions-package<2 (from conflicting-package==1->-r requirements.txt (line 1))
Storing debug log for failure in {1}/home/.pip/pip.log

Something went wrong! Sending 'venv' back in time, so make knows it's invalid.
'''.format(get_python_version(), tmpdir)
        ) == rest

        assert_venv_marked_invalid(tmpdir.join('venv'))
开发者ID:jolynch,项目名称:pip-faster,代码行数:55,代码来源:conflict_test.py


示例9: run

    def run(self):
        if not self.skip_build:
            self.run_command('build')

        install = self.get_reinitialized_command('install', reinit_subcommands=1)
        install.root = self.bdist_dir
        install.skip_build = self.skip_build
        install.warn_dir = 0

        log.info("installing to %s" % self.bdist_dir)
        self.run_command('install')

        # And make an archive relative to the root of the
        # pseudo-installation tree.
        archive_basename = "%s.%s" % (self.distribution.get_fullname(),
                                      self.plat_name)

        # OS/2 objects to any ":" characters in a filename (such as when
        # a timestamp is used in a version) so change them to hyphens.
        if os.name == "os2":
            archive_basename = archive_basename.replace(":", "-")

        pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
        if not self.relative:
            archive_root = self.bdist_dir
        else:
            if (self.distribution.has_ext_modules() and
                (install.install_base != install.install_platbase)):
                raise DistutilsPlatformError, \
                      ("can't make a dumb built distribution where "
                       "base and platbase are different (%s, %s)"
                       % (repr(install.install_base),
                          repr(install.install_platbase)))
            else:
                archive_root = os.path.join(
                    self.bdist_dir,
                    self._ensure_relative(install.install_base))

        # Make the archive
        filename = self.make_archive(pseudoinstall_root,
                                     self.format, root_dir=archive_root,
                                     owner=self.owner, group=self.group)
        if self.distribution.has_ext_modules():
            pyversion = get_python_version()
        else:
            pyversion = 'any'
        self.distribution.dist_files.append(('bdist_dumb', pyversion,
                                             filename))

        if not self.keep_temp:
            if self.dry_run:
                log.info('Removing %s' % self.bdist_dir)
            else:
                rmtree(self.bdist_dir)
开发者ID:irslambouf,项目名称:SyncServer,代码行数:54,代码来源:bdist_dumb.py


示例10: _tagged_ext_name

def _tagged_ext_name(base):
  uname = platform.uname()
  tags = (
      grpc_version.VERSION,
      'py{}'.format(sysconfig.get_python_version()),
      uname[0],
      uname[4],
  )
  ucs = 'ucs{}'.format(sysconfig.get_config_var('Py_UNICODE_SIZE'))
  return '{base}-{tags}-{ucs}'.format(
      base=base, tags='-'.join(tags), ucs=ucs)
开发者ID:Aj0Ay,项目名称:grpc,代码行数:11,代码来源:precompiled.py


示例11: get_python_version

def get_python_version(compat):
    """Return the version of Python that an app will use.

    Based on the compat level.
    """
    if compat < 5:
        return '2.7'
    if sys.version_info.major == 3:
        return sysconfig.get_python_version()
    return subprocess.check_output((
        'python3', '-c',
        'import sysconfig; print(sysconfig.get_python_version())'
    )).strip()
开发者ID:yola,项目名称:yodeploy,代码行数:13,代码来源:virtualenv.py


示例12: create_ve

def create_ve(
        app_dir, python_version, platform, pypi=None,
        req_file='requirements.txt',
        verify_req_install=True):
    log.info('Building virtualenv')
    ve_dir = os.path.join(app_dir, 'virtualenv')
    ve_python = os.path.join(ve_dir, 'bin', 'python')
    req_file = os.path.join(os.path.abspath(app_dir), req_file)

    # The venv module makes a lot of our reclocateability problems go away, so
    # we only use the virtualenv library on Python 2.
    if python_version.startswith('3.'):
        subprocess.check_call((
            'python%s' % python_version, '-m', 'venv', ve_dir))
        pip_version = subprocess.check_output((
            ve_python, '-c', 'import ensurepip; print(ensurepip.version())'))
        if parse_version(pip_version) < parse_version('9'):
            pip_install(ve_dir, pypi, '-U', 'pip')
        pip_install(ve_dir, pypi, 'wheel')

    elif python_version == sysconfig.get_python_version():
        virtualenv.create_environment(ve_dir, site_packages=False)
    else:
        subprocess.check_call((
            sys.executable, virtualenv.__file__.rstrip('c'),
            '-p', 'python%s' % python_version,
            '--no-site-packages', ve_dir))

    log.info('Installing requirements')
    pip_install(ve_dir, pypi, '-r', req_file)

    if verify_req_install:
        log.info('Verifying requirements were met')
        check_requirements(ve_dir)

    relocateable_ve(ve_dir, python_version)

    ve_id = get_id(os.path.join(app_dir, req_file), python_version, platform)
    with open(os.path.join(ve_dir, '.hash'), 'w') as f:
        f.write(ve_id)
        f.write('\n')

    log.info('Building virtualenv tarball')
    cwd = os.getcwd()
    os.chdir(app_dir)
    t = tarfile.open('virtualenv.tar.gz', 'w:gz')
    try:
        t.add('virtualenv')
    finally:
        t.close()
        os.chdir(cwd)
开发者ID:yola,项目名称:yodeploy,代码行数:51,代码来源:virtualenv.py


示例13: finalize_options

 def finalize_options(self):
     orig_bdist_egg.finalize_options(self)
     
     # Redo the calculation of the egg's filename since we always have
     # extension modules, but they are not built by setuptools so it
     # doesn't know about them.
     from pkg_resources import Distribution
     from sysconfig import get_python_version
     basename = Distribution(
         None, None, self.ei_cmd.egg_name, self.ei_cmd.egg_version,
         get_python_version(),
         self.plat_name
     ).egg_name()
     self.egg_output = os.path.join(self.dist_dir, basename+'.egg')
开发者ID:ssbb,项目名称:Phoenix,代码行数:14,代码来源:setup.py


示例14: print_benchmarks

def print_benchmarks(times):
    ''' Pretty print for the benchmark results,
        with a detailed CSV at the end.
    '''
    print('\nmazelib benchmarking')
    print(datetime.now().strftime('%Y-%m-%d %H:%M'))
    print('Python version: ' + get_python_version())
    print('\nTotal Time (seconds): %.5f\n' %
          sum([sum(times_row) for times_row in times]))

    print('\nmaze size,' + ','.join([str(s) for s in SIZES]))
    for row in range(len(times)):
        method = GENERATORS[row] + '-' + SOLVERS[row] + ','
        print(method + ','.join(['%.5f' % time for time in times[row]]))
开发者ID:Ridhwanluthra,项目名称:mazelib,代码行数:14,代码来源:benchmarks.py


示例15: get_exe_bytes

        def get_exe_bytes (self):
            cur_version = get_python_version()
            bv=9.0
            directory = os.path.dirname(_bdist_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()
开发者ID:ronidrori,项目名称:gdal-calculations,代码行数:15,代码来源:setup.py


示例16: get

	def get(self):

		retVal = {}
		retVal["success"] = True
		retVal["message"] = "OK"
		retVal["commit"] = os.environ["COMMIT"] if "COMMIT" in os.environ else "dev"
		retVal["timestamp"] = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
		retVal["lastmod"] = os.environ["LASTMOD"] if "LASTMOD" in os.environ else "dev"
		retVal["tech"] = "Python %d.%d.%d" % (sys.version_info.major, sys.version_info.minor, sys.version_info.micro)
		retVal["version"] = "%s (%s)" % (platform.python_version(), platform.python_implementation())
		add_if_exists(retVal, "platform.machine()", platform.machine())
		add_if_exists(retVal, "platform.node()", platform.node())
		#IOError: add_if_exists(retVal, "platform.platform()", platform.platform())
		add_if_exists(retVal, "platform.processor()", platform.processor())
		add_if_exists(retVal, "platform.python_branch()", platform.python_branch())
		add_if_exists(retVal, "platform.python_build()", platform.python_build())
		add_if_exists(retVal, "platform.python_compiler()", platform.python_compiler())
		add_if_exists(retVal, "platform.python_implementation()", platform.python_implementation())
		add_if_exists(retVal, "platform.python_version()", platform.python_version())
		add_if_exists(retVal, "platform.python_revision()", platform.python_revision())
		add_if_exists(retVal, "platform.release()", platform.release())
		add_if_exists(retVal, "platform.system()", platform.system())
		add_if_exists(retVal, "platform.version()", platform.version())
		add_if_exists(retVal, "platform.uname()", platform.uname())
		add_if_exists(retVal, "sysconfig.get_platform()", sysconfig.get_platform())
		add_if_exists(retVal, "sysconfig.get_python_version()", sysconfig.get_python_version())
		add_if_exists(retVal, "sys.byteorder", sys.byteorder)
		add_if_exists(retVal, "sys.copyright", sys.copyright)
		add_if_exists(retVal, "sys.getdefaultencoding()", sys.getdefaultencoding())
		add_if_exists(retVal, "sys.getfilesystemencoding()", sys.getfilesystemencoding())
		add_if_exists(retVal, "sys.maxint", sys.maxint)
		add_if_exists(retVal, "sys.maxsize", sys.maxsize)
		add_if_exists(retVal, "sys.maxunicode", sys.maxunicode)
		add_if_exists(retVal, "sys.version", sys.version)

		self.response.headers['Content-Type'] = 'text/plain'

		callback = self.request.get('callback')
		if len(callback) == 0 or re.match("[a-zA-Z][-a-zA-Z0-9_]*$", callback) is None:
			self.response.headers['Access-Control-Allow-Origin'] = '*'
			self.response.headers['Access-Control-Allow-Methods'] = 'POST, GET'
			self.response.headers['Access-Control-Max-Age'] = '604800' # 1 week
			self.response.out.write(json.dumps(retVal, separators=(',', ':')))
		else:
			self.response.out.write(callback)
			self.response.out.write("(")
			self.response.out.write(json.dumps(retVal, separators=(',', ':')))
			self.response.out.write(");")
开发者ID:fileformat,项目名称:regexplanet-python,代码行数:48,代码来源:regexplanet-api.py


示例17: run

    def run(self):
        if sys.platform != 'win32' and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries()):
            raise DistutilsPlatformError('distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform')
        if not self.skip_build:
            self.run_command('build')
        install = self.reinitialize_command('install', reinit_subcommands=1)
        install.root = self.bdist_dir
        install.skip_build = self.skip_build
        install.warn_dir = 0
        install.plat_name = self.plat_name
        install_lib = self.reinitialize_command('install_lib')
        install_lib.compile = 0
        install_lib.optimize = 0
        if self.distribution.has_ext_modules():
            target_version = self.target_version
            if not target_version:
                if not self.skip_build:
                    raise AssertionError('Should have already checked this')
                    target_version = sys.version[0:3]
                plat_specifier = '.%s-%s' % (self.plat_name, target_version)
                build = self.get_finalized_command('build')
                build.build_lib = os.path.join(build.build_base, 'lib' + plat_specifier)
            for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'):
                value = string.upper(key)
                if key == 'headers':
                    value = value + '/Include/$dist_name'
                setattr(install, 'install_' + key, value)

            log.info('installing to %s', self.bdist_dir)
            install.ensure_finalized()
            sys.path.insert(0, os.path.join(self.bdist_dir, 'PURELIB'))
            install.run()
            del sys.path[0]
            from tempfile import mktemp
            archive_basename = mktemp()
            fullname = self.distribution.get_fullname()
            arcname = self.make_archive(archive_basename, 'zip', root_dir=self.bdist_dir)
            self.create_exe(arcname, fullname, self.bitmap)
            if self.distribution.has_ext_modules():
                pyversion = get_python_version()
            else:
                pyversion = 'any'
            self.distribution.dist_files.append(('bdist_wininst', pyversion, self.get_installer_filename(fullname)))
            log.debug("removing temporary file '%s'", arcname)
            os.remove(arcname)
            self.keep_temp or remove_tree(self.bdist_dir, dry_run=self.dry_run)
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:46,代码来源:bdist_wininst.py


示例18: get_exe_bytes

    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()
开发者ID:JoJoBond,项目名称:The-Powder-Toy,代码行数:46,代码来源:bdist_wininst.py


示例19: setUp

    def setUp(self):
        super(ApplicationTestCase, self).setUp()

        shutil.copy(
            os.path.join(FIXTURES_DIR, 'config.py'), self.tmppath('config.py'))

        store = LocalRepositoryStore(self.mkdir('artifacts'))
        self.repo = Repository(store)
        self.app = Application('test', self.tmppath('config.py'))

        self.test_ve_tar_path = self._data_path('deploy-ve/virtualenv.tar.gz')
        self.test_req_path = self._data_path('deploy-ve/requirements.txt')
        self.test_ve_path = self._data_path('deploy-ve')

        if not os.path.exists(self.test_ve_tar_path):
            self._create_test_ve()
        self._deploy_ve_id = virtualenv.get_id(
            self.test_req_path, sysconfig.get_python_version(), 'test')
开发者ID:yola,项目名称:yodeploy,代码行数:18,代码来源:test_application.py


示例20: __init__

    def __init__(self, dev_install, debug_level=None, mark_read=None):
        if dev_install:
            self.conf_dir = os.path.expanduser('~/.democraticd/')
            default_log = os.path.join(self.conf_dir, 'democraticd.log')
        else:
            self.conf_dir = '/etc/democraticd/'
            default_log = '/var/log/democraticd.log'
        
        self.packages_dir = os.path.join(self.conf_dir, 'packages')
        self.debs_dir = os.path.join(self.conf_dir, 'debs')
        self.pull_requests_dir = os.path.join(self.conf_dir, 'pull-requests')
        self.json_extension = '.json'
        
        filename = os.path.join(self.conf_dir, 'config.json')
        if not os.path.exists(filename):
            raise Exception('Not installed properly - ' + filename + ' does not exist')
        with open(filename, 'rt') as f:
            file_values = json.loads(f.read() or '{}')
        
        self.port = file_values.get('port', 9999)
        
        if debug_level == None:
            debug_level = file_values.get('debug_level', DebugLevel.ESSENTIAL)
        self.debug_level = debug_level
            
        if mark_read == None:
            mark_read = file_values.get('mark_read', True)
        self.mark_read = mark_read
        
        self.uid = file_values.get('uid', 0)
        self.gid = file_values.get('gid', 0)
        self.euid = file_values.get('euid', 1000)
        self.egid = file_values.get('egid', 1000)
        
        self.git_name = file_values.get('git_name', 'Democratic Daemon')
        self.git_email = file_values.get('git_email', '[email protected]')
        
        self.log_filename = file_values.get('log_file', default_log)

        self.python = 'python' + sysconfig.get_python_version()[0]
        self.module_dir = '.'
        if sys.argv[0]:
            self.module_dir = os.path.join(os.path.dirname(sys.argv[0]), '..')
        self.module_dir = os.path.abspath(self.module_dir)
开发者ID:democraticd,项目名称:democraticd,代码行数:44,代码来源:config.py



注:本文中的sysconfig.get_python_version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sysconfig.get_scheme_names函数代码示例发布时间:2022-05-27
下一篇:
Python sysconfig.get_platform函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap