本文整理汇总了Python中setuptools_scm.get_version函数的典型用法代码示例。如果您正苦于以下问题:Python get_version函数的具体用法?Python get_version怎么用?Python get_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pip_egg_info
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)
p.ensure('pip-egg-info/random.egg-info/PKG-INFO').write('Version: 1.0')
assert get_version(root=p.strpath) == '1.0'
示例2: pyscaffold_keyword
def pyscaffold_keyword(dist, keyword, value):
"""
Handles the `use_pyscaffold` keyword of the setup(...) command
:param dist: distribution object as :obj:`setuptools.dist`
:param keyword: keyword argument = 'use_pyscaffold'
:param value: value of the keyword argument
"""
check_setuptools_version()
if value:
# If value is a dictionary we keep it otherwise use for configuration
value = value if isinstance(value, dict) else dict()
command_options = dist.command_options.copy()
cmdclass = dist.cmdclass.copy()
deactivate_pbr_authors_changelog()
read_setup_cfg(dist, keyword, True)
try:
dist.metadata.version = get_version(
version_scheme=value.get('version_scheme', version2str),
local_scheme=value.get('local_scheme', local_version2str))
except Exception as e:
trace('error', e)
# Adding old command classes and options since pbr seems to drop these
dist.cmdclass['doctest'] = build_cmd_docs()
dist.command_options['doctest'] = {'builder': ('setup.py', 'doctest')}
dist.cmdclass['test'] = PyTest
dist.cmdclass.update(cmdclass)
dist.cmdclass.update(command_options)
示例3: scm_config
def scm_config():
here = os.path.dirname(os.path.abspath(__file__))
egg_info = os.path.join(here, 'setuptools_scm.egg-info')
has_entrypoints = os.path.isdir(egg_info)
sys.path.insert(0, here)
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))
示例4: inc_version_major
def inc_version_major(pkg='.'):
""" Increment the version major number """
with lcd(pkg):
major, _ = get_version().split('.', 1)
major = int(major) + 1
tag = "%d.0.0" % major
local('git tag %s -am "%s"' % (tag, tag))
示例5: from_repo
def from_repo(cls, repo):
assert isinstance(repo, Repo)
version = get_version(repo.path, local_scheme=lambda v: '')
return cls(head=str(repo.head.target),
email=repo.email,
branch=repo.branch.branch_name,
remote=repo.remote_url,
version=version)
示例6: inc_version_build
def inc_version_build(pkg='.'):
""" Increment the version build (aka patch) number """
with lcd(pkg):
major, minor, build_num, dirty = (get_version().split('.') + [''])[:4]
if dirty.startswith('dev'):
build_num = int(build_num)
else:
build_num = int(build_num) + 1
tag = "%s.%s.%d" % (major, minor, build_num)
local('git tag %s -am "%s"' % (tag, tag))
示例7: make_release_tree
def make_release_tree(self, base_dir, files):
sdist_orig.make_release_tree(self, base_dir, files)
target = os.path.join(base_dir, "setup.py")
with open(__file__) as fp:
template = fp.read()
ver = self.distribution.version
if not ver:
from setuptools_scm import get_version
ver = get_version(**scm_config())
finalized = template.replace("use_scm_version=scm_config,\n", 'version="%s",\n' % ver)
os.remove(target)
with open(target, "w") as fp:
fp.write(finalized)
示例8: pyscaffold_keyword
def pyscaffold_keyword(dist, keyword, value):
"""
Handles the `use_pyscaffold` keyword of the setup(...) command
:param dist: distribution object as :obj:`setuptools.dist`
:param keyword: keyword argument = 'use_pyscaffold'
:param value: value of the keyword argument
"""
_warn_if_setuptools_outdated()
if value is True:
deactivate_pbr_authors_changelog()
read_setup_cfg(dist, keyword, value)
try:
dist.metadata.version = get_version(version_scheme=version2str,
local_scheme=local_version2str)
except Exception as e:
trace('error', e)
# Adding doctest again since PBR seems to drop these
dist.cmdclass['doctest'] = build_cmd_docs()
dist.command_options['doctest'] = {'builder': ('setup.py', 'doctest')}
示例9: release_code
def release_code(ctx, project_name=None, version=None, upload=True, push=False, static=True, build=True):
"""Tag, build and optionally push and upload new project release
"""
# TODO set project name in ctx
project_name = project_name or os.path.basename(os.getcwd()).replace('-', '_')
scm_version = get_version()
version = version or '.'.join(scm_version.split('.')[:3])
if build:
print(f'Git version: {scm_version}')
if len(scm_version.split('.')) > 4:
print('First commit all changes, then run this task again')
return False
if scm_version != version:
git(ctx, f'tag v{version}')
# Clean and build
do(ctx, cmd='rm -rf build/')
python(ctx, cmd='setup.py bdist_wheel', conda_env=True)
if push:
git(ctx, f'push origin v{version}')
if upload:
s3cmd(ctx,
simple_path=f'dist/{project_name}-{version}-py3-none-any.whl', direction='up', project_name=project_name)
if static:
excludes = '--exclude=' + ' --exclude='.join(['"*.less"', '"*.md"', '"ckeditor/"'])
do(ctx, f'webpack', path='src/assets/')
python(ctx, f'./src/manage.py collectstatic --no-input -v0', conda_env=True)
# do(ctx, f'rm -rf .local/static/ckeditor/')
if upload:
do(ctx, f'tar -zcvf .local/static_v{version}.tar.gz {excludes} -C .local/static/ .')
s3cmd(ctx, local_path=f'.local/static_v{version}.tar.gz', s3_path=f'{project_name}/static/')
示例10: set_version
def set_version(self):
from setuptools_scm import get_version
self.release = get_version()
self.version = self.release.split("-", 1)[0]
示例11: get_version
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'XD Docker'
copyright = '2016, Esben Haabendal'
author = 'Esben Haabendal'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
from setuptools_scm import get_version
from setuptools_scm.version import postrelease_version
# The full version, including alpha/beta/rc tags.
release = get_version('..', version_scheme=postrelease_version)
# The short X.Y version.
version = '.'.join(release.split('.')[:2])
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
示例12: get_version
'setuptools',
'setuptools_scm'],
provides=['brian2tools'],
extras_require={'test': ['pytest'],
'docs': ['sphinx>=1.0.1', 'sphinxcontrib-issuetracker',
'mock']},
use_2to3=False,
description='Tools for the Brian 2 simulator',
long_description=readme(),
author='Marcel Stimberg, Dan Goodman, Romain Brette',
author_email='[email protected]',
license='CeCILL-2.1',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
keywords='visualization neuroscience'
)
# If we are building a conda package, we write the version number to a file
if 'CONDA_BUILD' in os.environ and 'RECIPE_DIR' in os.environ:
from setuptools_scm import get_version
get_version(write_to='__conda_version__.txt')
示例13: get_version
# -*- coding: utf-8 -*-
# @Author: p-chambers
# @Date: 2016-10-05 14:35:02
# @Last Modified by: p-chambers
# @Last Modified time: 2016-10-05 15:30:29
import os
from setuptools_scm import get_version
version = get_version(root=os.path.join('..', '..'), relative_to=__file__)
os.environ['OCC_AIRCONICS_VERSION'] = version
示例14: version
def version(self):
__tracebackhide__ = True
from setuptools_scm import get_version
version = get_version(root=str(self.cwd))
print(version)
return version
示例15: get_version
import contextlib
__version__ = None
try:
from api._version import version as __version__
except ImportError:
with contextlib.suppress(ImportError, LookupError):
from setuptools_scm import get_version
__version__ = get_version(root='..', relative_to=__file__)