|
1 |
| -#!/usr/bin/env python |
2 |
| -# -*- coding: utf-8 -*- |
| 1 | +from codecs import open |
| 2 | +from os import path |
3 | 3 |
|
4 |
| -# Example copied with love from: |
5 |
| -# https://github.com/kennethreitz/setup.py/blob/master/setup.py |
6 |
| - |
7 |
| -# Note: To use the 'upload' functionality of this file, you must: |
8 |
| -# $ pip install twine |
9 |
| - |
10 |
| -import io |
11 |
| -import os |
12 |
| -import sys |
13 |
| -from shutil import rmtree |
14 |
| - |
15 |
| -from setuptools import Command, find_packages, setup |
| 4 | +from setuptools import find_packages, setup |
16 | 5 |
|
17 | 6 | # Package meta-data.
|
18 | 7 | NAME = "grits"
|
19 | 8 | DESCRIPTION = "A toolkit for working with coarse-grained systems"
|
20 | 9 | URL = "https://github.com/cmelab/grits"
|
21 | 10 | EMAIL = "jennyfothergill@boisestate.edu"
|
22 | 11 | AUTHOR = "Jenny Fothergill"
|
23 |
| -REQUIRES_PYTHON = ">=3.7.0" |
| 12 | +REQUIRES_PYTHON = ">=3.8" |
24 | 13 |
|
25 | 14 | # What packages are required for this module to be executed?
|
26 | 15 | REQUIRED = ["mbuild", "numpy"]
|
27 | 16 |
|
28 |
| -# The rest you shouldn't have to touch too much :) |
29 |
| -# ------------------------------------------------ |
30 |
| -# Except, perhaps the License and Trove Classifiers! |
31 |
| -# If you do change the License, remember to change the Trove Classifier! |
32 |
| - |
33 |
| -here = os.path.abspath(os.path.dirname(__file__)) |
34 |
| - |
35 |
| -# Load the package's __version__.py module as a dictionary. |
36 |
| -about = {} |
37 |
| -with open(os.path.join(here, NAME, "__version__.py")) as f: |
38 |
| - exec(f.read(), about) |
39 |
| - |
40 |
| - |
41 |
| -class UploadCommand(Command): |
42 |
| - """Support setup.py upload.""" |
43 | 17 |
|
44 |
| - description = "Build and publish the package." |
45 |
| - user_options = [] |
| 18 | +here = path.abspath(path.dirname(__file__)) |
46 | 19 |
|
47 |
| - @staticmethod |
48 |
| - def status(s): |
49 |
| - """Prints things in bold.""" |
50 |
| - print("\033[1m{0}\033[0m".format(s)) |
| 20 | +with open("README.md", "r", encoding="utf-8") as f: |
| 21 | + long_description = f.read() |
51 | 22 |
|
52 |
| - def initialize_options(self): |
53 |
| - pass |
54 | 23 |
|
55 |
| - def finalize_options(self): |
56 |
| - pass |
| 24 | +def myversion(): |
| 25 | + from setuptools_scm.version import get_local_dirty_tag |
57 | 26 |
|
58 |
| - def run(self): |
59 |
| - try: |
60 |
| - self.status("Removing previous builds…") |
61 |
| - rmtree(os.path.join(here, "dist")) |
62 |
| - except OSError: |
63 |
| - pass |
| 27 | + def clean_scheme(version): |
| 28 | + return get_local_dirty_tag(version) if version.dirty else "+clean" |
64 | 29 |
|
65 |
| - self.status("Building Source and Wheel (universal) distribution…") |
66 |
| - os.system(f"{sys.executable} setup.py sdist bdist_wheel --universal") |
| 30 | + return {"local_scheme": clean_scheme} |
67 | 31 |
|
68 |
| - self.status("Uploading the package to PyPi via Twine…") |
69 |
| - os.system("twine upload dist/*") |
70 | 32 |
|
71 |
| - self.status("Pushing git tags…") |
72 |
| - os.system(f"git tag v{about['__version__']}") |
73 |
| - os.system("git push --tags") |
74 |
| - |
75 |
| - sys.exit() |
76 |
| - |
77 |
| - |
78 |
| -# Where the magic happens: |
79 | 33 | setup(
|
80 | 34 | name=NAME,
|
81 |
| - version=about["__version__"], |
82 |
| - description=DESCRIPTION, |
| 35 | + use_scm_version=myversion, |
83 | 36 | author=AUTHOR,
|
84 | 37 | author_email=EMAIL,
|
85 |
| - python_requires=REQUIRES_PYTHON, |
| 38 | + description=DESCRIPTION, |
| 39 | + long_description=long_description, |
| 40 | + long_description_content_type="text/markdown", |
86 | 41 | url=URL,
|
| 42 | + license="GPLv3", |
| 43 | + project_urls={ |
| 44 | + "Bug Tracker": f"{URL}/issues", |
| 45 | + }, |
| 46 | + python_requires=REQUIRES_PYTHON, |
87 | 47 | packages=find_packages(exclude=("tests", "docs", "examples")),
|
88 |
| - # If your package is a single module, use this instead of 'packages': |
89 |
| - # py_modules=['mypackage'], |
90 |
| - # entry_points={ |
91 |
| - # 'console_scripts': ['mycli=mymodule:cli'], |
92 |
| - # }, |
93 | 48 | package_data={"grits": ["compounds/*"]},
|
94 | 49 | install_requires=REQUIRED,
|
95 | 50 | include_package_data=True,
|
96 |
| - license="MIT", |
97 | 51 | classifiers=[
|
98 | 52 | # Trove classifiers
|
99 | 53 | # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
100 | 54 | "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
101 | 55 | "Programming Language :: Python",
|
102 | 56 | "Programming Language :: Python :: 3",
|
103 |
| - "Programming Language :: Python :: 3.7", |
104 |
| - "Programming Language :: Python :: Implementation :: CPython", |
105 |
| - "Programming Language :: Python :: Implementation :: PyPy", |
| 57 | + "Programming Language :: Python :: 3.8", |
106 | 58 | ],
|
107 |
| - # $ setup.py publish support. |
108 |
| - cmdclass={"upload": UploadCommand}, |
109 | 59 | )
|
0 commit comments