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


Python pkg_resources.parse_requirements方法代码示例

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


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

示例1: _move_install_requirements_markers

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def _move_install_requirements_markers(self):
        """
        Move requirements in `install_requires` that are using environment
        markers `extras_require`.
        """

        # divide the install_requires into two sets, simple ones still
        # handled by install_requires and more complex ones handled
        # by extras_require.

        def is_simple_req(req):
            return not req.marker

        spec_inst_reqs = getattr(self, 'install_requires', None) or ()
        inst_reqs = list(pkg_resources.parse_requirements(spec_inst_reqs))
        simple_reqs = filter(is_simple_req, inst_reqs)
        complex_reqs = filterfalse(is_simple_req, inst_reqs)
        self.install_requires = list(map(str, simple_reqs))

        for r in complex_reqs:
            self._tmp_extras_require[':' + str(r.marker)].append(r)
        self.extras_require = dict(
            (k, [str(r) for r in map(self._clean_req, v)])
            for k, v in self._tmp_extras_require.items()
        ) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:27,代码来源:dist.py

示例2: check_extras

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def check_extras(dist, attr, value):
    """Verify that extras_require mapping is valid"""
    try:
        for k,v in value.items():
            if ':' in k:
                k,m = k.split(':',1)
                if pkg_resources.invalid_marker(m):
                    raise DistutilsSetupError("Invalid environment marker: "+m)
            list(pkg_resources.parse_requirements(v))
    except (TypeError,ValueError,AttributeError):
        raise DistutilsSetupError(
            "'extras_require' must be a dictionary whose values are "
            "strings or lists of strings containing valid project/version "
            "requirement specifiers."
        ) 
开发者ID:jpush,项目名称:jbox,代码行数:17,代码来源:dist.py

示例3: check_requirements

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def check_requirements(dist, attr, value):
    """Verify that install_requires is a valid requirements list"""
    try:
        list(pkg_resources.parse_requirements(value))
    except (TypeError, ValueError) as error:
        tmpl = (
            "{attr!r} must be a string or list of strings "
            "containing valid project/version requirement specifiers; {error}"
        )
        raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) 
开发者ID:jpush,项目名称:jbox,代码行数:12,代码来源:dist.py

示例4: fetch_build_eggs

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def fetch_build_eggs(self, requires):
        """Resolve pre-setup requirements"""
        resolved_dists = pkg_resources.working_set.resolve(
            pkg_resources.parse_requirements(requires),
            installer=self.fetch_build_egg,
            replace_conflicting=True,
        )
        for dist in resolved_dists:
            pkg_resources.working_set.add(dist, replace=True) 
开发者ID:jpush,项目名称:jbox,代码行数:11,代码来源:dist.py

示例5: get_requirements

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def get_requirements():
    """Reads package dependencies."""
    with open('requirements.txt') as fp:
        return [str(r) for r in pkg_resources.parse_requirements(fp)] 
开发者ID:nvdv,项目名称:vprof,代码行数:6,代码来源:setup.py

示例6: check_extras

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def check_extras(dist, attr, value):
    """Verify that extras_require mapping is valid"""
    try:
        for k, v in value.items():
            if ':' in k:
                k, m = k.split(':', 1)
                if pkg_resources.invalid_marker(m):
                    raise DistutilsSetupError("Invalid environment marker: " + m)
            list(pkg_resources.parse_requirements(v))
    except (TypeError, ValueError, AttributeError):
        raise DistutilsSetupError(
            "'extras_require' must be a dictionary whose values are "
            "strings or lists of strings containing valid project/version "
            "requirement specifiers."
        ) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:17,代码来源:dist.py

示例7: fetch_build_eggs

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def fetch_build_eggs(self, requires):
        """Resolve pre-setup requirements"""
        resolved_dists = pkg_resources.working_set.resolve(
            pkg_resources.parse_requirements(requires),
            installer=self.fetch_build_egg,
            replace_conflicting=True,
        )
        for dist in resolved_dists:
            pkg_resources.working_set.add(dist, replace=True)
        return resolved_dists 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:12,代码来源:dist.py

示例8: check_requirements

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def check_requirements(dist, attr, value):
    """Verify that install_requires is a valid requirements list"""
    try:
        list(pkg_resources.parse_requirements(value))
    except (TypeError,ValueError):
        raise DistutilsSetupError(
            "%r must be a string or list of strings "
            "containing valid project/version requirement specifiers" % (attr,)
        ) 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:11,代码来源:dist.py

示例9: fetch_build_eggs

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def fetch_build_eggs(self, requires):
        """Resolve pre-setup requirements"""
        from pkg_resources import working_set, parse_requirements
        for dist in working_set.resolve(
            parse_requirements(requires), installer=self.fetch_build_egg,
            replace_conflicting=True
        ):
            working_set.add(dist, replace=True) 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:10,代码来源:dist.py

示例10: _check_extra

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def _check_extra(extra, reqs):
    name, sep, marker = extra.partition(':')
    if marker and pkg_resources.invalid_marker(marker):
        raise DistutilsSetupError("Invalid environment marker: " + marker)
    list(pkg_resources.parse_requirements(reqs)) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:7,代码来源:dist.py

示例11: check_requirements

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def check_requirements(dist, attr, value):
    """Verify that install_requires is a valid requirements list"""
    try:
        list(pkg_resources.parse_requirements(value))
        if isinstance(value, (dict, set)):
            raise TypeError("Unordered types are not allowed")
    except (TypeError, ValueError) as error:
        tmpl = (
            "{attr!r} must be a string or list of strings "
            "containing valid project/version requirement specifiers; {error}"
        )
        raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:14,代码来源:dist.py

示例12: _convert_extras_requirements

# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import parse_requirements [as 别名]
def _convert_extras_requirements(self):
        """
        Convert requirements in `extras_require` of the form
        `"extra": ["barbazquux; {marker}"]` to
        `"extra:{marker}": ["barbazquux"]`.
        """
        spec_ext_reqs = getattr(self, 'extras_require', None) or {}
        self._tmp_extras_require = defaultdict(list)
        for section, v in spec_ext_reqs.items():
            # Do not strip empty sections.
            self._tmp_extras_require[section]
            for r in pkg_resources.parse_requirements(v):
                suffix = self._suffix_for(r)
                self._tmp_extras_require[section + suffix].append(r) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:16,代码来源:dist.py


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