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",
82 "execute-dput = dput.dput:main",
83 "execute-dcut = dput.dcut:dcut",
89 author_email
=author_email
,
91 license
=license
.synopsis
,
92 keywords
="debian package upload test".split(),
93 url
=control_structure
['homepage'],
94 long_description
=long_description
,
96 # Reference: http://pypi.python.org/pypi?%3Aaction=list_classifiers
97 "Development Status :: 5 - Production/Stable",
98 "License :: OSI Approved :: GNU General Public License",
99 "Operating System :: POSIX",
100 "Programming Language :: Python :: 2.7",
101 "Programming Language :: Python :: 3",
102 "Intended Audience :: Developers",
103 "Topic :: Software Development :: Build Tools",
112 # vim: fileencoding=utf-8 filetype=python :