本文整理汇总了Python中setuptools_scm.get_version函数的典型用法代码示例。如果您正苦于以下问题:Python get_version函数的具体用法?Python get_version怎么用?Python get_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'
开发者ID:anthrotype,项目名称:setuptools_scm,代码行数:15,代码来源:test_regressions.py
示例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)
开发者ID:gh0std4ncer,项目名称:pyscaffold,代码行数:28,代码来源:integration.py
示例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))
开发者ID:anthrotype,项目名称:setuptools_scm,代码行数:31,代码来源:setup.py
示例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))
开发者ID:pobot-pybot,项目名称:pybot-fabric,代码行数:7,代码来源:fabtasks.py
示例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)
开发者ID:dremio,项目名称:arrow,代码行数:8,代码来源:crossbow.py
示例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))
开发者ID:pobot-pybot,项目名称:pybot-fabric,代码行数:10,代码来源:fabtasks.py
示例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)
开发者ID:kynan,项目名称:pyscaffold,代码行数:15,代码来源:setup.py
示例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')}
开发者ID:h0arry,项目名称:pyscaffold,代码行数:20,代码来源:integration.py
示例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/')
开发者ID:obitec,项目名称:dstack-tasks,代码行数:37,代码来源:tasks.py
示例10: set_version
def set_version(self):
from setuptools_scm import get_version
self.release = get_version()
self.version = self.release.split("-", 1)[0]
开发者ID:brean,项目名称:txtrpacker,代码行数:5,代码来源:setup.py
示例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'
开发者ID:XD-embedded,项目名称:xd-docker,代码行数:31,代码来源:conf.py
示例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')
开发者ID:brian-team,项目名称:brian2tools,代码行数:30,代码来源:setup.py
示例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
开发者ID:p-chambers,项目名称:occ_airconics,代码行数:13,代码来源:set_pkg_version.py
示例14: version
def version(self):
__tracebackhide__ = True
from setuptools_scm import get_version
version = get_version(root=str(self.cwd))
print(version)
return version
开发者ID:Jallasia,项目名称:setuptools_scm,代码行数:6,代码来源:conftest.py
示例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__)
开发者ID:wurstmineberg,项目名称:api.wurstmineberg.de,代码行数:9,代码来源:version.py
示例16: get_version
# Default version file -- DO NOT CHANGE, gets overwritten by setuptools_scm
from setuptools_scm import get_version
version = get_version()
开发者ID:sr735,项目名称:slackmoji,代码行数:5,代码来源:_version.py
示例17: run
def run(self):
from setuptools_scm import get_version
print('Current version is: ' + get_version(root='.', relative_to=__file__))
开发者ID:tylerbutler,项目名称:propane,代码行数:4,代码来源:setup.py
示例18: get_version
master_doc = 'index'
# General information about the project.
project = 'cjktools'
copyright = '2016, Lars Yencken'
author = 'Lars Yencken'
# 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
# The full version, including alpha/beta/rc tags.
release = get_version(root='../..')
# 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.
开发者ID:larsyencken,项目名称:cjktools,代码行数:31,代码来源:conf.py
示例19: Config
conf = Config()
env = Environment(config=conf, prefix='')
env.load()
# Global config
env.log_level = logging.INFO
env.pwd = os.getcwd()
env.src = os.path.join(env.pwd, 'src')
env.directory = os.path.basename(env.pwd)
env.remote = False
env.dry_run = False
# Attempt to get a version number
try:
# env.version = get_version(root='.', relative_to=env.pwd)
env.version = get_version()
except LookupError:
try:
with open(os.path.join(env.src, 'version.txt')) as f:
env.version = f.readline().strip()
except FileNotFoundError:
env.version = os.getenv('VERSION', '0.0.0-dev')
env.tag = env.version
LOCAL_PREFIX = colorama.Fore.YELLOW + '[local]' + colorama.Fore.RESET
REMOTE_PREFIX = colorama.Fore.RED + '[remote]' + colorama.Fore.RESET
@task
def t1(ctx):
开发者ID:obitec,项目名称:dstack-tasks,代码行数:31,代码来源:base.py
示例20: print
from setuptools import setup, Extension
use_setuptools = True
print("setuptools is used.")
except ImportError:
from distutils.core import setup, Extension
use_setuptools = False
print("distutils is used.")
try:
from setuptools_scm import get_version
except ImportError:
git_num = None
if 'setuptools_scm' in sys.modules.keys():
try:
git_ver = get_version()
git_num = int(git_ver.split('.')[3].split('+')[0].replace("dev", ""))
except:
git_num = None
include_dirs_numpy = [numpy.get_include()]
cc = None
if 'CC' in os.environ:
if 'clang' in os.environ['CC']:
cc = 'clang'
if 'gcc' in os.environ['CC']:
cc = 'gcc'
# Workaround Python issue 21121
config_var = sysconfig.get_config_var("CFLAGS")
开发者ID:atztogo,项目名称:phonopy,代码行数:31,代码来源:setup.py
注:本文中的setuptools_scm.get_version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论