setuptools_scm-1.15.6/0000755000175000017500000000000013120557375015541 5ustar travistravis00000000000000setuptools_scm-1.15.6/setuptools_scm/0000755000175000017500000000000013120557375020624 5ustar travistravis00000000000000setuptools_scm-1.15.6/setuptools_scm/__init__.py0000644000175000017500000001006113120557347022732 0ustar travistravis00000000000000""" :copyright: 2010-2015 by Ronny Pfannschmidt :license: MIT """ import os import sys import warnings from .utils import trace from .version import format_version, meta, ScmVersion from .discover import iter_matching_entrypoints PRETEND_KEY = 'SETUPTOOLS_SCM_PRETEND_VERSION' TEMPLATES = { '.py': """\ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = {version!r} """, '.txt': '{version}', } PY3 = sys.version_info > (3,) string_types = (str,) if PY3 else (str, unicode) # noqa def version_from_scm(root): return _version_from_entrypoint(root, 'setuptools_scm.parse_scm') def _version_from_entrypoint(root, entrypoint): for ep in iter_matching_entrypoints(root, entrypoint): version = ep.load()(root) if version: return version def dump_version(root, version, write_to, template=None): assert isinstance(version, string_types) if not write_to: return target = os.path.normpath(os.path.join(root, write_to)) ext = os.path.splitext(target)[1] template = template or TEMPLATES.get(ext) if template is not None: dump = template.format(version=version) else: raise ValueError(( "bad file format: '%s' (of %s) \n" "only *.txt and *.py are supported") % ( os.path.splitext(target)[1], target )) with open(target, 'w') as fp: fp.write(dump) def _do_parse(root, parse): pretended = os.environ.get(PRETEND_KEY) if pretended: # we use meta here since the pretended version # must adhere to the pep to begin with return meta(pretended) if parse: parse_result = parse(root) if isinstance(parse_result, string_types): warnings.warn( "version parse result was a string\n" "please return a parsed version", category=DeprecationWarning) # we use ScmVersion here in order to keep legacy code working # for 2.0 we should use meta parse_result = ScmVersion(parse_result) version = parse_result or _version_from_entrypoint( root, 'setuptools_scm.parse_scm_fallback') else: # include fallbacks after dropping them from the main entrypoint version = version_from_scm(root) or _version_from_entrypoint( root, 'setuptools_scm.parse_scm_fallback') if version: return version raise LookupError( "setuptools-scm was unable to detect version for %r.\n\n" "Make sure you're either building from a fully intact git repository " "or PyPI tarballs. Most other sources (such as GitHub's tarballs, a " "git checkout without the .git folder) don't contain the necessary " "metadata and will not work.\n\n" "For example, if you're using pip, instead of " "https://github.com/user/proj/archive/master.zip " "use git+https://github.com/user/proj.git#egg=proj" % root) def get_version(root='.', version_scheme='guess-next-dev', local_scheme='node-and-date', write_to=None, write_to_template=None, relative_to=None, parse=None, ): """ If supplied, relative_to should be a file from which root may be resolved. Typically called by a script or module that is not in the root of the repository to direct setuptools_scm to the root of the repository by supplying ``__file__``. """ if relative_to: root = os.path.join(os.path.dirname(relative_to), root) root = os.path.abspath(root) trace('root', repr(root)) parsed_version = _do_parse(root, parse) if parsed_version: version_string = format_version( parsed_version, version_scheme=version_scheme, local_scheme=local_scheme) dump_version( root=root, version=version_string, write_to=write_to, template=write_to_template) return version_string setuptools_scm-1.15.6/setuptools_scm/__main__.py0000644000175000017500000000061513120557347022717 0ustar travistravis00000000000000from __future__ import print_function import sys from setuptools_scm import get_version from setuptools_scm.integration import find_files from setuptools_scm.version import _warn_if_setuptools_outdated if __name__ == '__main__': _warn_if_setuptools_outdated() print('Guessed Version', get_version()) if 'ls' in sys.argv: for fname in find_files('.'): print(fname) setuptools_scm-1.15.6/setuptools_scm/discover.py0000644000175000017500000000064013120557347023013 0ustar travistravis00000000000000import os from pkg_resources import iter_entry_points from .utils import trace def iter_matching_entrypoints(path, entrypoint): trace('looking for ep', entrypoint, path) for ep in iter_entry_points(entrypoint): if os.path.exists(os.path.join(path, ep.name)): if os.path.isabs(ep.name): trace('ignoring bad ep', ep) trace('found ep', ep) yield ep setuptools_scm-1.15.6/setuptools_scm/git.py0000644000175000017500000000611713120557347021765 0ustar travistravis00000000000000from .utils import do_ex, trace, has_command from .version import meta from os.path import abspath, normcase, realpath, isfile, join import warnings FILES_COMMAND = 'git ls-files' DEFAULT_DESCRIBE = 'git describe --dirty --tags --long --match *.*' def _normalized(path): return normcase(abspath(realpath(path))) class GitWorkdir(object): """experimental, may change at any time""" def __init__(self, path): self.path = path def do_ex(self, cmd): return do_ex(cmd, cwd=self.path) @classmethod def from_potential_worktree(cls, wd): real_wd, _, ret = do_ex('git rev-parse --show-toplevel', wd) if ret: return trace('real root', real_wd) if _normalized(real_wd) != _normalized(wd): return return cls(real_wd) def is_dirty(self): out, _, _ = self.do_ex("git status --porcelain --untracked-files=no") return bool(out) def is_shallow(self): return isfile(join(self.path, '.git/shallow')) def fetch_shallow(self): self.do_ex("git fetch --unshallow") def node(self): rev_node, _, ret = self.do_ex('git rev-parse --verify --quiet HEAD') if not ret: return rev_node[:7] def count_all_nodes(self): revs, _, _ = self.do_ex('git rev-list HEAD') return revs.count('\n') + 1 def warn_on_shallow(wd): """experimental, may change at any time""" if wd.is_shallow(): warnings.warn('"%s" is shallow and may cause errors' % (wd.path,)) def fetch_on_shallow(wd): """experimental, may change at any time""" if wd.is_shallow(): warnings.warn('"%s" was shallow, git fetch was used to rectify') wd.fetch_shallow() def fail_on_shallow(wd): """experimental, may change at any time""" if wd.is_shallow(): raise ValueError( '%r is shallow, please correct with ' '"git fetch --unshallow"' % wd.path) def parse(root, describe_command=DEFAULT_DESCRIBE, pre_parse=warn_on_shallow): """ :param pre_parse: experimental pre_parse action, may change at any time """ if not has_command('git'): return wd = GitWorkdir.from_potential_worktree(root) if wd is None: return if pre_parse: pre_parse(wd) out, err, ret = do_ex(describe_command, root) if ret: # If 'git describe' failed, try to get the information otherwise. rev_node = wd.node() dirty = wd.is_dirty() if rev_node is None: return meta('0.0', distance=0, dirty=dirty) return meta( '0.0', distance=wd.count_all_nodes(), node='g' + rev_node, dirty=dirty, ) # 'out' looks e.g. like 'v1.5.0-0-g4060507' or # 'v1.15.1rc1-37-g9bd1298-dirty'. if out.endswith('-dirty'): dirty = True out = out[:-6] else: dirty = False tag, number, node = out.rsplit('-', 2) number = int(number) if number: return meta(tag, distance=number, node=node, dirty=dirty) else: return meta(tag, node=node, dirty=dirty) setuptools_scm-1.15.6/setuptools_scm/hacks.py0000644000175000017500000000115113120557347022264 0ustar travistravis00000000000000import os from .utils import data_from_mime, trace from .version import meta def parse_pkginfo(root): pkginfo = os.path.join(root, 'PKG-INFO') trace('pkginfo', pkginfo) data = data_from_mime(pkginfo) version = data.get('Version') if version != 'UNKNOWN': return meta(version, preformatted=True) def parse_pip_egg_info(root): pipdir = os.path.join(root, 'pip-egg-info') if not os.path.isdir(pipdir): return items = os.listdir(pipdir) trace('pip-egg-info', pipdir, items) if not items: return return parse_pkginfo(os.path.join(pipdir, items[0])) setuptools_scm-1.15.6/setuptools_scm/hg.py0000644000175000017500000000436413120557347021602 0ustar travistravis00000000000000import os from .utils import do, trace, data_from_mime, has_command from .version import meta, tags_to_versions FILES_COMMAND = 'hg locate -I .' def _hg_tagdist_normalize_tagcommit(root, tag, dist, node): dirty = node.endswith('+') node = 'h' + node.strip('+') revset = ("(branch(.) and tag({tag!r})::. and file('re:^(?!\.hgtags).*$')" " - tag({tag!r}))").format(tag=tag) if tag != '0.0': commits = do(['hg', 'log', '-r', revset, '--template', '{node|short}'], root) else: commits = True trace('normalize', locals()) if commits or dirty: return meta(tag, distance=dist, node=node, dirty=dirty) else: return meta(tag) def parse(root): if not has_command('hg'): return l = do('hg id -i -t', root).split() if not l: return node = l.pop(0) tags = tags_to_versions(l) # filter tip in degraded mode on old setuptools tags = [x for x in tags if x != 'tip'] dirty = node[-1] == '+' if tags: return meta(tags[0], dirty=dirty) if node.strip('+') == '0'*12: trace('initial node', root) return meta('0.0', dirty=dirty) # the newline is needed for merge stae, see issue 72 cmd = 'hg parents --template "{latesttag} {latesttagdistance}\n"' out = do(cmd, root) try: # in merge state we assume parent 1 is fine tags, dist = out.splitlines()[0].split() # pick latest tag from tag list tag = tags.split(':')[-1] if tag == 'null': tag = '0.0' dist = int(dist) + 1 return _hg_tagdist_normalize_tagcommit(root, tag, dist, node) except ValueError: pass # unpacking failed, old hg def archival_to_version(data): trace('data', data) node = data.get('node', '')[:12] if node: node = 'h' + node if 'tag' in data: return meta(data['tag']) elif 'latesttag' in data: return meta(data['latesttag'], distance=data['latesttagdistance'], node=node) else: return meta('0.0', node=node) def parse_archival(root): archival = os.path.join(root, '.hg_archival.txt') data = data_from_mime(archival) return archival_to_version(data) setuptools_scm-1.15.6/setuptools_scm/integration.py0000644000175000017500000000234213120557347023521 0ustar travistravis00000000000000import os from .version import _warn_if_setuptools_outdated from .utils import do from .discover import iter_matching_entrypoints from . import get_version def version_keyword(dist, keyword, value): _warn_if_setuptools_outdated() if not value: return if value is True: value = {} if getattr(value, '__call__', None): value = value() # this piece of code is a hack to counter the mistake in root finding matching_fallbacks = iter_matching_entrypoints( '.', 'setuptools_scm.parse_scm_fallback') if any(matching_fallbacks): value.pop('root', None) dist.metadata.version = get_version(**value) def find_files(path='.'): if not path: path = '.' abs = os.path.abspath(path) ep = next(iter_matching_entrypoints( abs, 'setuptools_scm.files_command'), None) if ep: command = ep.load() try: if isinstance(command, str): return do(ep.load(), path).splitlines() else: return command(path) except Exception: import traceback print("File Finder Failed for %s" % ep) traceback.print_exc() return [] else: return [] setuptools_scm-1.15.6/setuptools_scm/utils.py0000644000175000017500000000451113120557347022336 0ustar travistravis00000000000000""" utils """ from __future__ import print_function, unicode_literals import warnings import sys import shlex import subprocess import os import io import platform DEBUG = bool(os.environ.get("SETUPTOOLS_SCM_DEBUG")) def trace(*k): if DEBUG: print(*k) sys.stdout.flush() def ensure_stripped_str(str_or_bytes): if isinstance(str_or_bytes, str): return str_or_bytes.strip() else: return str_or_bytes.decode('utf-8', 'surogate_escape').strip() def _always_strings(env_dict): """ On Windows and Python 2, environment dictionaries must be strings and not unicode. """ is_windows = platform.system == 'Windows' PY2 = sys.version_info < (3,) if is_windows or PY2: env_dict.update( (key, str(value)) for (key, value) in env_dict.items() ) return env_dict def _popen_pipes(cmd, cwd): return subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=str(cwd), env=_always_strings(dict( os.environ, # try to disable i18n LC_ALL='C', LANGUAGE='', HGPLAIN='1', )) ) def do_ex(cmd, cwd='.'): trace('cmd', repr(cmd)) if not isinstance(cmd, (list, tuple)): cmd = shlex.split(cmd) p = _popen_pipes(cmd, cwd) out, err = p.communicate() if out: trace('out', repr(out)) if err: trace('err', repr(err)) if p.returncode: trace('ret', p.returncode) return ensure_stripped_str(out), ensure_stripped_str(err), p.returncode def do(cmd, cwd='.'): out, err, ret = do_ex(cmd, cwd) if ret: print(err) return out def data_from_mime(path): with io.open(path, encoding='utf-8') as fp: content = fp.read() trace('content', repr(content)) # the complex conditions come from reading pseudo-mime-messages data = dict( x.split(': ', 1) for x in content.splitlines() if ': ' in x) trace('data', data) return data def has_command(name): try: p = _popen_pipes([name, 'help'], '.') except OSError: trace(*sys.exc_info()) res = False else: p.communicate() res = not p.returncode if not res: warnings.warn("%r was not found" % name) return res setuptools_scm-1.15.6/setuptools_scm/version.py0000644000175000017500000001151313120557347022663 0ustar travistravis00000000000000from __future__ import print_function import datetime import warnings import re from .utils import trace from pkg_resources import iter_entry_points from distutils import log try: from pkg_resources import parse_version, SetuptoolsVersion except ImportError as e: parse_version = SetuptoolsVersion = None def _warn_if_setuptools_outdated(): if parse_version is None: log.warn("your setuptools is too old (<12)") log.warn("setuptools_scm functionality is degraded") def callable_or_entrypoint(group, callable_or_name): trace('ep', (group, callable_or_name)) if isinstance(callable_or_name, str): for ep in iter_entry_points(group, callable_or_name): trace("ep found:", ep.name) return ep.load() else: return callable_or_name def tag_to_version(tag): trace('tag', tag) if '+' in tag: warnings.warn("tag %r will be stripped of the local component" % tag) tag = tag.split('+')[0] # lstrip the v because of py2/py3 differences in setuptools # also required for old versions of setuptools version = tag.rsplit('-', 1)[-1].lstrip('v') if parse_version is None: return version version = parse_version(version) trace('version', repr(version)) if isinstance(version, SetuptoolsVersion): return version def tags_to_versions(tags): versions = map(tag_to_version, tags) return [v for v in versions if v is not None] class ScmVersion(object): def __init__(self, tag_version, distance=None, node=None, dirty=False, preformatted=False, **kw): if kw: trace("unknown args", kw) self.tag = tag_version if dirty and distance is None: distance = 0 self.distance = distance self.node = node self.time = datetime.datetime.now() self.extra = kw self.dirty = dirty self.preformatted = preformatted @property def exact(self): return self.distance is None def __repr__(self): return self.format_with( '') def format_with(self, fmt): return fmt.format( time=self.time, tag=self.tag, distance=self.distance, node=self.node, dirty=self.dirty, extra=self.extra) def format_choice(self, clean_format, dirty_format): return self.format_with(dirty_format if self.dirty else clean_format) def _parse_tag(tag, preformatted): if preformatted: return tag if SetuptoolsVersion is None or not isinstance(tag, SetuptoolsVersion): tag = tag_to_version(tag) return tag def meta(tag, distance=None, dirty=False, node=None, preformatted=False, **kw): tag = _parse_tag(tag, preformatted) trace('version', tag) assert tag is not None, 'cant parse version %s' % tag return ScmVersion(tag, distance, node, dirty, preformatted, **kw) def guess_next_version(tag_version, distance): version = _strip_local(str(tag_version)) bumped = _bump_dev(version) or _bump_regex(version) suffix = '.dev%s' % distance return bumped + suffix def _strip_local(version_string): public, sep, local = version_string.partition('+') return public def _bump_dev(version): if '.dev' not in version: return prefix, tail = version.rsplit('.dev', 1) assert tail == '0', 'own dev numbers are unsupported' return prefix def _bump_regex(version): prefix, tail = re.match('(.*?)(\d+)$', version).groups() return '%s%d' % (prefix, int(tail) + 1) def guess_next_dev_version(version): if version.exact: return version.format_with("{tag}") else: return guess_next_version(version.tag, version.distance) def get_local_node_and_date(version): if version.exact or version.node is None: return version.format_choice("", "+d{time:%Y%m%d}") else: return version.format_choice("+{node}", "+{node}.d{time:%Y%m%d}") def get_local_dirty_tag(version): return version.format_choice('', '+dirty') def postrelease_version(version): if version.exact: return version.format_with('{tag}') else: return version.format_with('{tag}.post{distance}') def format_version(version, **config): trace('scm version', version) trace('config', config) if version.preformatted: return version.tag version_scheme = callable_or_entrypoint( 'setuptools_scm.version_scheme', config['version_scheme']) local_scheme = callable_or_entrypoint( 'setuptools_scm.local_scheme', config['local_scheme']) main_version = version_scheme(version) trace('version', main_version) local_version = local_scheme(version) trace('local_version', local_version) return version_scheme(version) + local_scheme(version) setuptools_scm-1.15.6/setuptools_scm.egg-info/0000755000175000017500000000000013120557375022316 5ustar travistravis00000000000000setuptools_scm-1.15.6/setuptools_scm.egg-info/PKG-INFO0000644000175000017500000003057113120557375023421 0ustar travistravis00000000000000Metadata-Version: 1.1 Name: setuptools-scm Version: 1.15.6 Summary: the blessed package to manage your versions by scm tags Home-page: https://github.com/pypa/setuptools_scm/ Author: Ronny Pfannschmidt Author-email: opensource@ronnypfannschmidt.de License: MIT Description: setuptools_scm =============== :code:`setuptools_scm` handles managing your python package versions in scm metadata instead of declaring them as the version argument or in a scm managed file. It also handles file finders for the supported scm's. .. image:: https://travis-ci.org/pypa/setuptools_scm.svg?branch=master :target: https://travis-ci.org/pypa/setuptools_scm Setup.py usage -------------- To use setuptools_scm just modify your project's setup.py file like this: 1. Add :code:`'setuptools_scm'` to the :code:`setup_requires` parameter 2. Add the :code:`use_scm_version` parameter and set it to ``True`` E.g.: .. code:: python from setuptools import setup setup( ..., use_scm_version=True, setup_requires=['setuptools_scm'], ..., ) Arguments to ``get_version()`` (see below) may be passed as a dictionary to ``use_scm_version``. For example: .. code:: python from setuptools import setup setup( ..., use_scm_version = {"root": "..", "relative_to": __file__}, setup_requires=['setuptools_scm'], ..., ) 3. Access the version number in your package via :code:`pkg_resources` E.g. (`PEP-0396 `_): .. code:: python from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution(__name__).version except DistributionNotFound: # package is not installed pass Programmatic usage ------------------ In order to use ``setuptools_scm`` from code that one directory deeper than the project's root, you can use: .. code:: python from setuptools_scm import get_version version = get_version(root='..', relative_to=__file__) See `setup.py Usage`_ above for how to use this within setup.py. Usage from sphinx ----------------- It is discouraged to use setuptools_scm from sphinx itself, instead use ``pkg_resources`` after editable/real installation: .. code:: python from pkg_resources import get_distribution release = get_distribution('myproject').version # for example take major/minor version = '.'.join(release.split('.')[:2]) The underlying reason is, that services like readthedocs sometimes change the workingdirectory for good reasons and using the installed metadata prevents using needless volatile data there. Notable Plugins ---------------- `setuptools_scm_git_archive `_ provides partial support for obtaining versions from git archives that belong to tagged versions. The only reason for not including it in setuptools-scm itself is git/github not supporting sufficient metadata for untagged/followup commits, which is preventing a consistent UX. Default versioning scheme -------------------------- In the standard configuration setuptools_scm takes a look at 3 things: 1. latest tag (with a version number) 2. the distance to this tag (e.g. number of revisions since latest tag) 3. workdir state (e.g. uncommitted changes since latest tag) and uses roughly the following logic to render the version: :code:`no distance and clean`: :code:`{tag}` :code:`distance and clean`: :code:`{next_version}.dev{distance}+{scm letter}{revision hash}` :code:`no distance and not clean`: :code:`{tag}+dYYYMMMDD` :code:`distance and not clean`: :code:`{next_version}.dev{distance}+{scm letter}{revision hash}.dYYYMMMDD` The next version is calculated by adding ``1`` to the last numeric component of the tag. For git projects, the version relies on `git describe `_, so you will see an additional ``g`` prepended to the ``{revision hash}``. Semantic Versioning (SemVer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Due to the default behavior it's necessary to always include a patch version (the ``3`` in ``1.2.3``), or else the automatic guessing will increment the wrong part of the semver (e.g. tag ``2.0`` results in ``2.1.devX`` instead of ``2.0.1.devX``). So please make sure to tag accordingly. .. note:: Future versions of setuptools_scm will switch to `SemVer `_ by default hiding the the old behavior as an configurable option. Builtin mechanisms for obtaining version numbers -------------------------------------------------- 1. the scm itself (git/hg) 2. :code:`.hg_archival` files (mercurial archives) 3. PKG-INFO .. note:: git archives are not supported due to git shortcomings Configuration Parameters ------------------------------ In order to configure the way ``use_scm_version`` works you can provide a mapping with options instead of simple boolean value. The Currently supported configuration keys are: :root: cwd relative path to use for finding the scm root, defaults to :code:`.` :version_scheme: configures how the local version number is constructed. either an entrypoint name or a callable :local_scheme: configures how the local component of the version is constructed either an entrypoint name or a callable :write_to: declares a text file or python file which is replaced with a file containing the current version. its ideal or creating a version.py file within the package .. warning:: only :code:`*.py` and :code:`*.txt` have builtin templates, for other extensions it is necessary to provide a :code:`write_to_template` :write_to_template: a newstyle format string thats given the current version as the :code:`version` keyword argument for formatting :relative_to: a file from which root may be resolved. typically called by a script or module that is not in the root of the repository to direct setuptools_scm to the root of the repository by supplying ``__file__``. :parse: a function that will be used instead of the discovered scm for parsing the version, use with caution, this is a expert function and you should be closely familiar with the setuptools_scm internals to use it To use setuptools_scm in other Python code you can use the ``get_version`` function: .. code:: python from setuptools_scm import get_version my_version = get_version() It optionally accepts the keys of the ``use_scm_version`` parameter as keyword arguments. Environment Variables --------------------- :SETUPTOOLS_SCM_PRETEND_VERSION: when defined and not empty, its used as the primary source for the version number in which case it will be a unparsed string Extending setuptools_scm ------------------------ setuptools_scm ships with a few setuptools entrypoints based hooks to extend its default capabilities. Adding a new SCM ~~~~~~~~~~~~~~~~ setuptools_scm provides 2 entrypoints for adding new SCMs ``setuptools_scm.parse_scm`` A function used to parse the metadata of the current workdir using the name of the control directory/file of your SCM as the entrypoint's name. E.g. for the built-in entrypoint for git the entrypoint is named :code:`.git` and references :code:`'setuptools_scm.git:parse'`. The return value MUST be a :code:`setuptools.version.ScmVersion` instance created by the function :code:`setuptools_scm.version:meta`. ``setuptools_scm.files_command`` Either a string containing a shell command that prints all SCM managed files in its current working directory or a callable, that given a pathname will return that list. Also use then name of your SCM control directory as name of the entrypoint. Version number construction ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``setuptools_scm.version_scheme`` Configures how the version number is constructed given a :code:`setuptools.version.ScmVersion` instance and should return a string representing the version. Available implementations: :guess-next-dev: automatically guesses the next development version (default) :post-release: generates post release versions (adds :code:`postN`) ``setuptools_scm.local_scheme`` Configures how the local part of a version is rendered given a :code:`setuptools.version.ScmVersion` instance and should return a string representing the local version. Available implementations: :node-and-date: adds the node on dev versions and the date on dirty workdir (default) :dirty-tag: adds :code:`+dirty` if the current workdir has changes Importing in setup.py ~~~~~~~~~~~~~~~~~~~~~ To support usage in :code:`setup.py` passing a callable into use_scm_version is supported. Within that callable, setuptools_scm is available for import. The callable must return the configuration. .. code:: python def myversion(): from setuptools_scm.version import dirty_tag def clean_scheme(version): return dirty_tag(version) if version.dirty else '+clean' return {'local_scheme': clean_scheme} Code of Conduct --------------- Everyone interacting in the setuptools_scm project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_. .. _PyPA Code of Conduct: https://www.pypa.io/en/latest/code-of-conduct/ Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Version Control Classifier: Topic :: System :: Software Distribution Classifier: Topic :: Utilities setuptools_scm-1.15.6/setuptools_scm.egg-info/SOURCES.txt0000644000175000017500000000136313120557375024205 0ustar travistravis00000000000000.gitignore .travis.yml CHANGELOG.rst LICENSE README.rst appveyor.yml default.nix setup.cfg setup.py tox.ini setuptools_scm/__init__.py setuptools_scm/__main__.py setuptools_scm/discover.py setuptools_scm/git.py setuptools_scm/hacks.py setuptools_scm/hg.py setuptools_scm/integration.py setuptools_scm/utils.py setuptools_scm/version.py setuptools_scm.egg-info/PKG-INFO setuptools_scm.egg-info/SOURCES.txt setuptools_scm.egg-info/dependency_links.txt setuptools_scm.egg-info/entry_points.txt setuptools_scm.egg-info/top_level.txt setuptools_scm.egg-info/zip-safe testing/conftest.py testing/runtests_travis.py testing/test_basic_api.py testing/test_functions.py testing/test_git.py testing/test_main.py testing/test_mercurial.py testing/test_regressions.pysetuptools_scm-1.15.6/setuptools_scm.egg-info/dependency_links.txt0000644000175000017500000000000113120557375026364 0ustar travistravis00000000000000 setuptools_scm-1.15.6/setuptools_scm.egg-info/entry_points.txt0000644000175000017500000000200413120557375025610 0ustar travistravis00000000000000 [distutils.setup_keywords] use_scm_version = setuptools_scm.integration:version_keyword [setuptools.file_finders] setuptools_scm = setuptools_scm.integration:find_files [setuptools_scm.parse_scm] .hg = setuptools_scm.hg:parse .git = setuptools_scm.git:parse [setuptools_scm.parse_scm_fallback] .hg_archival.txt = setuptools_scm.hg:parse_archival PKG-INFO = setuptools_scm.hacks:parse_pkginfo pip-egg-info = setuptools_scm.hacks:parse_pip_egg_info [setuptools_scm.files_command] .hg = setuptools_scm.hg:FILES_COMMAND .git = setuptools_scm.git:FILES_COMMAND [setuptools_scm.version_scheme] guess-next-dev = setuptools_scm.version:guess_next_dev_version post-release = setuptools_scm.version:postrelease_version [setuptools_scm.local_scheme] node-and-date = setuptools_scm.version:get_local_node_and_date dirty-tag = setuptools_scm.version:get_local_dirty_tag setuptools_scm-1.15.6/setuptools_scm.egg-info/top_level.txt0000644000175000017500000000001713120557375025046 0ustar travistravis00000000000000setuptools_scm setuptools_scm-1.15.6/setuptools_scm.egg-info/zip-safe0000644000175000017500000000000113120557367023747 0ustar travistravis00000000000000 setuptools_scm-1.15.6/testing/0000755000175000017500000000000013120557375017216 5ustar travistravis00000000000000setuptools_scm-1.15.6/testing/conftest.py0000644000175000017500000000362313120557347021420 0ustar travistravis00000000000000import os import itertools import pytest os.environ['SETUPTOOLS_SCM_DEBUG'] = '1' VERSION_PKGS = ['setuptools', 'setuptools_scm'] def pytest_report_header(): import pkg_resources res = [] for pkg in VERSION_PKGS: version = pkg_resources.get_distribution(pkg).version res.append('%s version %s' % (pkg, version)) return res class Wd(object): commit_command = None add_command = None def __init__(self, cwd): self.cwd = cwd self.__counter = itertools.count() def __call__(self, cmd, **kw): if kw: cmd = cmd.format(**kw) from setuptools_scm.utils import do return do(cmd, self.cwd) def write(self, name, value, **kw): filename = self.cwd.join(name) if kw: value = value.format(**kw) filename.write(value) return filename def _reason(self, given_reason): if given_reason is None: return 'number-{c}'.format(c=next(self.__counter)) else: return given_reason def commit(self, reason=None): reason = self._reason(reason) self(self.commit_command, reason=reason) def commit_testfile(self, reason=None): reason = self._reason(reason) self.write('test.txt', 'test {reason}', reason=reason) self(self.add_command) self.commit(reason=reason) def get_version(self, **kw): __tracebackhide__ = True from setuptools_scm import get_version version = get_version(root=str(self.cwd), **kw) print(version) return version @property def version(self): __tracebackhide__ = True return self.get_version() @pytest.yield_fixture(autouse=True) def debug_mode(): from setuptools_scm import utils utils.DEBUG = True yield utils.DEBUG = False @pytest.fixture def wd(tmpdir): return Wd(tmpdir.ensure('wd', dir=True)) setuptools_scm-1.15.6/testing/runtests_travis.py0000644000175000017500000000102013120557347023037 0ustar travistravis00000000000000 from subprocess import call import os if os.environ.get('TOXENV'): # normal tox run, lets jsut have tox do its job import tox tox.cmdline() elif os.environ.get('SELFINSTALL'): # self install testing needs some clarity # so its being executed without any other tools running call('python setup.py sdist', shell=True) call('easy_install dist/*', shell=True) import pkg_resources dist = pkg_resources.get_distribution('setuptools_scm') assert set(dist.version) == set(".0"), dist.version setuptools_scm-1.15.6/testing/test_basic_api.py0000644000175000017500000000437313120557347022547 0ustar travistravis00000000000000import os import py import pytest import setuptools_scm from setuptools_scm import dump_version from setuptools_scm.utils import data_from_mime, do @pytest.mark.parametrize('cmd', ['ls', 'dir']) def test_do(cmd, tmpdir): if not py.path.local.sysfind(cmd): pytest.skip(cmd + ' not found') do(cmd, str(tmpdir)) def test_data_from_mime(tmpdir): tmpfile = tmpdir.join('test.archival') tmpfile.write('name: test\nrevision: 1') res = data_from_mime(str(tmpfile)) assert res == { 'name': 'test', 'revision': '1', } def test_version_from_pkginfo(wd): 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' def assert_root(monkeypatch, expected_root): """ Patch version_from_scm to simply assert that root is expected root """ def assertion(root, unused_parse): assert root == expected_root monkeypatch.setattr(setuptools_scm, '_do_parse', assertion) def test_root_parameter_creation(monkeypatch): assert_root(monkeypatch, os.getcwd()) setuptools_scm.get_version() def test_root_parameter_pass_by(monkeypatch, tmpdir): assert_root(monkeypatch, tmpdir) setuptools_scm.get_version(root=tmpdir.strpath) def test_pretended(monkeypatch): pretense = '2345' monkeypatch.setenv(setuptools_scm.PRETEND_KEY, pretense) assert setuptools_scm.get_version() == pretense def test_root_relative_to(monkeypatch, tmpdir): assert_root(monkeypatch, tmpdir.join('alt').strpath) __file__ = tmpdir.join('module/file.py').strpath setuptools_scm.get_version(root='../alt', relative_to=__file__) def test_dump_version(tmpdir): sp = tmpdir.strpath dump_version(sp, '1.0', 'first.txt') assert tmpdir.join('first.txt').read() == '1.0' dump_version(sp, '1.0', 'first.py') content = tmpdir.join('first.py').read() assert repr('1.0') in content import ast ast.parse(content) def test_parse_plain(recwarn): def parse(root): return 'tricked you' assert setuptools_scm.get_version(parse=parse) == 'tricked you' assert str(recwarn.pop().message) == \ 'version parse result was a string\nplease return a parsed version' setuptools_scm-1.15.6/testing/test_functions.py0000644000175000017500000000467013120557347022645 0ustar travistravis00000000000000import pytest import pkg_resources from setuptools_scm import dump_version, get_version, PRETEND_KEY from setuptools_scm.version import guess_next_version, meta, format_version from setuptools_scm.utils import has_command class MockTime(object): def __format__(self, *k): return 'time' @pytest.mark.parametrize('tag, expected', [ ('1.1', '1.2.dev0'), ('1.2.dev', '1.2.dev0'), ('1.1a2', '1.1a3.dev0'), ('23.24.post2+deadbeef', '23.24.post3.dev0'), ]) def test_next_tag(tag, expected): version = pkg_resources.parse_version(tag) assert guess_next_version(version, 0) == expected VERSIONS = { 'exact': meta('1.1', None, False), 'zerodistance': meta('1.1', 0, False), 'dirty': meta('1.1', None, True), 'distance': meta('1.1', 3, False), 'distancedirty': meta('1.1', 3, True), } @pytest.mark.parametrize('version,scheme,expected', [ ('exact', 'guess-next-dev node-and-date', '1.1'), ('zerodistance', 'guess-next-dev node-and-date', '1.2.dev0'), ('dirty', 'guess-next-dev node-and-date', '1.2.dev0+dtime'), ('distance', 'guess-next-dev node-and-date', '1.2.dev3'), ('distancedirty', 'guess-next-dev node-and-date', '1.2.dev3+dtime'), ('exact', 'post-release node-and-date', '1.1'), ('zerodistance', 'post-release node-and-date', '1.1.post0'), ('dirty', 'post-release node-and-date', '1.1.post0+dtime'), ('distance', 'post-release node-and-date', '1.1.post3'), ('distancedirty', 'post-release node-and-date', '1.1.post3+dtime'), ]) def test_format_version(version, monkeypatch, scheme, expected): version = VERSIONS[version] monkeypatch.setattr(version, 'time', MockTime()) vs, ls = scheme.split() assert format_version( version, version_scheme=vs, local_scheme=ls) == expected def test_dump_version_doesnt_bail_on_value_error(tmpdir): write_to = "VERSION" version = str(VERSIONS['exact'].tag) with pytest.raises(ValueError) as exc_info: dump_version(tmpdir.strpath, version, write_to) assert str(exc_info.value).startswith("bad file format:") def test_dump_version_works_with_pretend(tmpdir, monkeypatch): monkeypatch.setenv(PRETEND_KEY, '1.0') get_version(write_to=str(tmpdir.join('VERSION.txt'))) assert tmpdir.join('VERSION.txt').read() == '1.0' def test_has_command(recwarn): assert not has_command('yadayada_setuptools_aint_ne') msg = recwarn.pop() assert 'yadayada' in str(msg.message) setuptools_scm-1.15.6/testing/test_git.py0000644000175000017500000000551213120557347021414 0ustar travistravis00000000000000from setuptools_scm import integration from setuptools_scm.utils import do from setuptools_scm import git import pytest from datetime import date @pytest.fixture def wd(wd): wd('git init') wd('git config user.email test@example.com') wd('git config user.name "a test"') wd.add_command = 'git add .' wd.commit_command = 'git commit -m test-{reason}' return wd def test_version_from_git(wd): assert wd.version == '0.1.dev0' wd.commit_testfile() assert wd.version.startswith('0.1.dev1+g') assert not wd.version.endswith('1-') wd('git tag v0.1') assert wd.version == '0.1' wd.write('test.txt', 'test2') assert wd.version.startswith('0.2.dev0+g') wd.commit_testfile() assert wd.version.startswith('0.2.dev1+g') wd('git tag version-0.2') assert wd.version.startswith('0.2') wd.commit_testfile() wd('git tag version-0.2.post210+gbe48adfpost3+g0cc25f2') assert wd.version.startswith('0.2') @pytest.mark.issue(108) @pytest.mark.issue(109) def test_git_worktree(wd): wd.write('test.txt', 'test2') # untracked files dont change the state assert wd.version == '0.1.dev0' wd('git add test.txt') assert wd.version.startswith('0.1.dev0+d') @pytest.mark.issue(86) def test_git_dirty_notag(wd): wd.commit_testfile() wd.write('test.txt', 'test2') wd("git add test.txt") assert wd.version.startswith('0.1.dev1') today = date.today() # we are dirty, check for the tag assert today.strftime('.d%Y%m%d') in wd.version @pytest.fixture def shallow_wd(wd, tmpdir): wd.commit_testfile() wd.commit_testfile() wd.commit_testfile() target = tmpdir.join('wd_shallow') do(['git', 'clone', "file://%s" % wd.cwd, str(target,), '--depth=1']) return target def test_git_parse_shallow_warns(shallow_wd, recwarn): git.parse(str(shallow_wd)) msg = recwarn.pop() assert 'is shallow and may cause errors' in str(msg.message) def test_git_parse_shallow_fail(shallow_wd): with pytest.raises(ValueError) as einfo: git.parse(str(shallow_wd), pre_parse=git.fail_on_shallow) assert 'git fetch' in str(einfo.value) def test_git_shallow_autocorrect(shallow_wd, recwarn): git.parse(str(shallow_wd), pre_parse=git.fetch_on_shallow) msg = recwarn.pop() assert 'git fetch was used to rectify' in str(msg.message) git.parse(str(shallow_wd), pre_parse=git.fail_on_shallow) def test_find_files_stop_at_root_git(wd): wd.commit_testfile() wd.cwd.ensure('project/setup.cfg') assert integration.find_files(str(wd.cwd/'project')) == [] @pytest.mark.issue(128) def test_parse_no_worktree(tmpdir): ret = git.parse(str(tmpdir)) assert ret is None def test_alphanumeric_tags_match(wd): wd.commit_testfile() wd('git tag newstyle-development-started') assert wd.version.startswith('0.1.dev1+g') setuptools_scm-1.15.6/testing/test_main.py0000644000175000017500000000036213120557347021553 0ustar travistravis00000000000000import os.path def test_main(): mainfile = os.path.join( os.path.dirname(__file__), "..", "setuptools_scm", "__main__.py") with open(mainfile) as f: code = compile(f.read(), "__main__.py", 'exec') exec(code) setuptools_scm-1.15.6/testing/test_mercurial.py0000644000175000017500000000510613120557347022613 0ustar travistravis00000000000000from setuptools_scm import format_version from setuptools_scm.hg import archival_to_version, parse from setuptools_scm import integration import pytest @pytest.fixture def wd(wd): wd('hg init') wd.add_command = 'hg add .' wd.commit_command = 'hg commit -m test-{reason} -u test -d "0 0"' return wd archival_mapping = { '1.0': {'tag': '1.0'}, '1.1.dev3+h000000000000': { 'latesttag': '1.0', 'latesttagdistance': '3', 'node': '0'*20, }, '0.0': { 'node': '0'*20, }, '1.2.2': {'tag': 'release-1.2.2'}, '1.2.2.dev0': {'tag': 'release-1.2.2.dev'}, } @pytest.mark.parametrize('expected,data', sorted(archival_mapping.items())) def test_archival_to_version(expected, data): version = archival_to_version(data) assert format_version( version, version_scheme='guess-next-dev', local_scheme='node-and-date') == expected def test_find_files_stop_at_root_hg(wd): wd.commit_testfile() wd.cwd.ensure('project/setup.cfg') assert integration.find_files(str(wd.cwd/'project')) == [] # XXX: better tests for tag prefixes def test_version_from_hg_id(wd): assert wd.version == '0.0' wd.commit_testfile() assert wd.version.startswith('0.1.dev2+') # tagging commit is considered the tag wd('hg tag v0.1 -u test -d "0 0"') assert wd.version == '0.1' wd.commit_testfile() assert wd.version.startswith('0.2.dev2') wd('hg up v0.1') assert wd.version == '0.1' # commit originating from the taged revision # that is not a actual tag wd.commit_testfile() assert wd.version.startswith('0.2.dev1+') # several tags wd('hg up') wd('hg tag v0.2 -u test -d "0 0"') wd('hg tag v0.3 -u test -d "0 0" -r v0.2') assert wd.version == '0.3' def test_version_from_archival(wd): # entrypoints are unordered, # cleaning the wd ensure this test wont break randomly wd.cwd.join('.hg').remove() wd.write( '.hg_archival.txt', 'node: 000000000000\n' 'tag: 0.1\n' ) assert wd.version == '0.1' wd.write( '.hg_archival.txt', 'node: 000000000000\n' 'latesttag: 0.1\n' 'latesttagdistance: 3\n' ) assert wd.version == '0.2.dev3+h000000000000' @pytest.mark.issue('#72') def test_version_in_merge(wd): wd.commit_testfile() wd.commit_testfile() wd('hg up 0') wd.commit_testfile() wd('hg merge --tool :merge') assert wd.version is not None @pytest.mark.issue(128) def test_parse_no_worktree(tmpdir): ret = parse(str(tmpdir)) assert ret is None setuptools_scm-1.15.6/testing/test_regressions.py0000644000175000017500000000521613120557347023175 0ustar travistravis00000000000000import sys import subprocess from setuptools_scm import get_version from setuptools_scm.git import parse from setuptools_scm.utils import do_ex, do import pytest def test_pkginfo_noscmroot(tmpdir, monkeypatch): """if we are indeed a sdist, the root does not apply""" monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG") # 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": ".."})') _, stderr, ret = do_ex((sys.executable, 'setup.py', '--version'), p) assert 'setuptools-scm was unable to detect version for' in stderr assert ret == 1 p.join("PKG-INFO").write('Version: 1.0') res = do((sys.executable, 'setup.py', '--version'), p) assert res == '1.0' do('git init', p.dirpath()) res = do((sys.executable, 'setup.py', '--version'), p) assert res == '1.0' 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' @pytest.mark.issue(164) def test_pip_download(tmpdir, monkeypatch): monkeypatch.chdir(tmpdir) subprocess.check_call([ sys.executable, '-c', 'import pip;pip.main()', 'download', 'lz4==0.9.0', ]) def test_use_scm_version_callable(tmpdir, monkeypatch): """use of callable as use_scm_version argument""" monkeypatch.delenv("SETUPTOOLS_SCM_DEBUG") p = tmpdir.ensure('sub/package', dir=1) p.join('setup.py').write( '''from setuptools import setup def vcfg(): from setuptools_scm.version import guess_next_dev_version def vs(v): return guess_next_dev_version(v) return {"version_scheme": vs} setup(use_scm_version=vcfg) ''') p.join("PKG-INFO").write('Version: 1.0') res = do((sys.executable, 'setup.py', '--version'), p) assert res == '1.0' @pytest.mark.skipif(sys.platform != 'win32', reason="this bug is only valid on windows") def test_case_mismatch_on_windows_git(tmpdir): """Case insensitive path checks on Windows""" p = tmpdir.ensure("CapitalizedDir", dir=1) do('git init', p) res = parse(str(p).lower()) assert res is not None setuptools_scm-1.15.6/.gitignore0000644000175000017500000000102013120557347017521 0ustar travistravis00000000000000### JetBrains template # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion *.iml ## Directory-based project format: .idea/ ### Python template # Byte-compiled / optimized __pycache__/ *.py[cod] *$py.class # Distribution / packaging .env/ env/ build/ dist/ .eggs/ lib/ lib64/ *.egg-info/ # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *,cover # Sphinx documentation docs/_build/ setuptools_scm-1.15.6/.travis.yml0000644000175000017500000000255113120557347017654 0ustar travistravis00000000000000language: python sudo: false python: - '2.6' - '2.7' - '3.3' - '3.4' - '3.5' - '3.6' env: - TOXENV=py-test matrix: include: - python: '2.7' env: TOXENV=flake8 - python: '3.5' env: TOXENV=flake8 - python: '2.7' env: SELFINSTALL=1 - python: '3.5' env: SELFINSTALL=1 cache: files: - $HOME/.pip/cache - $Home/.cache/pip install: pip install tox script: - python testing/runtests_travis.py credentials: - &pypi provider: pypi user: ronny password: secure: QGJhDXmfFDKysMJJV/ONGaHHzG/aImhU3DdhEP63d657iQSn/Cb4EG/l9YmVnRzpJ94nSDXZB8YwptR7rid0bOtidb32lxN8n6UiWILCXWeAN2FE+tT9/0xIct4HUJZ8OttD1gft/Di722Gy+s9PzFwjwrV4efkxCzgjfYOjkMeq3aO6NoG3ur0iZXJh7ODwLp4sRFep2NpIEaXm2qMdnnXpck6bJ1q/NtvPx9CAZivd9HYa0evg5j1ENTz1mXXafhgF+0vRCBXA33xJuysO6CKtk+2mizL1QHfosOERiKl9+zPyZw+VvSchbCVwgxrMSiRcpGag+4SegyHrj1M/2YqfFzMF/yuFGcqXl2VkEqlnBQOVMNW3Kdcmnm+caNbddnv+M384WFz4nV8nWjcsD5l27+XlMWfuvskDIvZKtVCXmmbtqgwM4tqoYd6uxbnooRfwINTGx8sNzKP10xkaesB3ZBCEpecOKA1AXUAZ74RfYWWExv6eIuVGwyIJmOcD8M/17N8g58GxxO+88gx50EuhyNiRjYZDUipfVydfJwBwpD+p695NixUMITuksucQftjHsQp+laGWJlDIPvFwI85wDJUYAyrzn6L1W+smkm1bGomuliW2MJfxeSZAmSk4CE5VOpIWQTBmDLR3pxBhcaqzwdd4mAWvMi/fpM4yJJI= deploy: - <<: *pypi on: tags: true python: '2.7' distributions: "sdist bdist_wheel" - <<: *pypi on: tags: true distributions: "bdist_egg" setuptools_scm-1.15.6/CHANGELOG.rst0000644000175000017500000001372513120557347017571 0ustar travistravis00000000000000 v1.15.6 ======= * fix #171 by unpinning the py version to allow a fixed one to get installed v1.15.5 ======= * fix #167 by correctly respecting preformatted version metadata from PKG-INFO/EGG-INFO v1.15.4 ======= * fix issue #164: iterate all found entry points to avoid erros when pip remakes egg-info * enhance self-use to enable pip install from github again v1.15.3 ======= * bring back correctly getting our version in the own sdist, finalizes #114 * fix issue #150: strip local components of tags v1.15.2 ======= * fix issue #128: return None when a scm specific parse fails in a worktree to ease parse reuse v1.15.1 ======= * fix issue #126: the local part of any tags is discarded when guessing new versions * minor performance optimization by doing fewer git calls in the usual cases v1.15.0 ======= * more sophisticated ignoring of mercurial tag commits when considering distance in commits (thanks Petre Mierlutiu) * fix issue #114: stop trying to be smart for the sdist and ensure its always correctly usign itself * update trove classifiers * fix issue #84: document using the installed package metadata for sphinx * fix issue #81: fail more gracious when git/hg are missing * address issue #93: provide an experimental api to customize behaviour on shallow git repos a custom parse function may pick pre parse actions to do when using git v1.14.1 ======= * fix #109: when detecting a dirty git workdir don't consider untracked file (this was a regression due to #86 in v1.13.1) * consider the distance 0 when the git node is unknown (happens when you haven't commited anything) v1.14.0 ======= * publish bdist_egg for python 2.6, 2.7 and 3.3-3.5 * fix issue #107 - dont use node if it is None v1.13.1 ======= * fix issue #86 - detect dirty git workdir without tags v1.13.0 ======= * fix regression caused by the fix of #101 * assert types for version dumping * strictly pass all versions trough parsed version metadata v1.12.0 ======= * fix issue #97 - add support for mercurial plugins * fix issue #101 - write version cache even for pretend version (thanks anarcat for reporting and fixing) v1.11.1 ======== * fix issue #88 - better docs for sphinx usage (thanks Jason) * fix issue #89 - use normpath to deal with windows (thanks Te-jé Rodgers for reporting and fixing) v1.11.0 ======= * always run tag_to_version so in order to handle prefixes on old setuptools (thanks to Brian May) * drop support for python 3.2 * extend the error message on missing scm metadata (thanks Markus Unterwaditzer) * fix bug when using callable version_scheme (thanks Esben Haabendal) v1.10.1 ======= * fix issue #73 - in hg pre commit merge, consider parent1 instead of failing v1.10.0 ======= * add support for overriding the version number via the environment variable SETUPTOOLS_SCM_PRETEND_VERSION * fix isssue #63 by adding the --match parameter to the git describe call and prepare the possibility of passing more options to scm backends * fix issue #70 and #71 by introducing the parse keyword to specify custom scm parsing, its an expert feature, use with caution this change also introduces the setuptools_scm.parse_scm_fallback entrypoint which can be used to register custom archive fallbacks v1.9.0 ====== * Add :code:`relative_to` parameter to :code:`get_version` function; fixes #44 per #45. v1.8.0 ====== * fix issue with setuptools wrong version warnings being printed to standard out. User is informed now by distutils-warnings. * restructure root finding, we now reliably ignore outer scm and prefer PKG-INFO over scm, fixes #43 and #45 v1.7.0 ====== * correct the url to github thanks David Szotten * enhance scm not found errors with a note on git tarballs thanks Markus * add support for :code:`write_to_template` v1.6.0 ====== * bail out early if the scm is missing this brings issues with git tarballs and older devpi-client releases to light, before we would let the setup stay at version 0.0, now there is a ValueError * propperly raise errors on write_to missuse (thanks Te-jé Rodgers) v1.5.5 ====== * Fix bug on Python 2 on Windows when environment has unicode fields. v1.5.4 ====== * Fix bug on Python 2 when version is loaded from existing metadata. v1.5.3 ====== * #28: Fix decoding error when PKG-INFO contains non-ASCII. v1.5.2 ====== * add zip_safe flag v1.5.1 ====== * fix file access bug i missed in 1.5 v1.5.0 ====== * moved setuptools integration related code to own file * support storing version strings into a module/text file using the :code:`write_to` coniguration parameter v1.4.0 ====== * propper handling for sdist * fix file-finder failure from windows * resuffle docs v1.3.0 ====== * support setuptools easy_install egg creation details by hardwireing the version in the sdist v1.2.0 ====== * enhance self-use v1.1.0 ====== * enable self-use v1.0.0 ====== * documentation enhancements v0.26 ===== * rename to setuptools_scm * split into package, add lots of entry points for extension * pluggable version schemes v0.25 ===== * fix pep440 support this reshuffles the complete code for version guessing v0.24 ===== * dont drop dirty flag on node finding * fix distance for dirty flagged versions * use dashes for time again, its normalisation with setuptools * remove the own version attribute, it was too fragile to test for * include file finding * handle edge cases around dirty tagged versions v0.23 ===== * windows compatibility fix (thanks stefan) drop samefile since its missing in some python2 versions on windows * add tests to the source tarballs v0.22 ===== * windows compatibility fix (thanks stefan) use samefile since it does path normalisation v0.21 ===== * fix the own version attribute (thanks stefan) v0.20 ===== * fix issue 11: always take git describe long format to avoid the source of the ambiguity * fix issue 12: add a __version__ attribute via pkginfo v0.19 ===== * configurable next version guessing * fix distance guessing (thanks stefan) setuptools_scm-1.15.6/LICENSE0000644000175000017500000000177713120557347016561 0ustar travistravis00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. setuptools_scm-1.15.6/README.rst0000644000175000017500000002201313120557347017225 0ustar travistravis00000000000000setuptools_scm =============== :code:`setuptools_scm` handles managing your python package versions in scm metadata instead of declaring them as the version argument or in a scm managed file. It also handles file finders for the supported scm's. .. image:: https://travis-ci.org/pypa/setuptools_scm.svg?branch=master :target: https://travis-ci.org/pypa/setuptools_scm Setup.py usage -------------- To use setuptools_scm just modify your project's setup.py file like this: 1. Add :code:`'setuptools_scm'` to the :code:`setup_requires` parameter 2. Add the :code:`use_scm_version` parameter and set it to ``True`` E.g.: .. code:: python from setuptools import setup setup( ..., use_scm_version=True, setup_requires=['setuptools_scm'], ..., ) Arguments to ``get_version()`` (see below) may be passed as a dictionary to ``use_scm_version``. For example: .. code:: python from setuptools import setup setup( ..., use_scm_version = {"root": "..", "relative_to": __file__}, setup_requires=['setuptools_scm'], ..., ) 3. Access the version number in your package via :code:`pkg_resources` E.g. (`PEP-0396 `_): .. code:: python from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution(__name__).version except DistributionNotFound: # package is not installed pass Programmatic usage ------------------ In order to use ``setuptools_scm`` from code that one directory deeper than the project's root, you can use: .. code:: python from setuptools_scm import get_version version = get_version(root='..', relative_to=__file__) See `setup.py Usage`_ above for how to use this within setup.py. Usage from sphinx ----------------- It is discouraged to use setuptools_scm from sphinx itself, instead use ``pkg_resources`` after editable/real installation: .. code:: python from pkg_resources import get_distribution release = get_distribution('myproject').version # for example take major/minor version = '.'.join(release.split('.')[:2]) The underlying reason is, that services like readthedocs sometimes change the workingdirectory for good reasons and using the installed metadata prevents using needless volatile data there. Notable Plugins ---------------- `setuptools_scm_git_archive `_ provides partial support for obtaining versions from git archives that belong to tagged versions. The only reason for not including it in setuptools-scm itself is git/github not supporting sufficient metadata for untagged/followup commits, which is preventing a consistent UX. Default versioning scheme -------------------------- In the standard configuration setuptools_scm takes a look at 3 things: 1. latest tag (with a version number) 2. the distance to this tag (e.g. number of revisions since latest tag) 3. workdir state (e.g. uncommitted changes since latest tag) and uses roughly the following logic to render the version: :code:`no distance and clean`: :code:`{tag}` :code:`distance and clean`: :code:`{next_version}.dev{distance}+{scm letter}{revision hash}` :code:`no distance and not clean`: :code:`{tag}+dYYYMMMDD` :code:`distance and not clean`: :code:`{next_version}.dev{distance}+{scm letter}{revision hash}.dYYYMMMDD` The next version is calculated by adding ``1`` to the last numeric component of the tag. For git projects, the version relies on `git describe `_, so you will see an additional ``g`` prepended to the ``{revision hash}``. Semantic Versioning (SemVer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Due to the default behavior it's necessary to always include a patch version (the ``3`` in ``1.2.3``), or else the automatic guessing will increment the wrong part of the semver (e.g. tag ``2.0`` results in ``2.1.devX`` instead of ``2.0.1.devX``). So please make sure to tag accordingly. .. note:: Future versions of setuptools_scm will switch to `SemVer `_ by default hiding the the old behavior as an configurable option. Builtin mechanisms for obtaining version numbers -------------------------------------------------- 1. the scm itself (git/hg) 2. :code:`.hg_archival` files (mercurial archives) 3. PKG-INFO .. note:: git archives are not supported due to git shortcomings Configuration Parameters ------------------------------ In order to configure the way ``use_scm_version`` works you can provide a mapping with options instead of simple boolean value. The Currently supported configuration keys are: :root: cwd relative path to use for finding the scm root, defaults to :code:`.` :version_scheme: configures how the local version number is constructed. either an entrypoint name or a callable :local_scheme: configures how the local component of the version is constructed either an entrypoint name or a callable :write_to: declares a text file or python file which is replaced with a file containing the current version. its ideal or creating a version.py file within the package .. warning:: only :code:`*.py` and :code:`*.txt` have builtin templates, for other extensions it is necessary to provide a :code:`write_to_template` :write_to_template: a newstyle format string thats given the current version as the :code:`version` keyword argument for formatting :relative_to: a file from which root may be resolved. typically called by a script or module that is not in the root of the repository to direct setuptools_scm to the root of the repository by supplying ``__file__``. :parse: a function that will be used instead of the discovered scm for parsing the version, use with caution, this is a expert function and you should be closely familiar with the setuptools_scm internals to use it To use setuptools_scm in other Python code you can use the ``get_version`` function: .. code:: python from setuptools_scm import get_version my_version = get_version() It optionally accepts the keys of the ``use_scm_version`` parameter as keyword arguments. Environment Variables --------------------- :SETUPTOOLS_SCM_PRETEND_VERSION: when defined and not empty, its used as the primary source for the version number in which case it will be a unparsed string Extending setuptools_scm ------------------------ setuptools_scm ships with a few setuptools entrypoints based hooks to extend its default capabilities. Adding a new SCM ~~~~~~~~~~~~~~~~ setuptools_scm provides 2 entrypoints for adding new SCMs ``setuptools_scm.parse_scm`` A function used to parse the metadata of the current workdir using the name of the control directory/file of your SCM as the entrypoint's name. E.g. for the built-in entrypoint for git the entrypoint is named :code:`.git` and references :code:`'setuptools_scm.git:parse'`. The return value MUST be a :code:`setuptools.version.ScmVersion` instance created by the function :code:`setuptools_scm.version:meta`. ``setuptools_scm.files_command`` Either a string containing a shell command that prints all SCM managed files in its current working directory or a callable, that given a pathname will return that list. Also use then name of your SCM control directory as name of the entrypoint. Version number construction ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``setuptools_scm.version_scheme`` Configures how the version number is constructed given a :code:`setuptools.version.ScmVersion` instance and should return a string representing the version. Available implementations: :guess-next-dev: automatically guesses the next development version (default) :post-release: generates post release versions (adds :code:`postN`) ``setuptools_scm.local_scheme`` Configures how the local part of a version is rendered given a :code:`setuptools.version.ScmVersion` instance and should return a string representing the local version. Available implementations: :node-and-date: adds the node on dev versions and the date on dirty workdir (default) :dirty-tag: adds :code:`+dirty` if the current workdir has changes Importing in setup.py ~~~~~~~~~~~~~~~~~~~~~ To support usage in :code:`setup.py` passing a callable into use_scm_version is supported. Within that callable, setuptools_scm is available for import. The callable must return the configuration. .. code:: python def myversion(): from setuptools_scm.version import dirty_tag def clean_scheme(version): return dirty_tag(version) if version.dirty else '+clean' return {'local_scheme': clean_scheme} Code of Conduct --------------- Everyone interacting in the setuptools_scm project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_. .. _PyPA Code of Conduct: https://www.pypa.io/en/latest/code-of-conduct/ setuptools_scm-1.15.6/appveyor.yml0000644000175000017500000000246513120557347020137 0ustar travistravis00000000000000environment: matrix: - PYTHON: "C:\\Python27" TOX_ENV: "py-test" - PYTHON: "C:\\Python27-x64" TOX_ENV: "py-test" - PYTHON: "C:\\Python33" TOX_ENV: "py-test" - PYTHON: "C:\\Python33-x64" TOX_ENV: "py-test" - PYTHON: "C:\\Python34" TOX_ENV: "py-test" - PYTHON: "C:\\Python34-x64" TOX_ENV: "py-test" init: - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - ECHO "Updating Environment" - python -m pip install -U setuptools - python -m pip install -U pip - python -m pip install -U wheel - python -m pip install -U tox install: # Check that we have the expected version and architecture for Python - python -c "import sys, os;sys.stdout.write(str(sys.version) + os.linesep)" - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - python -m pip list build: false # Not a C# project, build stuff at the test step instead. test_script: # Build the compiled extension and run the project tests - python -m tox -e %TOX_ENV%" after_test: # If tests are successful, create a whl package for the project. - "%CMD_IN_ENV% python setup.py bdist_wheel" - ps: "ls dist" artifacts: # Archive the generated wheel package in the ci.appveyor.com build report. - path: dist\* setuptools_scm-1.15.6/default.nix0000644000175000017500000000034413120557347017705 0ustar travistravis00000000000000{pkgs ? import {}}: with pkgs.pythonPackages; buildPythonPackage { name = "setuptools_scm"; src = ./.; version = "git"; buildInputs = [ setuptools pip pytest pkgs.git pkgs.mercurial ]; } setuptools_scm-1.15.6/setup.py0000644000175000017500000000701413120557347017254 0ustar travistravis00000000000000"""\ important note: the setup of setuptools_scm is self-using, the first execution of `python setup.py egg_info` will generate partial data its critical to run `python setup.py egg_info` once before running sdist or easy_install on a fresh checkouts pip usage is recommended """ from __future__ import print_function import os import sys import setuptools 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)) with open('README.rst') as fp: long_description = fp.read() arguments = dict( name='setuptools_scm', url='https://github.com/pypa/setuptools_scm/', zip_safe=True, author='Ronny Pfannschmidt', author_email='opensource@ronnypfannschmidt.de', description=('the blessed package to manage your versions by scm tags'), long_description=long_description, license='MIT', packages=[ 'setuptools_scm', ], entry_points=""" [distutils.setup_keywords] use_scm_version = setuptools_scm.integration:version_keyword [setuptools.file_finders] setuptools_scm = setuptools_scm.integration:find_files [setuptools_scm.parse_scm] .hg = setuptools_scm.hg:parse .git = setuptools_scm.git:parse [setuptools_scm.parse_scm_fallback] .hg_archival.txt = setuptools_scm.hg:parse_archival PKG-INFO = setuptools_scm.hacks:parse_pkginfo pip-egg-info = setuptools_scm.hacks:parse_pip_egg_info [setuptools_scm.files_command] .hg = setuptools_scm.hg:FILES_COMMAND .git = setuptools_scm.git:FILES_COMMAND [setuptools_scm.version_scheme] guess-next-dev = setuptools_scm.version:guess_next_dev_version post-release = setuptools_scm.version:postrelease_version [setuptools_scm.local_scheme] node-and-date = setuptools_scm.version:get_local_node_and_date dirty-tag = setuptools_scm.version:get_local_dirty_tag """, classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Version Control', 'Topic :: System :: Software Distribution', 'Topic :: Utilities', ], ) if __name__ == '__main__': arguments.update(scm_config()) setuptools.setup(**arguments) setuptools_scm-1.15.6/tox.ini0000644000175000017500000000202613120557347017053 0ustar travistravis00000000000000[tox] envlist=py{27,34}-test,flake8 [flake8] max-complexity = 10 [testenv] usedevelop=True deps= pytest commands= test: py.test [] [testenv:flake8] skip_install=True deps= flake8 mccabe commands = flake8 setuptools_scm/ testing/ setup.py [testenv:check_readme] skip_install=True deps= readme commands= python setup.py check -r -s rst2html.py README.rst {envlogdir}/README.html --strict [] [testenv:upload] deps= wheel twine commands= python setup.py clean --all rotate -k - -m .whl,.tar.gz,.zip python setup.py -q egg_info python setup.py -q sdist --formats zip bdist_wheel register [testenv:dist] deps= wheel whitelist_externals = rm commands= python setup.py -q clean --all python setup.py -q rotate -k 0 -m .egg,.zip,.whl,.tar.gz python setup.py -q egg_info python setup.py -q sdist --formats zip,bztar bdist_wheel upload [testenv:devpi] deps= devpi-client commands = python setup.py -q egg_info devpi upload --from-dir dist #XXX: envs for hg versions setuptools_scm-1.15.6/PKG-INFO0000644000175000017500000003057113120557375016644 0ustar travistravis00000000000000Metadata-Version: 1.1 Name: setuptools_scm Version: 1.15.6 Summary: the blessed package to manage your versions by scm tags Home-page: https://github.com/pypa/setuptools_scm/ Author: Ronny Pfannschmidt Author-email: opensource@ronnypfannschmidt.de License: MIT Description: setuptools_scm =============== :code:`setuptools_scm` handles managing your python package versions in scm metadata instead of declaring them as the version argument or in a scm managed file. It also handles file finders for the supported scm's. .. image:: https://travis-ci.org/pypa/setuptools_scm.svg?branch=master :target: https://travis-ci.org/pypa/setuptools_scm Setup.py usage -------------- To use setuptools_scm just modify your project's setup.py file like this: 1. Add :code:`'setuptools_scm'` to the :code:`setup_requires` parameter 2. Add the :code:`use_scm_version` parameter and set it to ``True`` E.g.: .. code:: python from setuptools import setup setup( ..., use_scm_version=True, setup_requires=['setuptools_scm'], ..., ) Arguments to ``get_version()`` (see below) may be passed as a dictionary to ``use_scm_version``. For example: .. code:: python from setuptools import setup setup( ..., use_scm_version = {"root": "..", "relative_to": __file__}, setup_requires=['setuptools_scm'], ..., ) 3. Access the version number in your package via :code:`pkg_resources` E.g. (`PEP-0396 `_): .. code:: python from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution(__name__).version except DistributionNotFound: # package is not installed pass Programmatic usage ------------------ In order to use ``setuptools_scm`` from code that one directory deeper than the project's root, you can use: .. code:: python from setuptools_scm import get_version version = get_version(root='..', relative_to=__file__) See `setup.py Usage`_ above for how to use this within setup.py. Usage from sphinx ----------------- It is discouraged to use setuptools_scm from sphinx itself, instead use ``pkg_resources`` after editable/real installation: .. code:: python from pkg_resources import get_distribution release = get_distribution('myproject').version # for example take major/minor version = '.'.join(release.split('.')[:2]) The underlying reason is, that services like readthedocs sometimes change the workingdirectory for good reasons and using the installed metadata prevents using needless volatile data there. Notable Plugins ---------------- `setuptools_scm_git_archive `_ provides partial support for obtaining versions from git archives that belong to tagged versions. The only reason for not including it in setuptools-scm itself is git/github not supporting sufficient metadata for untagged/followup commits, which is preventing a consistent UX. Default versioning scheme -------------------------- In the standard configuration setuptools_scm takes a look at 3 things: 1. latest tag (with a version number) 2. the distance to this tag (e.g. number of revisions since latest tag) 3. workdir state (e.g. uncommitted changes since latest tag) and uses roughly the following logic to render the version: :code:`no distance and clean`: :code:`{tag}` :code:`distance and clean`: :code:`{next_version}.dev{distance}+{scm letter}{revision hash}` :code:`no distance and not clean`: :code:`{tag}+dYYYMMMDD` :code:`distance and not clean`: :code:`{next_version}.dev{distance}+{scm letter}{revision hash}.dYYYMMMDD` The next version is calculated by adding ``1`` to the last numeric component of the tag. For git projects, the version relies on `git describe `_, so you will see an additional ``g`` prepended to the ``{revision hash}``. Semantic Versioning (SemVer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Due to the default behavior it's necessary to always include a patch version (the ``3`` in ``1.2.3``), or else the automatic guessing will increment the wrong part of the semver (e.g. tag ``2.0`` results in ``2.1.devX`` instead of ``2.0.1.devX``). So please make sure to tag accordingly. .. note:: Future versions of setuptools_scm will switch to `SemVer `_ by default hiding the the old behavior as an configurable option. Builtin mechanisms for obtaining version numbers -------------------------------------------------- 1. the scm itself (git/hg) 2. :code:`.hg_archival` files (mercurial archives) 3. PKG-INFO .. note:: git archives are not supported due to git shortcomings Configuration Parameters ------------------------------ In order to configure the way ``use_scm_version`` works you can provide a mapping with options instead of simple boolean value. The Currently supported configuration keys are: :root: cwd relative path to use for finding the scm root, defaults to :code:`.` :version_scheme: configures how the local version number is constructed. either an entrypoint name or a callable :local_scheme: configures how the local component of the version is constructed either an entrypoint name or a callable :write_to: declares a text file or python file which is replaced with a file containing the current version. its ideal or creating a version.py file within the package .. warning:: only :code:`*.py` and :code:`*.txt` have builtin templates, for other extensions it is necessary to provide a :code:`write_to_template` :write_to_template: a newstyle format string thats given the current version as the :code:`version` keyword argument for formatting :relative_to: a file from which root may be resolved. typically called by a script or module that is not in the root of the repository to direct setuptools_scm to the root of the repository by supplying ``__file__``. :parse: a function that will be used instead of the discovered scm for parsing the version, use with caution, this is a expert function and you should be closely familiar with the setuptools_scm internals to use it To use setuptools_scm in other Python code you can use the ``get_version`` function: .. code:: python from setuptools_scm import get_version my_version = get_version() It optionally accepts the keys of the ``use_scm_version`` parameter as keyword arguments. Environment Variables --------------------- :SETUPTOOLS_SCM_PRETEND_VERSION: when defined and not empty, its used as the primary source for the version number in which case it will be a unparsed string Extending setuptools_scm ------------------------ setuptools_scm ships with a few setuptools entrypoints based hooks to extend its default capabilities. Adding a new SCM ~~~~~~~~~~~~~~~~ setuptools_scm provides 2 entrypoints for adding new SCMs ``setuptools_scm.parse_scm`` A function used to parse the metadata of the current workdir using the name of the control directory/file of your SCM as the entrypoint's name. E.g. for the built-in entrypoint for git the entrypoint is named :code:`.git` and references :code:`'setuptools_scm.git:parse'`. The return value MUST be a :code:`setuptools.version.ScmVersion` instance created by the function :code:`setuptools_scm.version:meta`. ``setuptools_scm.files_command`` Either a string containing a shell command that prints all SCM managed files in its current working directory or a callable, that given a pathname will return that list. Also use then name of your SCM control directory as name of the entrypoint. Version number construction ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``setuptools_scm.version_scheme`` Configures how the version number is constructed given a :code:`setuptools.version.ScmVersion` instance and should return a string representing the version. Available implementations: :guess-next-dev: automatically guesses the next development version (default) :post-release: generates post release versions (adds :code:`postN`) ``setuptools_scm.local_scheme`` Configures how the local part of a version is rendered given a :code:`setuptools.version.ScmVersion` instance and should return a string representing the local version. Available implementations: :node-and-date: adds the node on dev versions and the date on dirty workdir (default) :dirty-tag: adds :code:`+dirty` if the current workdir has changes Importing in setup.py ~~~~~~~~~~~~~~~~~~~~~ To support usage in :code:`setup.py` passing a callable into use_scm_version is supported. Within that callable, setuptools_scm is available for import. The callable must return the configuration. .. code:: python def myversion(): from setuptools_scm.version import dirty_tag def clean_scheme(version): return dirty_tag(version) if version.dirty else '+clean' return {'local_scheme': clean_scheme} Code of Conduct --------------- Everyone interacting in the setuptools_scm project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the `PyPA Code of Conduct`_. .. _PyPA Code of Conduct: https://www.pypa.io/en/latest/code-of-conduct/ Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Version Control Classifier: Topic :: System :: Software Distribution Classifier: Topic :: Utilities setuptools_scm-1.15.6/setup.cfg0000644000175000017500000000032513120557375017362 0ustar travistravis00000000000000[bdist_wheel] universal = 1 [metadata] license_file = LICENSE [devpi:upload] formats = sdist,bdist_wheel [aliases] release = sdist bdist_wheel upload [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0