1 # -*- coding: utf-8; -*-
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
)
20 from setuptools
import (setup
, find_packages
)
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
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
,
62 test_suite
="unittest2.collector",
66 "testscenarios >=0.4",
79 "execute-dput = dput.dput:main",
80 "execute-dcut = dput.dcut:dcut",
86 author_email
=author_email
,
88 license
=license
.synopsis
,
89 keywords
="debian package upload test".split(),
90 url
=control_structure
['homepage'],
91 long_description
=long_description
,
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.
117 # vim: fileencoding=utf-8 filetype=python :