setup.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import print_function
  4. import sys
  5. import os
  6. try:
  7. import xml.etree.ElementTree
  8. print("Using xml.etree.ElementTree for XML processing")
  9. except ImportError as e:
  10. sys.stderr.write(str(e) + "\n")
  11. try:
  12. import elementtree.ElementTree
  13. print("Using elementtree.ElementTree for XML processing")
  14. except ImportError as e:
  15. sys.stderr.write(str(e) + "\n")
  16. sys.stderr.write("Please install ElementTree module from\n")
  17. sys.stderr.write("http://effbot.org/zone/element-index.htm\n")
  18. sys.exit(1)
  19. from setuptools import setup
  20. import S3.PkgInfo
  21. if float("%d.%d" % sys.version_info[:2]) < 2.6:
  22. sys.stderr.write("Your Python version %d.%d.%d is not supported.\n" % sys.version_info[:3])
  23. sys.stderr.write("S3cmd requires Python 2.6 or newer.\n")
  24. sys.exit(1)
  25. ## Remove 'MANIFEST' file to force
  26. ## distutils to recreate it.
  27. ## Only in "sdist" stage. Otherwise
  28. ## it makes life difficult to packagers.
  29. if len(sys.argv) > 1 and sys.argv[1] == "sdist":
  30. try:
  31. os.unlink("MANIFEST")
  32. except OSError as e:
  33. pass
  34. ## Re-create the manpage
  35. ## (Beware! Perl script on the loose!!)
  36. if len(sys.argv) > 1 and sys.argv[1] == "sdist":
  37. if os.stat_result(os.stat("s3cmd.1")).st_mtime \
  38. < os.stat_result(os.stat("s3cmd")).st_mtime:
  39. sys.stderr.write("Re-create man page first!\n")
  40. sys.stderr.write("Run: ./s3cmd --help | ./format-manpage.pl > s3cmd.1\n")
  41. sys.exit(1)
  42. ## Don't install manpages and docs when $S3CMD_PACKAGING is set
  43. ## This was a requirement of Debian package maintainer.
  44. if not os.getenv("S3CMD_PACKAGING"):
  45. man_path = os.getenv("S3CMD_INSTPATH_MAN") or "share/man"
  46. doc_path = os.getenv("S3CMD_INSTPATH_DOC") or "share/doc/packages"
  47. data_files = [
  48. (doc_path+"/s3cmd", ["README.md", "INSTALL.md", "LICENSE", "NEWS"]),
  49. (man_path+"/man1", ["s3cmd.1"]),
  50. ]
  51. else:
  52. data_files = None
  53. ## Main distutils info
  54. setup(
  55. ## Content description
  56. name=S3.PkgInfo.package,
  57. version=S3.PkgInfo.version,
  58. packages=['S3'],
  59. scripts=['s3cmd'],
  60. data_files=data_files,
  61. test_suite='S3.PkgInfo',
  62. ## Packaging details
  63. author="Michal Ludvig",
  64. author_email="michal@logix.cz",
  65. maintainer="github.com/fviard, github.com/matteobar",
  66. maintainer_email="s3tools-bugs@lists.sourceforge.net",
  67. url=S3.PkgInfo.url,
  68. license=S3.PkgInfo.license,
  69. description=S3.PkgInfo.short_description,
  70. long_description="""
  71. %s
  72. Authors:
  73. --------
  74. Florent Viard <florent@sodria.com>
  75. Michal Ludvig <michal@logix.cz>
  76. Matt Domsch (github.com/mdomsch)
  77. """ % (S3.PkgInfo.long_description),
  78. classifiers=[
  79. 'Development Status :: 5 - Production/Stable',
  80. 'Environment :: Console',
  81. 'Environment :: MacOS X',
  82. 'Environment :: Win32 (MS Windows)',
  83. 'Intended Audience :: End Users/Desktop',
  84. 'Intended Audience :: System Administrators',
  85. 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
  86. 'Natural Language :: English',
  87. 'Operating System :: MacOS :: MacOS X',
  88. 'Operating System :: Microsoft :: Windows',
  89. 'Operating System :: POSIX',
  90. 'Operating System :: Unix',
  91. 'Programming Language :: Python :: 2',
  92. 'Programming Language :: Python :: 2.6',
  93. 'Programming Language :: Python :: 2.7',
  94. 'Programming Language :: Python :: 3',
  95. 'Programming Language :: Python :: 3.3',
  96. 'Programming Language :: Python :: 3.4',
  97. 'Programming Language :: Python :: 3.5',
  98. 'Programming Language :: Python :: 3.6',
  99. 'Programming Language :: Python :: 3.7',
  100. 'Programming Language :: Python :: 3.8',
  101. 'Programming Language :: Python :: 3.9',
  102. 'Programming Language :: Python :: 3.10',
  103. 'Topic :: System :: Archiving',
  104. 'Topic :: Utilities',
  105. ],
  106. install_requires=["python-dateutil", "python-magic"]
  107. )
  108. # vim:et:ts=4:sts=4:ai