diff --git a/HISTORY.rst b/HISTORY.rst index dc305574..3fd12992 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,6 +6,12 @@ Pending .. Insert new release notes below this line +* Converted setuptools metadata to configuration file. This meant removing the + ``__version__`` attribute from the package. If you want to inspect the + installed version, use + ``pkg_resources.get_distribution("django-cors-headers").version`` + (`docs `__). + 3.1.1 (2019-09-30) ------------------ diff --git a/corsheaders/__init__.py b/corsheaders/__init__.py index fa3ec0af..9a5e15b9 100644 --- a/corsheaders/__init__.py +++ b/corsheaders/__init__.py @@ -1,3 +1 @@ from corsheaders.checks import check_settings # noqa: F401 - -__version__ = "3.1.1" diff --git a/setup.cfg b/setup.cfg index 684a81de..98b63853 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,48 @@ +[metadata] +name = django-cors-headers +version = 3.1.1 +description = django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS). +long_description = file: README.rst, HISTORY.rst +long_description_content_type = text/x-rst +author = Otto Yiu +author_email = otto@live.ca +maintainer = Adam Johnson +maintainer_email = me@adamj.eu +url = https://github.com/adamchainz/django-cors-headers +project_urls = + Changelog = https://github.com/adamchainz/django-cors-headers/blob/master/HISTORY.rst +license = MIT License +keywords = + django + cors + middleware + rest + api +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Web Environment + Framework :: Django + Framework :: Django :: 1.11 + Framework :: Django :: 2.0 + Framework :: Django :: 2.1 + Framework :: Django :: 2.2 + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Topic :: Software Development :: Libraries :: Application Frameworks + Topic :: Software Development :: Libraries :: Python Modules +license_file = LICENSE + +[options] +packages = corsheaders +install_requires = Django>=1.11 +python_requires = >=3.5 + [flake8] max-line-length = 80 select = C,E,F,W,B,B950 @@ -12,11 +57,8 @@ line_length = 88 multi_line_output = 3 use_parentheses = True -[metadata] -license_file = LICENSE - [tool:multilint] paths = corsheaders - runtests.py - tests - setup.py + runtests.py + tests + setup.py diff --git a/setup.py b/setup.py index 05f57107..60684932 100644 --- a/setup.py +++ b/setup.py @@ -1,64 +1,3 @@ -import os -import re - from setuptools import setup - -def get_version(filename): - with open(filename, "r") as fp: - contents = fp.read() - return re.search(r"__version__ = ['\"]([^'\"]+)['\"]", contents).group(1) - - -version = get_version(os.path.join("corsheaders", "__init__.py")) - -with open("README.rst", "r") as readme_file: - readme = readme_file.read() - -with open("HISTORY.rst", "r") as history_file: - history = history_file.read() - -setup( - name="django-cors-headers", - version=version, - description=( - "django-cors-headers is a Django application for handling the server " - "headers required for Cross-Origin Resource Sharing (CORS)." - ), - long_description=readme + "\n\n" + history, - author="Otto Yiu", - author_email="otto@live.ca", - maintainer="Adam Johnson", - maintainer_email="me@adamj.eu", - url="https://github.com/adamchainz/django-cors-headers", - project_urls={ - "Changelog": ( - "https://github.com/adamchainz/django-cors-headers" - + "/blob/master/HISTORY.rst" - ) - }, - packages=["corsheaders"], - license="MIT License", - keywords=["django", "cors", "middleware", "rest", "api"], - install_requires=["Django>=1.11"], - python_requires=">=3.5", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Framework :: Django", - "Framework :: Django :: 1.11", - "Framework :: Django :: 2.0", - "Framework :: Django :: 2.1", - "Framework :: Django :: 2.2", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Topic :: Software Development :: Libraries :: Application Frameworks", - "Topic :: Software Development :: Libraries :: Python Modules", - ], -) +setup()