pax_global_header00006660000000000000000000000064134456454450014530gustar00rootroot0000000000000052 comment=a52e4747603edc7eea2a884338a4bf9c47f621e8 setuptools_scm_git_archive-1.1/000077500000000000000000000000001344564544500170205ustar00rootroot00000000000000setuptools_scm_git_archive-1.1/.git_archival.txt000066400000000000000000000000441344564544500222710ustar00rootroot00000000000000ref-names: HEAD -> master, tag: 1.1 setuptools_scm_git_archive-1.1/.gitattributes000066400000000000000000000000401344564544500217050ustar00rootroot00000000000000.git_archival.txt export-subst setuptools_scm_git_archive-1.1/.gitignore000066400000000000000000000000571344564544500210120ustar00rootroot00000000000000*.egg-info/ /build/ /dist/ /env/ .cache/ *.pyc setuptools_scm_git_archive-1.1/LICENSE000066400000000000000000000017771344564544500200410ustar00rootroot00000000000000Permission 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_git_archive-1.1/README.rst000066400000000000000000000015031344564544500205060ustar00rootroot00000000000000This is a `setuptools_scm `_ plugin that adds support for git archives (for example the ones GitHub automatically generates). Note that it only works for archives of tagged commits (because git currently lacks a format option equivalent to ``git describe --tags``). Usage ----- Add ``'setuptools_scm_git_archive'`` to the ``setup_requires`` parameter in your project's ``setup.py`` file: .. code:: python setup( ..., use_scm_version=True, setup_requires=['setuptools_scm', 'setuptools_scm_git_archive'], ..., ) Create a ``.git_archival.txt`` file with the following content:: ref-names: $Format:%D$ Then add this line to the ``.gitattributes`` file:: .git_archival.txt export-subst Finally, don't forget to commit these two files. setuptools_scm_git_archive-1.1/setup.cfg000066400000000000000000000001101344564544500206310ustar00rootroot00000000000000[bdist_wheel] universal = 1 [devpi:upload] formats = sdist,bdist_wheel setuptools_scm_git_archive-1.1/setup.py000066400000000000000000000023351344564544500205350ustar00rootroot00000000000000from os.path import dirname, join from shutil import rmtree from pkg_resources import DistributionNotFound, load_entry_point, working_set from setuptools import find_packages, setup ENTRY_GROUP = 'setuptools_scm.parse_scm' ENTRY_GROUP_FALLBACK = 'setuptools_scm.parse_scm_fallback' ENTRY_NAME = '.git_archival.txt' ENTRY_POINT = ENTRY_NAME + ' = setuptools_scm_git_archive:parse' meta = dict( name='setuptools_scm_git_archive', description='setuptools_scm plugin for git archives', author='Changaco', author_email='changaco@changaco.oy.lc', url='https://github.com/Changaco/setuptools_scm_git_archive/', license='MIT', packages=find_packages(), long_description=open(join(dirname(__file__), 'README.rst')).read(), keywords='scm vcs version tags git archive', setup_requires=['setuptools-scm'], entry_points={ ENTRY_GROUP: ENTRY_POINT, ENTRY_GROUP_FALLBACK: ENTRY_POINT, }, ) # Clean up first, old eggs seem to confuse setuptools_scm rmtree(meta['name']+'.egg-info', ignore_errors=True) # Bootstrap try: load_entry_point(meta['name'], ENTRY_GROUP, ENTRY_NAME) except (DistributionNotFound, ImportError): working_set.add_entry('.') setup(use_scm_version=True, **meta) setuptools_scm_git_archive-1.1/setuptools_scm_git_archive/000077500000000000000000000000001344564544500244475ustar00rootroot00000000000000setuptools_scm_git_archive-1.1/setuptools_scm_git_archive/__init__.py000066400000000000000000000010061344564544500265550ustar00rootroot00000000000000from os.path import join import re from setuptools_scm.utils import data_from_mime, trace from setuptools_scm.version import meta, tags_to_versions tag_re = re.compile(r'(?<=\btag: )([^,]+)\b') def archival_to_version(data): trace('data', data) versions = tags_to_versions(tag_re.findall(data.get('ref-names', ''))) if versions: return meta(versions[0]) def parse(root): archival = join(root, '.git_archival.txt') data = data_from_mime(archival) return archival_to_version(data) setuptools_scm_git_archive-1.1/tests.py000066400000000000000000000011761344564544500205410ustar00rootroot00000000000000import pytest from setuptools_scm import format_version from setuptools_scm_git_archive import archival_to_version git_archival_mapping = { '1.0': {'ref-names': 'HEAD -> master, tag: foo, tag: 1.0'}, '1.1': {'ref-names': 'HEAD -> master, tag: release-1.1, tag: bar'}, '1.2': {'ref-names': 'HEAD -> master, tag: v1.2'}, } @pytest.mark.parametrize('expected,data', sorted(git_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