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
)
19 from setuptools
import (setup
, find_packages
)
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
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
,
61 test_suite
="unittest2.collector",
65 "testscenarios >=0.4",
78 "execute-dput = dput.dput:main",
79 "execute-dcut = dput.dcut:dcut",
85 author_email
=author_email
,
87 license
=license
.synopsis
,
88 keywords
="debian package upload test".split(),
89 url
=control_structure
['homepage'],
90 long_description
=long_description
,
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.
116 # vim: fileencoding=utf-8 filetype=python :