mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Setup: add universal wheel; update metadata; clean up setup.py
* Follow current setup.py recommendations from the pypa sample project (utf-8 encoding on file reads, ensure files are read relative to own location) * Add/update some missing classifiers and other metadata * Read _version.py constants into an isolated dict (rather than the global setup.py context) * Add setup.cfg specifying universal bdist_wheel
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@
|
||||
*.pyc
|
||||
*.egg
|
||||
*.egg-info
|
||||
build/
|
||||
dist/
|
||||
docs/_build/
|
||||
local.py
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
VERSION = (1, 4)
|
||||
VERSION = (2, 0, 0, 'dev5')
|
||||
__version__ = '.'.join([str(x) for x in VERSION]) # major.minor.patch or major.minor.devN
|
||||
__minor_version__ = '.'.join([str(x) for x in VERSION[:2]]) # Sphinx's X.Y "version"
|
||||
|
||||
5
setup.cfg
Normal file
5
setup.cfg
Normal file
@@ -0,0 +1,5 @@
|
||||
[metadata]
|
||||
license_file = LICENSE
|
||||
|
||||
[bdist_wheel]
|
||||
universal=1
|
||||
41
setup.py
41
setup.py
@@ -1,37 +1,42 @@
|
||||
from setuptools import setup
|
||||
import re
|
||||
from codecs import open # to use a consistent encoding
|
||||
from collections import OrderedDict
|
||||
from os import path
|
||||
from setuptools import setup
|
||||
|
||||
# define __version__ and __minor_version__ from anymail/_version.py,
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
|
||||
# get versions from anymail/_version.py,
|
||||
# but without importing from anymail (which would break setup)
|
||||
__version__ = "UNSET"
|
||||
__minor_version__ = "UNSET"
|
||||
with open("anymail/_version.py") as f:
|
||||
with open(path.join(here, "anymail/_version.py"), encoding='utf-8') as f:
|
||||
code = compile(f.read(), "anymail/_version.py", 'exec')
|
||||
exec(code)
|
||||
_version = {}
|
||||
exec(code, _version)
|
||||
version = _version["__version__"] # X.Y or X.Y.Z or X.Y.Z.dev1 etc.
|
||||
release_tag = "v%s" % version # vX.Y or vX.Y.Z
|
||||
|
||||
|
||||
def long_description_from_readme(rst):
|
||||
# Freeze external links (on PyPI) to refer to this X.Y or X.Y.Z tag.
|
||||
# (This relies on tagging releases with 'vX.Y' or 'vX.Y.Z' in GitHub.)
|
||||
release = 'v%s' % __version__ # vX.Y or vX.Y.Z
|
||||
rst = re.sub(r'(?<=branch=)master' # Travis build status: branch=master --> branch=vX.Y.Z
|
||||
r'|(?<=/)stable' # ReadTheDocs links: /stable --> /vX.Y.Z
|
||||
r'|(?<=version=)stable', # ReadTheDocs badge: version=stable --> version=vX.Y.Z
|
||||
release, rst) # (?<=...) is "positive lookbehind": must be there, but won't get replaced
|
||||
release_tag, rst) # (?<=...) is "positive lookbehind": must be there, but won't get replaced
|
||||
return rst
|
||||
|
||||
|
||||
with open('README.rst') as f:
|
||||
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||
long_description = long_description_from_readme(f.read())
|
||||
|
||||
|
||||
setup(
|
||||
name="django-anymail",
|
||||
version=__version__,
|
||||
version=version,
|
||||
description='Django email backends for Mailgun, Mailjet, Postmark, SendGrid, SparkPost '
|
||||
'and other transactional ESPs',
|
||||
keywords="django, email, email backend, ESP, transactional mail, mailgun, mailjet, mandrill, postmark, sendgrid",
|
||||
author="Mike Edmunds <medmunds@gmail.com>",
|
||||
author="Mike Edmunds and Anymail contributors",
|
||||
author_email="medmunds@gmail.com",
|
||||
url="https://github.com/anymail/django-anymail",
|
||||
license="BSD License",
|
||||
@@ -57,15 +62,29 @@ setup(
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Topic :: Communications :: Email",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Intended Audience :: Developers",
|
||||
"Framework :: Django",
|
||||
"Framework :: Django :: 1.8",
|
||||
"Framework :: Django :: 1.9",
|
||||
"Framework :: Django :: 1.10",
|
||||
"Framework :: Django :: 1.11",
|
||||
"Framework :: Django :: 2.0",
|
||||
"Environment :: Web Environment",
|
||||
],
|
||||
long_description=long_description,
|
||||
project_urls=OrderedDict([
|
||||
("Documentation", "https://anymail.readthedocs.io/en/%s/" % release_tag),
|
||||
("Source", "https://github.com/anymail/django-anymail"),
|
||||
("Changelog", "https://github.com/anymail/django-anymail/releases"),
|
||||
("Tracker", "https://github.com/anymail/django-anymail/issues"),
|
||||
]),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user