setup.py 3.7 KB

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