attrs/setup.py

95 lines
2.7 KiB
Python
Raw Normal View History

2015-01-27 16:53:17 +00:00
import codecs
import os
import re
from setuptools import setup, find_packages
2015-09-22 12:22:21 +00:00
###############################################################################
2015-02-21 13:08:36 +00:00
NAME = "attrs"
2015-10-18 10:15:06 +00:00
PACKAGES = find_packages(where="src")
META_PATH = os.path.join("src", "attr", "__init__.py")
2015-09-22 12:22:21 +00:00
KEYWORDS = ["class", "attribute", "boilerplate"]
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"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 :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules",
]
INSTALL_REQUIRES = []
2015-02-21 13:08:36 +00:00
###############################################################################
HERE = os.path.abspath(os.path.dirname(__file__))
2015-01-27 16:53:17 +00:00
def read(*parts):
"""
Build an absolute path from *parts* and and return the contents of the
resulting file. Assume UTF-8 encoding.
"""
2015-02-21 13:08:36 +00:00
with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
2015-01-27 16:53:17 +00:00
return f.read()
2015-02-21 13:08:36 +00:00
META_FILE = read(META_PATH)
def find_meta(meta):
2015-01-27 16:53:17 +00:00
"""
2015-02-21 13:08:36 +00:00
Extract __*meta*__ from META_FILE.
2015-01-27 16:53:17 +00:00
"""
2015-02-21 13:08:36 +00:00
meta_match = re.search(
r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta),
META_FILE, re.M
)
if meta_match:
return meta_match.group(1)
raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
2015-01-27 16:53:17 +00:00
VERSION = find_meta("version")
2016-02-20 08:34:45 +00:00
URI = find_meta("uri")
LONG = (
read("README.rst") + "\n\n" +
"Release Information\n" +
"===================\n\n" +
re.search("(\d+.\d.\d \(.*?\)\n.*?)\n\n\n----\n\n\n",
read("CHANGELOG.rst"), re.S).group(1) +
"\n\n`Full changelog " +
"<{uri}en/stable/changelog.html>`_.\n\n".format(uri=URI) +
read("AUTHORS.rst")
)
2015-01-27 16:53:17 +00:00
if __name__ == "__main__":
setup(
2015-02-21 13:08:36 +00:00
name=NAME,
description=find_meta("description"),
license=find_meta("license"),
2016-02-20 08:34:45 +00:00
url=URI,
version=VERSION,
2015-02-21 13:08:36 +00:00
author=find_meta("author"),
author_email=find_meta("email"),
maintainer=find_meta("author"),
maintainer_email=find_meta("email"),
2015-09-22 12:22:21 +00:00
keywords=KEYWORDS,
2016-02-20 08:34:45 +00:00
long_description=LONG,
2015-09-22 12:22:21 +00:00
packages=PACKAGES,
package_dir={"": "src"},
2015-02-21 13:08:36 +00:00
zip_safe=False,
2015-09-22 12:22:21 +00:00
classifiers=CLASSIFIERS,
install_requires=INSTALL_REQUIRES,
2015-01-27 16:53:17 +00:00
)