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


Python setuptools_scm.get_version方法代码示例

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


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

示例1: get_version

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def get_version() -> Version:
    if devmode.is_in_dev_mode():
        if pkg_resources is None:
            raise MetadataError(
                'cannot determine build version: no pkg_resources module')
        if setuptools_scm is None:
            raise MetadataError(
                'cannot determine build version: no setuptools_scm module')
        version = setuptools_scm.get_version(
            root='../..', relative_to=__file__)
        pv = pkg_resources.parse_version(version)
        version = parse_version(pv)
    else:
        vertuple: List[Any] = list(get_build_metadata_value('VERSION'))
        vertuple[2] = VersionStage(vertuple[2])
        version = Version(*vertuple)

    return version 
开发者ID:edgedb,项目名称:edgedb,代码行数:20,代码来源:buildmeta.py

示例2: get_version_dict

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def get_version_dict() -> immu.Map[str, Any]:
    global _version_dict

    if _version_dict is None:
        ver = get_version()
        _version_dict = immu.Map({
            'major': ver.major,
            'minor': ver.minor,
            'stage': ver.stage.name.lower(),
            'stage_no': ver.stage_no,
            'local': tuple(ver.local) if ver.local else (),
        })

    return _version_dict 
开发者ID:edgedb,项目名称:edgedb,代码行数:16,代码来源:buildmeta.py

示例3: main

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def main():
    _warn_if_setuptools_outdated()
    print("Guessed Version", get_version())
    if "ls" in sys.argv:
        for fname in find_files("."):
            print(fname) 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:8,代码来源:__main__.py

示例4: test_version_from_pkginfo

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def test_version_from_pkginfo(wd, monkeypatch):
    wd.write("PKG-INFO", "Version: 0.1")

    assert wd.version == "0.1"

    # replicate issue 167
    assert wd.get_version(version_scheme="1.{0.distance}.0".format) == "0.1" 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:9,代码来源:test_basic_api.py

示例5: test_root_parameter_creation

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def test_root_parameter_creation(monkeypatch):
    assert_root(monkeypatch, os.getcwd())
    setuptools_scm.get_version() 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:5,代码来源:test_basic_api.py

示例6: test_root_parameter_pass_by

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def test_root_parameter_pass_by(monkeypatch, tmpdir):
    assert_root(monkeypatch, tmpdir)
    setuptools_scm.get_version(root=tmpdir.strpath) 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:5,代码来源:test_basic_api.py

示例7: test_pretended

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def test_pretended(version, monkeypatch):
    monkeypatch.setenv(setuptools_scm.PRETEND_KEY, version)
    assert setuptools_scm.get_version() == version 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:5,代码来源:test_basic_api.py

示例8: test_parse_plain_fails

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def test_parse_plain_fails(recwarn):
    def parse(root):
        return "tricked you"

    with pytest.raises(TypeError):
        setuptools_scm.get_version(parse=parse) 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:8,代码来源:test_basic_api.py

示例9: get_version

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def get_version(self, **kw):
        __tracebackhide__ = True
        from setuptools_scm import get_version

        version = get_version(root=str(self.cwd), fallback_root=str(self.cwd), **kw)
        print(version)
        return version 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:9,代码来源:conftest.py

示例10: version

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def version(self):
        __tracebackhide__ = True
        return self.get_version() 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:5,代码来源:conftest.py

示例11: test_pip_egg_info

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def test_pip_egg_info(tmpdir, monkeypatch):
    """if we are indeed a sdist, the root does not apply"""

    # we should get the version from pkg-info if git is broken
    p = tmpdir.ensure("sub/package", dir=1)
    tmpdir.mkdir(".git")
    p.join("setup.py").write(
        "from setuptools import setup;" 'setup(use_scm_version={"root": ".."})'
    )

    with pytest.raises(LookupError):
        get_version(root=p.strpath, fallback_root=p.strpath)

    p.ensure("pip-egg-info/random.egg-info/PKG-INFO").write("Version: 1.0")
    assert get_version(root=p.strpath, fallback_root=p.strpath) == "1.0" 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:17,代码来源:test_regressions.py

示例12: scm_config

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def scm_config():
    here = os.path.dirname(os.path.abspath(__file__))
    src = os.path.join(here, "src")
    egg_info = os.path.join(src, "setuptools_scm.egg-info")
    has_entrypoints = os.path.isdir(egg_info)
    import pkg_resources

    sys.path.insert(0, src)
    pkg_resources.working_set.add_entry(src)
    # FIXME: remove debug
    print(src)
    print(pkg_resources.working_set)
    from setuptools_scm.hacks import parse_pkginfo
    from setuptools_scm.git import parse as parse_git
    from setuptools_scm.version import guess_next_dev_version, get_local_node_and_date

    def parse(root):
        try:
            return parse_pkginfo(root)
        except IOError:
            return parse_git(root)

    config = dict(
        version_scheme=guess_next_dev_version, local_scheme=get_local_node_and_date
    )

    if has_entrypoints:
        return dict(use_scm_version=config)
    else:
        from setuptools_scm import get_version

        return dict(version=get_version(root=here, parse=parse, **config)) 
开发者ID:pypa,项目名称:setuptools_scm,代码行数:34,代码来源:setup.py

示例13: main

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def main():
    _warn_if_setuptools_outdated()
    print('Guessed Version', get_version())
    if 'ls' in sys.argv:
        for fname in find_files('.'):
            print(fname) 
开发者ID:thomaxxl,项目名称:safrs,代码行数:8,代码来源:__main__.py

示例14: local_version

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def local_version(version):
    """
    Patch in a version that can be uploaded to test PyPI
    """
    scm_version = get_version()
    if "dev" in scm_version:
        gh_in_int = []
        for char in version.node:
            if char.isdigit():
                gh_in_int.append(str(char))
            else:
                gh_in_int.append(str(string.ascii_letters.find(char)))
        return "".join(gh_in_int)
    else:
        return "" 
开发者ID:yeatmanlab,项目名称:pyAFQ,代码行数:17,代码来源:setup.py

示例15: get_version_from_scm_tag

# 需要导入模块: import setuptools_scm [as 别名]
# 或者: from setuptools_scm import get_version [as 别名]
def get_version_from_scm_tag(
        *,
        root: str = '.',
        relative_to: Optional[str] = None,
        local_scheme: Union[Callable, str] = 'node-and-date',
) -> str:
    """Retrieve the version from SCM tag in Git or Hg."""
    try:
        return get_version(
            root=root,
            relative_to=relative_to,
            local_scheme=local_scheme,
        )
    except LookupError:
        return 'unknown' 
开发者ID:aio-libs,项目名称:create-aio-app,代码行数:17,代码来源:versiontools.py


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