Remove superfluous manipulation of import path.
[dput.git] / setup.py
blob8a570b3c4a90ca5fbc62dff2a94ad797f0607635
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 os
15 import os.path
16 import pydoc
17 import email.utils
19 from setuptools import (setup, find_packages)
20 import debian.deb822
21 import debian.changelog
22 import debian.copyright
25 setup_dir = os.path.dirname(__file__)
27 readme_file_path = os.path.join(setup_dir, "README")
28 with open(readme_file_path) as readme_file:
29 (synopsis, long_description) = pydoc.splitdoc(readme_file.read())
31 changelog_file_path = os.path.join(setup_dir, "debian", "changelog")
32 with open(changelog_file_path) as changelog_file:
33 changelog = debian.changelog.Changelog(changelog_file, max_blocks=1)
34 (author_name, author_email) = email.utils.parseaddr(changelog.author)
36 control_file_path = os.path.join(setup_dir, "debian", "control")
37 with open(control_file_path) as control_file:
38 control_structure = debian.deb822.Deb822(control_file)
39 (maintainer_name, maintainer_email) = email.utils.parseaddr(
40 control_structure['maintainer'])
42 copyright_file_path = os.path.join(setup_dir, "debian", "copyright")
43 with open(copyright_file_path) as copyright_file:
44 copyright_structure = debian.copyright.Copyright(copyright_file)
45 general_files_paragraph = copyright_structure.find_files_paragraph("*")
46 license = general_files_paragraph.license
49 setup(
50 name=changelog.package,
51 version=str(changelog.version),
52 packages=find_packages(exclude=["test"]),
54 # Setuptools metadata.
55 maintainer=maintainer_name,
56 maintainer_email=maintainer_email,
57 zip_safe=False,
58 setup_requires=[
59 "python-debian",
61 test_suite="unittest2.collector",
62 tests_require=[
63 "unittest2 >=0.5.1",
64 "testtools",
65 "testscenarios >=0.4",
66 "mock >=1.3",
67 "python-debian",
68 "pygpgme",
69 "httpretty",
71 install_requires=[
72 "setuptools",
73 "python-debian",
74 "pygpgme",
76 entry_points={
77 'console_scripts': [
78 "execute-dput = dput.dput:main",
79 "execute-dcut = dput.dcut:dcut",
83 # PyPI metadata.
84 author=author_name,
85 author_email=author_email,
86 description=synopsis,
87 license=license.synopsis,
88 keywords="debian package upload test".split(),
89 url=control_structure['homepage'],
90 long_description=long_description,
91 classifiers=[
92 # Reference: http://pypi.python.org/pypi?%3Aaction=list_classifiers
93 "Development Status :: 5 - Production/Stable",
94 "License :: OSI Approved :: GNU General Public License",
95 "Operating System :: POSIX",
96 "Programming Language :: Python :: 2.7",
97 "Programming Language :: Python :: 3",
98 "Intended Audience :: Developers",
99 "Topic :: Software Development :: Build Tools",
104 # Copyright © 2008–2016 Ben Finney <ben+python@benfinney.id.au>
106 # This is free software: you may copy, modify, and/or distribute this work
107 # under the terms of the GNU General Public License as published by the
108 # Free Software Foundation; version 3 of that license or any later version.
109 # No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.
112 # Local variables:
113 # coding: utf-8
114 # mode: python
115 # End:
116 # vim: fileencoding=utf-8 filetype=python :