diff --git a/django_inlinecss/__version__.py b/django_inlinecss/__version__.py index de81264..dfd69f9 100644 --- a/django_inlinecss/__version__.py +++ b/django_inlinecss/__version__.py @@ -1,3 +1,3 @@ -VERSION = (0, 1, 2) +VERSION = (0, 2, 0) __version__ = '.'.join(map(str, VERSION)) diff --git a/setup.py b/setup.py index cfd184d..5ffb105 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,10 @@ import io import os +import sys +from shutil import rmtree +from setuptools import Command from setuptools import find_packages from setuptools import setup @@ -72,6 +75,43 @@ about['__version__'] = VERSION +class UploadCommand(Command): + """Support setup.py upload.""" + + description = 'Build and publish the package.' + user_options = [] + + @staticmethod + def status(s): + """Prints things in bold.""" + print('\033[1m{0}\033[0m'.format(s)) + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + try: + self.status('Removing previous builds…') + rmtree(os.path.join(here, 'dist')) + except OSError: + pass + + self.status('Building Source and Wheel (universal) distribution…') + os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) + + self.status('Uploading the package to PyPI via Twine…') + os.system('twine upload dist/*') + + self.status('Pushing git tags…') + os.system('git tag v{0}'.format(about['__version__'])) + os.system('git push --tags') + + sys.exit() + + setup( name=NAME, version=about['__version__'], @@ -104,4 +144,8 @@ install_requires=REQUIRED, tests_require=TESTS, extras_require=EXTRAS, + # $ setup.py upload support. + cmdclass={ + 'upload': UploadCommand, + }, )