1 # -*- coding: utf-8; -*-
4 # Part of ‘dput’, a Debian package upload toolkit.
6 # Copyright © 2008–2016 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
)
23 from setuptools
import (setup
, find_packages
)
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
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
,
65 test_suite
="unittest2.collector",
69 "testscenarios >=0.4",
80 "execute-dput = dput.dput:main",
81 "execute-dcut = dput.dcut:dcut",
87 author_email
=author_email
,
89 license
=license
.synopsis
,
90 keywords
="debian package upload test".split(),
91 url
=control_structure
['homepage'],
92 long_description
=long_description
,
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",
110 # vim: fileencoding=utf-8 filetype=python :