diff --git a/.gitignore b/.gitignore index 5b48bcd..1606ed7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ dist/** django_request_cache.egg-info/** .idea/** +.vscode/** venv/ build/ .tox/ + diff --git a/LICENSE b/LICENSE index 89d90d7..0556e2c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Christian Kreuzberger +Copyright (c) 2017-2020 Christian Kreuzberger, Anexia Internetdienstleistungs GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/setup.py b/setup.py index 395ae9f..6a05ff0 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,65 @@ +import io import os +import sys +from shutil import rmtree -from setuptools import find_packages, setup +from setuptools import find_packages, setup, Command -with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: - README = readme.read() +VERSION = '1.2' + +here = os.path.abspath(os.path.dirname(__file__)) +with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f: + README = '\n' + f.read() + + +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 {0}'.format(VERSION)) + os.system('git push --tags') + + sys.exit() -# allow setup.py to be run from any path -os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-request-cache', - version='1.2', + version=VERSION, packages=find_packages(), include_package_data=True, license='MIT', description='A simple Django app that provides a per-request cache.', long_description=README, - url='https://github.com/anx-ckreuzberger/django-request-cache', - author='Christian Kreuzberger', - author_email='ckreuzberger@anexia-it.com', + url='https://github.com/anexia-it/django-request-cache', + author='Harald Nezbeda', + author_email='hnezbeda@anexia-it.com', install_requires=[ "django>=2.1", "django_userforeignkey"