当前位置: 首页>>代码示例>>Python>>正文


Python util.convert_path方法代码示例

本文整理汇总了Python中distutils.util.convert_path方法的典型用法代码示例。如果您正苦于以下问题:Python util.convert_path方法的具体用法?Python util.convert_path怎么用?Python util.convert_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distutils.util的用法示例。


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

示例1: copy_scripts

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def copy_scripts(self):
        _build_scripts.copy_scripts(self)

        if "install" in self.distribution.command_obj:
            iobj = self.distribution.command_obj["install"]
            libDir = iobj.install_lib

            if iobj.root:
                libDir = libDir[len(iobj.root):]

            script = convert_path("bin/trelby")
            outfile = os.path.join(self.build_dir, os.path.basename(script))

            # abuse fileinput to replace a line in bin/trelby
            for line in fileinput.input(outfile, inplace = 1):
                if """sys.path.insert(0, "src")""" in line:
                    line = """sys.path.insert(0, "%s/src")""" % libDir

                print line, 
开发者ID:trelby,项目名称:trelby,代码行数:21,代码来源:setup.py

示例2: find

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def find(cls, where='.', exclude=(), include=('*',)):
        """Return a list all Python packages found within directory 'where'

        'where' should be supplied as a "cross-platform" (i.e. URL-style)
        path; it will be converted to the appropriate local path syntax.
        'exclude' is a sequence of package names to exclude; '*' can be used
        as a wildcard in the names, such that 'foo.*' will exclude all
        subpackages of 'foo' (but not 'foo' itself).

        'include' is a sequence of package names to include.  If it's
        specified, only the named packages will be included.  If it's not
        specified, all found packages will be included.  'include' can contain
        shell style wildcard patterns just like 'exclude'.

        The list of included packages is built up first and then any
        explicitly excluded packages are removed from it.
        """
        out = cls._find_packages_iter(convert_path(where))
        out = cls.require_parents(out)
        includes = cls._build_filter(*include)
        excludes = cls._build_filter('ez_setup', '*__pycache__', *exclude)
        out = filter(includes, out)
        out = filterfalse(excludes, out)
        return list(out) 
开发者ID:jpush,项目名称:jbox,代码行数:26,代码来源:__init__.py

示例3: install_egg_scripts

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def install_egg_scripts(self, dist):
        if dist is not self.dist:
            # Installing a dependency, so fall back to normal behavior
            return easy_install.install_egg_scripts(self, dist)

        # create wrapper scripts in the script dir, pointing to dist.scripts

        # new-style...
        self.install_wrapper_scripts(dist)

        # ...and old-style
        for script_name in self.distribution.scripts or []:
            script_path = os.path.abspath(convert_path(script_name))
            script_name = os.path.basename(script_path)
            with io.open(script_path) as strm:
                script_text = strm.read()
            self.install_script(dist, script_name, script_text, script_path) 
开发者ID:jpush,项目名称:jbox,代码行数:19,代码来源:develop.py

示例4: config_file

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def config_file(kind="local"):
    """Get the filename of the distutils, local, global, or per-user config

    `kind` must be one of "local", "global", or "user"
    """
    if kind == 'local':
        return 'setup.cfg'
    if kind == 'global':
        return os.path.join(
            os.path.dirname(distutils.__file__), 'distutils.cfg'
        )
    if kind == 'user':
        dot = os.name == 'posix' and '.' or ''
        return os.path.expanduser(convert_path("~/%spydistutils.cfg" % dot))
    raise ValueError(
        "config_file() type must be 'local', 'global', or 'user'", kind
    ) 
开发者ID:jpush,项目名称:jbox,代码行数:19,代码来源:setopt.py

示例5: exclude_data_files

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def exclude_data_files(self, package, src_dir, files):
        """Filter filenames for package's data files in 'src_dir'"""
        globs = (
            self.exclude_package_data.get('', [])
            + self.exclude_package_data.get(package, [])
        )
        bad = set(
            item
            for pattern in globs
            for item in fnmatch.filter(
                files,
                os.path.join(src_dir, convert_path(pattern)),
            )
        )
        seen = collections.defaultdict(itertools.count)
        return [
            fn
            for fn in files
            if fn not in bad
            # ditch dupes
            and not next(seen[fn])
        ] 
开发者ID:jpush,项目名称:jbox,代码行数:24,代码来源:build_py.py

示例6: _add_defaults_data_files

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def _add_defaults_data_files(self):
        # getting distribution.data_files
        if self.distribution.has_data_files():
            for item in self.distribution.data_files:
                if isinstance(item, str):
                    # plain file
                    item = convert_path(item)
                    if os.path.isfile(item):
                        self.filelist.append(item)
                else:
                    # a (dirname, filenames) tuple
                    dirname, filenames = item
                    for f in filenames:
                        f = convert_path(f)
                        if os.path.isfile(f):
                            self.filelist.append(f) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:18,代码来源:py36compat.py

示例7: finalize_options

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def finalize_options(self):
        self.set_undefined_options('build',
                                   ('build_lib', 'build_lib'),
                                   ('force', 'force'))

        # Get the distribution options that are aliases for build_py
        # options -- list of packages and list of modules.
        self.packages = self.distribution.packages
        self.py_modules = self.distribution.py_modules
        self.package_data = self.distribution.package_data
        self.package_dir = {}
        if self.distribution.package_dir:
            for name, path in self.distribution.package_dir.items():
                self.package_dir[name] = convert_path(path)
        self.data_files = self.get_data_files()

        # Ick, copied straight from install_lib.py (fancy_getopt needs a
        # type system!  Hell, *everything* needs a type system!!!)
        if not isinstance(self.optimize, int):
            try:
                self.optimize = int(self.optimize)
                assert 0 <= self.optimize <= 2
            except (ValueError, AssertionError):
                raise DistutilsOptionError("optimize must be 0, 1, or 2") 
开发者ID:glmcdona,项目名称:meddle,代码行数:26,代码来源:build_py.py

示例8: install_egg_scripts

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def install_egg_scripts(self, dist):
        if dist is not self.dist:
            # Installing a dependency, so fall back to normal behavior
            return easy_install.install_egg_scripts(self,dist)

        # create wrapper scripts in the script dir, pointing to dist.scripts

        # new-style...
        self.install_wrapper_scripts(dist)

        # ...and old-style
        for script_name in self.distribution.scripts or []:
            script_path = os.path.abspath(convert_path(script_name))
            script_name = os.path.basename(script_path)
            f = open(script_path,'rU')
            script_text = f.read()
            f.close()
            self.install_script(dist, script_name, script_text, script_path) 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:20,代码来源:develop.py

示例9: config_file

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def config_file(kind="local"):
    """Get the filename of the distutils, local, global, or per-user config

    `kind` must be one of "local", "global", or "user"
    """
    if kind=='local':
        return 'setup.cfg'
    if kind=='global':
        return os.path.join(
            os.path.dirname(distutils.__file__),'distutils.cfg'
        )
    if kind=='user':
        dot = os.name=='posix' and '.' or ''
        return os.path.expanduser(convert_path("~/%spydistutils.cfg" % dot))
    raise ValueError(
        "config_file() type must be 'local', 'global', or 'user'", kind
    ) 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:19,代码来源:setopt.py

示例10: exclude_data_files

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def exclude_data_files(self, package, src_dir, files):
        """Filter filenames for package's data files in 'src_dir'"""
        globs = (self.exclude_package_data.get('', [])
                 + self.exclude_package_data.get(package, []))
        bad = []
        for pattern in globs:
            bad.extend(
                fnmatch.filter(
                    files, os.path.join(src_dir, convert_path(pattern))
                )
            )
        bad = dict.fromkeys(bad)
        seen = {}
        return [
            f for f in files if f not in bad
                and f not in seen and seen.setdefault(f,1)  # ditch dupes
        ] 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:19,代码来源:build_py.py

示例11: _get_platform_patterns

# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import convert_path [as 别名]
def _get_platform_patterns(spec, package, src_dir):
        """
        yield platform-specific path patterns (suitable for glob
        or fn_match) from a glob-based spec (such as
        self.package_data or self.exclude_package_data)
        matching package in src_dir.
        """
        raw_patterns = itertools.chain(
            spec.get('', []),
            spec.get(package, []),
        )
        return (
            # Each pattern has to be converted to a platform-specific path
            os.path.join(src_dir, convert_path(pattern))
            for pattern in raw_patterns
        )


# from Python docs 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:21,代码来源:build_py.py


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