|
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | + |
| 4 | +# Note: To use the 'upload' functionality of this file, you must: |
| 5 | +# $ pip install twine |
| 6 | + |
| 7 | +import io |
| 8 | +import os |
| 9 | +import sys |
| 10 | +from shutil import rmtree |
| 11 | + |
| 12 | +from setuptools import find_packages, setup, Command |
| 13 | + |
| 14 | +# Package meta-data. |
| 15 | +NAME = "bossphorus" |
| 16 | +DESCRIPTION = "Bossphorus is a volumetric database that emulates the bossDB API." |
| 17 | +URL = "https://github.com/aplbrain/bossphorus" |
| 18 | + |
| 19 | +AUTHOR = "Jordan Matelsky" |
| 20 | +REQUIRES_PYTHON = ">=3.6.0" |
| 21 | +VERSION = "0.3.0" |
| 22 | + |
| 23 | +# What packages are required for this module to be executed? |
| 24 | +REQUIRED = ["intern", "flask", "h5py", "numpy", "blosc"] |
| 25 | + |
| 26 | +# What packages are suggested for doing development? |
| 27 | +DEVELOPING_REQS = ["pytest", "pylint"] |
| 28 | + |
| 29 | +here = os.path.abspath(os.path.dirname(__file__)) |
| 30 | + |
| 31 | +with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f: |
| 32 | + long_description = "\n" + f.read() |
| 33 | + |
| 34 | +about = {} |
| 35 | +about["__version__"] = VERSION |
| 36 | + |
| 37 | + |
| 38 | +class UploadCommand(Command): |
| 39 | + """Support setup.py upload.""" |
| 40 | + |
| 41 | + description = "Build and publish the package." |
| 42 | + user_options = [] |
| 43 | + |
| 44 | + @staticmethod |
| 45 | + def status(s): |
| 46 | + """Prints things in bold.""" |
| 47 | + print("\033[1m{0}\033[0m".format(s)) |
| 48 | + |
| 49 | + def initialize_options(self): |
| 50 | + pass |
| 51 | + |
| 52 | + def finalize_options(self): |
| 53 | + pass |
| 54 | + |
| 55 | + def run(self): |
| 56 | + try: |
| 57 | + self.status("Removing previous builds…") |
| 58 | + rmtree(os.path.join(here, "dist")) |
| 59 | + except OSError: |
| 60 | + pass |
| 61 | + |
| 62 | + self.status("Building Source and Wheel (universal) distribution…") |
| 63 | + os.system("{0} setup.py sdist bdist_wheel --universal".format(sys.executable)) |
| 64 | + |
| 65 | + self.status("Uploading the package to PyPi via Twine…") |
| 66 | + os.system("twine upload dist/*") |
| 67 | + |
| 68 | + self.status("Pushing git tags…") |
| 69 | + os.system("git tag v{0}".format(about["__version__"])) |
| 70 | + os.system("git push --tags") |
| 71 | + |
| 72 | + sys.exit() |
| 73 | + |
| 74 | + |
| 75 | +# Where the magic happens: |
| 76 | +setup( |
| 77 | + name=NAME, |
| 78 | + version=about["__version__"], |
| 79 | + description=DESCRIPTION, |
| 80 | + long_description=long_description, |
| 81 | + long_description_content_type="text/markdown", |
| 82 | + author=AUTHOR, |
| 83 | + author_email=EMAIL, |
| 84 | + python_requires=REQUIRES_PYTHON, |
| 85 | + url=URL, |
| 86 | + packages=find_packages(exclude=("tests",)), |
| 87 | + scripts=[], |
| 88 | + install_requires=REQUIRED, |
| 89 | + extras_require={"dev": DEVELOPING_REQS}, |
| 90 | + include_package_data=True, |
| 91 | + license="Apache 2.0", |
| 92 | + classifiers=[ |
| 93 | + # Trove classifiers |
| 94 | + # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers |
| 95 | + "License :: OSI Approved :: MIT License", |
| 96 | + "Programming Language :: Python", |
| 97 | + "Programming Language :: Python :: 3", |
| 98 | + "Programming Language :: Python :: 3.6", |
| 99 | + ], |
| 100 | + # $ setup.py publish support. |
| 101 | + cmdclass={"upload": UploadCommand}, |
| 102 | +) |
0 commit comments