From eddb233270837834e550c1926acbb3fac5312eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Tue, 19 Feb 2019 16:26:31 -0500 Subject: [PATCH] use setuptool_scm plugin to main version Get the version from the git tag and the last commit sha. --- .gitignore | 3 +++ setup.py | 6 ++++++ tox.ini | 4 ++-- virt_lightning/__init__.py | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 virt_lightning/__init__.py diff --git a/.gitignore b/.gitignore index d4c1dcb..da14430 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,6 @@ target/ #Ipython Notebook .ipynb_checkpoints + +# maintain by setuptools-scm +virt_lightning/version.py diff --git a/setup.py b/setup.py index 6eabd4e..a8b46e8 100644 --- a/setup.py +++ b/setup.py @@ -45,16 +45,21 @@ def _get_readme(): author_email="goneri@lebouder.net", description="Deploy your testing VM in a couple of sections", long_description=_get_readme(), + long_description_content_type="text/markdown", install_requires=_get_requirements(), url="https://github.com/virt-lightning/virt-lightning", + use_scm_version={"write_to": "virt_lightning/version.py"}, license="Apache v2.0", + platforms=["linux"], classifiers=[ "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: Apache Software License", "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Topic :: System :: Distributed Computing", ], entry_points={ @@ -63,4 +68,5 @@ def _get_readme(): "vl = virt_lightning.shell:main", ] }, + setup_requires=["setuptools_scm"], ) diff --git a/tox.ini b/tox.ini index e2af5f2..0607375 100644 --- a/tox.ini +++ b/tox.ini @@ -26,11 +26,11 @@ deps = flake8 flake8-type-annotations flake8-broken-line # flake8-print -commands = flake8 setup.py virt_lightning +commands = flake8 --exclude=version.py setup.py virt_lightning [testenv:black] commands = - black --diff --check setup.py virt_lightning + black --diff --check --exclude=version.py setup.py virt_lightning [isort] line_length=90 diff --git a/virt_lightning/__init__.py b/virt_lightning/__init__.py new file mode 100644 index 0000000..34a99a3 --- /dev/null +++ b/virt_lightning/__init__.py @@ -0,0 +1,4 @@ +try: + from .version import __version__ +except ImportError: + __version__ = None