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