setup.py
093be855
 import sys
ab58f171
 import os
 
70d781bd
 from setuptools import setup, find_packages
 
747ddb2a
 import S3.PkgInfo
 
e5edb9cc
 if float("%d.%d" % sys.version_info[:2]) < 2.6:
d439efb4
     sys.stderr.write("Your Python version %d.%d.%d is not supported.\n" % sys.version_info[:3])
e5edb9cc
     sys.stderr.write("S3cmd requires Python 2.6 or newer.\n")
d439efb4
     sys.exit(1)
10465167
 
 try:
d439efb4
     import xml.etree.ElementTree as ET
     print "Using xml.etree.ElementTree for XML processing"
10465167
 except ImportError, e:
d439efb4
     sys.stderr.write(str(e) + "\n")
     try:
         import elementtree.ElementTree as ET
         print "Using elementtree.ElementTree for XML processing"
     except ImportError, e:
         sys.stderr.write(str(e) + "\n")
         sys.stderr.write("Please install ElementTree module from\n")
         sys.stderr.write("http://effbot.org/zone/element-index.htm\n")
         sys.exit(1)
10465167
 
ab58f171
 try:
d439efb4
     ## Remove 'MANIFEST' file to force
     ## distutils to recreate it.
     ## Only in "sdist" stage. Otherwise
     ## it makes life difficult to packagers.
     if sys.argv[1] == "sdist":
         os.unlink("MANIFEST")
ab58f171
 except:
d439efb4
     pass
ab58f171
 
593ef060
 ## Re-create the manpage
 ## (Beware! Perl script on the loose!!)
 if sys.argv[1] == "sdist":
d439efb4
     if os.stat_result(os.stat("s3cmd.1")).st_mtime < os.stat_result(os.stat("s3cmd")).st_mtime:
         sys.stderr.write("Re-create man page first!\n")
         sys.stderr.write("Run: ./s3cmd --help | ./format-manpage.pl > s3cmd.1\n")
         sys.exit(1)
593ef060
 
c9930864
 ## Don't install manpages and docs when $S3CMD_PACKAGING is set
d439efb4
 ## This was a requirement of Debian package maintainer.
c9930864
 if not os.getenv("S3CMD_PACKAGING"):
d439efb4
     man_path = os.getenv("S3CMD_INSTPATH_MAN") or "share/man"
     doc_path = os.getenv("S3CMD_INSTPATH_DOC") or "share/doc/packages"
     data_files = [
90c4081d
         (doc_path+"/s3cmd", [ "README.md", "INSTALL", "NEWS" ]),
d439efb4
         (man_path+"/man1", [ "s3cmd.1" ] ),
     ]
c9930864
 else:
d439efb4
     data_files = None
09b29caf
 
 ## Main distutils info
747ddb2a
 setup(
d439efb4
     ## Content description
     name = S3.PkgInfo.package,
     version = S3.PkgInfo.version,
     packages = [ 'S3' ],
     scripts = ['s3cmd'],
     data_files = data_files,
7023e931
 
d439efb4
     ## Packaging details
     author = "Michal Ludvig",
     author_email = "michal@logix.cz",
32b3668f
     maintainer = "github.com/mdomsch, github.com/matteobar",
     maintainer_email = "s3tools-bugs@lists.sourceforge.net",
d439efb4
     url = S3.PkgInfo.url,
     license = S3.PkgInfo.license,
     description = S3.PkgInfo.short_description,
     long_description = """
747ddb2a
 %s
7023e931
 
 Authors:
 --------
747ddb2a
     Michal Ludvig  <michal@logix.cz>
7de6b65f
 """ % (S3.PkgInfo.long_description),
32b3668f
 
     classifiers = [
         'Development Status :: 5 - Production/Stable',
         'Environment :: Console',
         'Environment :: MacOS X',
         'Environment :: Win32 (MS Windows)',
         'Intended Audience :: End Users/Desktop',
         'Intended Audience :: System Administrators',
         'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
         'Natural Language :: English',
         'Operating System :: MacOS :: MacOS X',
         'Operating System :: Microsoft :: Windows',
         'Operating System :: POSIX',
         'Operating System :: Unix',
         'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 2 :: Only',
         'Topic :: System :: Archiving',
         'Topic :: Utilities',
     ],
 
73dbfa4a
     install_requires = ["python-dateutil", "python-magic"]
d439efb4
     )
 
 # vim:et:ts=4:sts=4:ai