|
| 1 | +import io |
1 | 2 | import os
|
| 3 | +import sys |
| 4 | +from shutil import rmtree |
2 | 5 |
|
3 |
| -from setuptools import find_packages, setup |
| 6 | +from setuptools import find_packages, setup, Command |
4 | 7 |
|
5 |
| -with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: |
6 |
| - README = readme.read() |
| 8 | +VERSION = '1.1.0' |
| 9 | + |
| 10 | +here = os.path.abspath(os.path.dirname(__file__)) |
| 11 | +with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: |
| 12 | + README = '\n' + f.read() |
| 13 | + |
| 14 | + |
| 15 | +class UploadCommand(Command): |
| 16 | + """Support setup.py upload.""" |
| 17 | + |
| 18 | + description = 'Build and publish the package.' |
| 19 | + user_options = [] |
| 20 | + |
| 21 | + @staticmethod |
| 22 | + def status(s): |
| 23 | + """Prints things in bold.""" |
| 24 | + print('\033[1m{0}\033[0m'.format(s)) |
| 25 | + |
| 26 | + def initialize_options(self): |
| 27 | + pass |
| 28 | + |
| 29 | + def finalize_options(self): |
| 30 | + pass |
| 31 | + |
| 32 | + def run(self): |
| 33 | + try: |
| 34 | + self.status('Removing previous builds...') |
| 35 | + rmtree(os.path.join(here, 'dist')) |
| 36 | + except OSError: |
| 37 | + pass |
| 38 | + |
| 39 | + self.status('Building Source and Wheel (universal) distribution...') |
| 40 | + os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) |
| 41 | + |
| 42 | + self.status('Uploading the package to PyPI via Twine...') |
| 43 | + os.system('twine upload dist/*') |
| 44 | + |
| 45 | + self.status('Pushing git tags...') |
| 46 | + os.system('git tag {0}'.format(VERSION)) |
| 47 | + os.system('git push --tags') |
| 48 | + |
| 49 | + sys.exit() |
7 | 50 |
|
8 |
| -# allow setup.py to be run from any path |
9 |
| -os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) |
10 | 51 |
|
11 | 52 | setup(
|
12 | 53 | name='django-rest-passwordreset',
|
13 |
| - version='1.1.0rc3', |
| 54 | + version=VERSION, |
14 | 55 | packages=find_packages(),
|
15 | 56 | include_package_data=True,
|
16 | 57 | license='BSD License',
|
17 | 58 | description='An extension of django rest framework, providing a configurable password reset strategy',
|
18 | 59 | long_description=README,
|
19 | 60 | long_description_content_type='text/markdown', # This is important for README.md in markdown format
|
20 |
| - url='https://github.com/anx-ckreuzberger/django-rest-passwordreset', |
21 |
| - author='Christian Kreuzberger', |
22 |
| - author_email='ckreuzberger@anexia-it.com', |
| 61 | + url='https://github.com/anexia-it/django-rest-passwordreset', |
| 62 | + author='Harald Nezbeda', |
| 63 | + author_email='hnezbeda@anexia-it.com', |
23 | 64 | classifiers=[
|
24 | 65 | 'Development Status :: 5 - Production/Stable',
|
25 | 66 | 'Environment :: Web Environment',
|
26 | 67 | 'Framework :: Django',
|
27 | 68 | 'Framework :: Django :: 1.11',
|
28 |
| - 'Framework :: Django :: 2.0', |
29 |
| - 'Framework :: Django :: 2.1', |
30 | 69 | 'Framework :: Django :: 2.2',
|
31 | 70 | 'Intended Audience :: Developers',
|
32 | 71 | 'License :: OSI Approved :: BSD License',
|
|
38 | 77 | 'Programming Language :: Python :: 3.4',
|
39 | 78 | 'Programming Language :: Python :: 3.5',
|
40 | 79 | 'Programming Language :: Python :: 3.6',
|
| 80 | + 'Programming Language :: Python :: 3.7', |
| 81 | + 'Programming Language :: Python :: 3.8', |
41 | 82 | 'Topic :: Internet :: WWW/HTTP',
|
42 | 83 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
43 | 84 | ],
|
| 85 | + # $ setup.py upload support. |
| 86 | + cmdclass={ |
| 87 | + 'upload': UploadCommand, |
| 88 | + }, |
44 | 89 | )
|
0 commit comments