How to use versioneer - 10 common examples

To help you get started, we’ve selected a few versioneer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github warner / python-versioneer / test / demoapp-script-only / setup.py View on Github external
def run(self):
        versions = versioneer.get_versions()
        tempdir = tempfile.mkdtemp()
        generated = os.path.join(tempdir, "rundemo")
        with open(generated, "wb") as f:
            for line in open("src/rundemo-template", "rb"):
                if line.strip().decode("ascii") == "#versions":
                    f.write(('versions = %r\n' % (versions,)).encode("ascii"))
                else:
                    f.write(line)
        self.scripts = [generated]
        rc = build_scripts.run(self)
        os.unlink(generated)
        os.rmdir(tempdir)
        return rc
commands["build_scripts"] = my_build_scripts
github drdoctr / doctr / setup.py View on Github external
#!/usr/bin/env python

import sys
if sys.version_info < (3,5):
    sys.exit("doctr requires Python 3.5 or newer")

from setuptools import setup
import versioneer

setup(
    name='doctr',
    version=versioneer.get_version(),
    cmdclass=versioneer.get_cmdclass(),
    author='Aaron Meurer and Gil Forsyth',
    author_email='asmeurer@gmail.com',
    url='https://github.com/drdoctr/doctr',
    packages=['doctr', 'doctr.tests'],
    description='Deploy docs from Travis to GitHub pages.',
    long_description=open("README.rst").read(),
    entry_points={'console_scripts': [ 'doctr = doctr.__main__:main']},
    python_requires= '>=3.5',
    install_requires=[
        'pyyaml',
        'requests',
        'cryptography',
    ],
    license="MIT",
    classifiers=[
github alisaifee / flask-limiter / versioneer.py View on Github external
def git_versions_from_keywords(keywords, tag_prefix, verbose):
    """Get version information from git keywords."""
    if not keywords:
        raise NotThisMethod("no keywords at all, weird")
    date = keywords.get("date")
    if date is not None:
        # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
        # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
        # -like" string, which we must then edit to make compliant), because
        # it's been around since git-1.5.3, and it's too difficult to
        # discover which version we're using, or to work around using an
        # older one.
        date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
    refnames = keywords["refnames"].strip()
    if refnames.startswith("$Format"):
        if verbose:
            print("keywords are unexpanded, not using")
        raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
    refs = set([r.strip() for r in refnames.strip("()").split(",")])
    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
github conda-forge / conda-smithy / versioneer.py View on Github external
def git_versions_from_keywords(keywords, tag_prefix, verbose):
    """Get version information from git keywords."""
    if not keywords:
        raise NotThisMethod("no keywords at all, weird")
    refnames = keywords["refnames"].strip()
    if refnames.startswith("$Format"):
        if verbose:
            print("keywords are unexpanded, not using")
        raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
    refs = [r.strip() for r in refnames.strip("()").split(",")]
    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
    # just "foo-1.0". If we see a "tag: " prefix, prefer those.
    TAG = "tag: "
    tags = set([r[len(TAG) :] for r in refs if r.startswith(TAG)])
    if not tags:
        # Either we're using git < 1.8.3, or there really are no tags. We use
        # a heuristic: assume all version tags have a digit. The old git %d
        # expansion behaves like git log --decorate=short and strips out the
        # refs/heads/ and refs/tags/ prefixes that would let us distinguish
        # between branches and tags. By ignoring refnames without digits, we
github numba / llvmlite / setup.py View on Github external
from distutils.command.clean import clean
from distutils import log
from distutils.dir_util import remove_tree
from distutils.spawn import spawn
import os
import sys
import shutil

if os.environ.get('READTHEDOCS', None) == 'True':
    sys.exit("setup.py disabled on readthedocs: called with %s"
             % (sys.argv,))

import versioneer

versioneer.VCS = 'git'
versioneer.versionfile_source = 'llvmlite/_version.py'
versioneer.versionfile_build = 'llvmlite/_version.py'
versioneer.tag_prefix = 'v' # tags are like v1.2.0
versioneer.parentdir_prefix = 'llvmlite-' # dirname like 'myproject-1.2.0'


here_dir = os.path.dirname(os.path.abspath(__file__))

cmdclass = versioneer.get_cmdclass()
build = cmdclass.get('build', build)
build_ext = cmdclass.get('build_ext', build_ext)


def build_library_files(dry_run, pic=False):
    cmd = [sys.executable, os.path.join(here_dir, 'ffi', 'build.py')]
    if pic:
        os.environ['CXXFLAGS'] = os.environ.get('CXXFLAGS', '') + ' -fPIC'
github dib-lab / khmer / doc / conf.py View on Github external
copyright = u'''2010-2014 Michael R. Crusoe, Greg Edvenson, Jordan
Fish, Adina Howe, Luiz Irber, Eric McDonald, Joshua Nahum, Kaben Nanlohy,
Humberto Ortiz-Zuazaga, Jason Pell, Jared Simpson, Camille Scott, Ramakrishnan
Rajaram Srinivasan, Qingpeng Zhang, and C. Titus Brown'''

# 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.
#

# The full version, including alpha/beta/rc tags.

sys.path.insert(0, '../')
import versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = '../khmer/_version.py'
versioneer.versionfile_build = '../khmer/_version.py'
versioneer.tag_prefix = 'v'  # tags are like v1.2.0
versioneer.parentdir_prefix = '..'
release = versioneer.get_version()
del versioneer
sys.path.remove('../')

# 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.
#language = None
github axltxl / m2bk / setup.py View on Github external
# Check minimum Python version
PYVER_MAJOR = 3
PYVER_MINOR = 3
if not (sys.version_info[0] == PYVER_MAJOR and sys.version_info[1] >= PYVER_MINOR):
    print("Sorry, Python >= 3.3 is supported (for the moment")
    sys.exit(1)

from setuptools import setup, find_packages
import versioneer
import os
from m2bk.const import PKG_NAME, PKG_URL


# versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = "{p}/_version.py".format(p=PKG_NAME)
versioneer.versionfile_build = "{p}/_version.py".format(p=PKG_NAME)
versioneer.tag_prefix = ''
versioneer.parentdir_prefix = "{p}-".format(p=PKG_NAME)

# default config file location
if sys.prefix != '/usr':
    conf_dir = os.path.join(sys.prefix, 'etc')
else:
    conf_dir = '/etc'

pkg_ver = versioneer.get_version()

setup(
    name=PKG_NAME,
    version=pkg_ver,
    cmdclass=versioneer.get_cmdclass(),
github fhcrc / taxtastic / setup.py View on Github external
# try:
#     from pysqlite2 import dbapi2 as sqlite3
#     print 'using pysqlite2, sqlite3 version {}'.format(sqlite3.sqlite_version)
# except ImportError:
#     import sqlite3
#     print 'using sqlite3, sqlite3 version {}'.format(sqlite3.sqlite_version)

# min_sqlite3_version = '3.8.3'
# if LooseVersion(sqlite3.sqlite_version) < LooseVersion(min_sqlite3_version):
#     raise ImportError(('the sqlite3 library version for this python interpreter is '
#                        '{}, but a version >= {} is required; '
#                        'see https://github.com/fhcrc/taxtastic#installing').format(
#                            sqlite3.sqlite_version, min_sqlite3_version))

versioneer.versionfile_source = 'taxtastic/_version.py'
versioneer.versionfile_build = 'taxtastic/_version.py'
versioneer.tag_prefix = 'v'  # tags are like v1.2.0
versioneer.parentdir_prefix = 'taxtastic-'

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as fi:
    long_description = fi.read()


class run_audit(Command):
    """Audits source code using PyFlakes for following issues:
        - Names which are used but not defined or used before they are defined.
        - Names which are redefined without having been used.
    """
github axltxl / m2bk / setup.py View on Github external
if not (sys.version_info[0] == PYVER_MAJOR and sys.version_info[1] >= PYVER_MINOR):
    print("Sorry, Python >= 3.3 is supported (for the moment")
    sys.exit(1)

from setuptools import setup, find_packages
import versioneer
import os
from m2bk.const import PKG_NAME, PKG_URL


# versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = "{p}/_version.py".format(p=PKG_NAME)
versioneer.versionfile_build = "{p}/_version.py".format(p=PKG_NAME)
versioneer.tag_prefix = ''
versioneer.parentdir_prefix = "{p}-".format(p=PKG_NAME)

# default config file location
if sys.prefix != '/usr':
    conf_dir = os.path.join(sys.prefix, 'etc')
else:
    conf_dir = '/etc'

pkg_ver = versioneer.get_version()

setup(
    name=PKG_NAME,
    version=pkg_ver,
    cmdclass=versioneer.get_cmdclass(),
    packages=find_packages(exclude=["tests"]),
    author="Alejandro Ricoveri",
    author_email="alejandroricoveri@gmail.com",
github alliedtelesis / py-networking / setup.py View on Github external
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
from setuptools import setup, Command
from setuptools.command.test import test as TestCommand
import versioneer

versioneer.versionfile_source = 'pynetworking/_version.py'
versioneer.versionfile_build = 'pynetworking/_version.py'
versioneer.tag_prefix = 'v'  # tags are like v1.2.0
versioneer.parentdir_prefix = 'py-networking-'


class ToxCommand(TestCommand):
    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        # import here, cause outside the eggs aren't loaded
        import tox
        errno = tox.cmdline(self.test_args)
        sys.exit(errno)


class CleanCommand(Command):