Re-organise source for better maintenance.
[dput.git] / setup.py
blobf0a6206849a0b61f65dd50d4df9568ec118e1723
1 # -*- coding: utf-8; -*-
3 # setup.py
4 # Part of ‘dput’, a Debian package upload toolkit.
6 # This is free software, and you are welcome to redistribute it under
7 # certain conditions; see the end of this file for copyright
8 # information, grant of license, and disclaimer of warranty.
10 """ Distribution setup for ‘dput’ library. """
12 from __future__ import (absolute_import, unicode_literals)
14 import sys
15 import os
16 import os.path
17 import pydoc
18 import email.utils
20 from setuptools import (setup, find_packages)
21 import debian.deb822
22 import debian.changelog
23 import debian.copyright
26 setup_dir = os.path.dirname(__file__)
28 readme_file_path = os.path.join(setup_dir, "README")
29 with open(readme_file_path) as readme_file:
30 (synopsis, long_description) = pydoc.splitdoc(readme_file.read())
32 changelog_file_path = os.path.join(setup_dir, "debian", "changelog")
33 with open(changelog_file_path) as changelog_file:
34 changelog = debian.changelog.Changelog(changelog_file, max_blocks=1)
35 (author_name, author_email) = email.utils.parseaddr(changelog.author)
37 control_file_path = os.path.join(setup_dir, "debian", "control")
38 with open(control_file_path) as control_file:
39 control_structure = debian.deb822.Deb822(control_file)
40 (maintainer_name, maintainer_email) = email.utils.parseaddr(
41 control_structure['maintainer'])
43 copyright_file_path = os.path.join(setup_dir, "debian", "copyright")
44 with open(copyright_file_path) as copyright_file:
45 copyright_structure = debian.copyright.Copyright(copyright_file)
46 general_files_paragraph = copyright_structure.find_files_paragraph("*")
47 license = general_files_paragraph.license
50 setup(
51 name=changelog.package,
52 version=str(changelog.version),
53 packages=find_packages(exclude=["test"]),
55 # Setuptools metadata.
56 maintainer=maintainer_name,
57 maintainer_email=maintainer_email,
58 zip_safe=False,
59 setup_requires=[
60 "python-debian",
62 test_suite="unittest2.collector",
63 tests_require=[
64 "unittest2 >=0.5.1",
65 "testtools",
66 "testscenarios >=0.4",
67 "mock >=1.3",
68 "python-debian",
69 "pygpgme",
70 "httpretty",
72 install_requires=[
73 "setuptools",
74 "python-debian",
75 "pygpgme",
77 entry_points={
78 'console_scripts': [
79 "execute-dput = dput.dput:main",
80 "execute-dcut = dput.dcut:dcut",
84 # PyPI metadata.
85 author=author_name,
86 author_email=author_email,
87 description=synopsis,
88 license=license.synopsis,
89 keywords="debian package upload test".split(),
90 url=control_structure['homepage'],
91 long_description=long_description,
92 classifiers=[
93 # Reference: http://pypi.python.org/pypi?%3Aaction=list_classifiers
94 "Development Status :: 5 - Production/Stable",
95 "License :: OSI Approved :: GNU General Public License",
96 "Operating System :: POSIX",
97 "Programming Language :: Python :: 2.7",
98 "Programming Language :: Python :: 3",
99 "Intended Audience :: Developers",
100 "Topic :: Software Development :: Build Tools",
105 # Copyright © 2008–2016 Ben Finney <ben+python@benfinney.id.au>
107 # This is free software: you may copy, modify, and/or distribute this work
108 # under the terms of the GNU General Public License as published by the
109 # Free Software Foundation; version 3 of that license or any later version.
110 # No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.
113 # Local variables:
114 # coding: utf-8
115 # mode: python
116 # End:
117 # vim: fileencoding=utf-8 filetype=python :