From 4f1731772dd84a41ed0756ac3a7953c3d021b1cd Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Sat, 9 Nov 2019 20:01:55 -0600 Subject: version --- .gitignore | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 31 +++++++++++++++++++++++++++++++ shopdb/VERSION | 1 + shopdb/__version__.py | 29 +++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 .gitignore create mode 100644 shopdb/VERSION create mode 100644 shopdb/__version__.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc58411 --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# byte-compiled +__pycache__/ +*.py[cod] + +# direnv +*.envrc + +# distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +temp/ +*.egg-info/ +.installed.cfg +*.egg +*.p + +# emacs +flycheck_*.el +.projectile +*.#* + +# images +*.jpg +*.gif +*.png +!logo/logo.png +*.svg +*.ico + +# tests / coverage reports +.coverage +.coverage.* +.cache +coverage.xml +*,cover +.pytest_cache/* + +# vim +*.sw? diff --git a/setup.py b/setup.py index e69de29..2dfe48e 100644 --- a/setup.py +++ b/setup.py @@ -0,0 +1,31 @@ +#! /usr/bin/env python3 + +import os +from setuptools import setup, find_packages + + +here = os.path.abspath(os.path.dirname(__file__)) + + +def read(fname): + return open(os.path.join(here, fname)).read() + + +with open(os.path.join(here, "shopdb", "VERSION")) as version_file: + version = version_file.read().strip() + +extra_files = {"shopdb": ["VERSION"]} + +setup( + name="shopdb", + packages=find_packages(), + package_data=extra_files, + python_requires=">=3.7", + install_requires=[], + extras_require={ + "dev": ["black", "pre-commit", "pydocstyle"], + }, + version=version, + author="Blaise Thompson", + author_email="bthompson@chem.wisc.edu", +) diff --git a/shopdb/VERSION b/shopdb/VERSION new file mode 100644 index 0000000..bd52db8 --- /dev/null +++ b/shopdb/VERSION @@ -0,0 +1 @@ +0.0.0 \ No newline at end of file diff --git a/shopdb/__version__.py b/shopdb/__version__.py new file mode 100644 index 0000000..4d42882 --- /dev/null +++ b/shopdb/__version__.py @@ -0,0 +1,29 @@ +"""Define version.""" + + +import pathlib + + +here = pathlib.Path(__file__).resolve().parent + + +__all__ = ["__version__", "__branch__"] + + +# read from VERSION file +with open(str(here / "VERSION")) as f: + __version__ = f.read().strip() + + +# add git branch, if appropriate +p = here.parent / ".git" +if p.is_file(): + with open(str(p)) as f: + p = p.parent / f.readline()[8:].strip() # Strip "gitdir: " +p = p / "HEAD" +if p.exists(): + with open(str(p)) as f: + __branch__ = f.readline().rstrip().split(r"/")[-1] + __version__ += "+" + __branch__ +else: + __branch__ = "" -- cgit v1.2.3