PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/pyutil-1.9.1/setup.py

#
Python | 126 lines | 86 code | 16 blank | 24 comment | 13 complexity | ba71e1fbe353cd8b6216bcec93935f95 MD5 | raw file
Possible License(s): GPL-2.0
  1. #!/usr/bin/env python
  2. # pyutil -- utility functions and classes
  3. #
  4. # Author: Zooko Wilcox-O'Hearn
  5. #
  6. # See README.rst for licensing information.
  7. import os, re, sys
  8. try:
  9. from ez_setup import use_setuptools
  10. except ImportError:
  11. pass
  12. else:
  13. use_setuptools(download_delay=0)
  14. from setuptools import find_packages, setup
  15. trove_classifiers=[
  16. "Development Status :: 5 - Production/Stable",
  17. "License :: OSI Approved :: GNU General Public License (GPL)",
  18. "License :: DFSG approved",
  19. "Intended Audience :: Developers",
  20. "Operating System :: Microsoft :: Windows",
  21. "Operating System :: Unix",
  22. "Operating System :: MacOS :: MacOS X",
  23. "Operating System :: OS Independent",
  24. "Natural Language :: English",
  25. "Programming Language :: Python",
  26. "Programming Language :: Python :: 2",
  27. "Programming Language :: Python :: 2.4",
  28. "Programming Language :: Python :: 2.5",
  29. "Programming Language :: Python :: 2.6",
  30. "Programming Language :: Python :: 2.7",
  31. "Topic :: Utilities",
  32. "Topic :: Software Development :: Libraries",
  33. ]
  34. PKG='pyutil'
  35. VERSIONFILE = os.path.join(PKG, "_version.py")
  36. verstr = "unknown"
  37. try:
  38. verstrline = open(VERSIONFILE, "rt").read()
  39. except EnvironmentError:
  40. pass # Okay, there is no version file.
  41. else:
  42. VSRE = r"^verstr = ['\"]([^'\"]*)['\"]"
  43. mo = re.search(VSRE, verstrline, re.M)
  44. if mo:
  45. verstr = mo.group(1)
  46. else:
  47. print "unable to find version in %s" % (VERSIONFILE,)
  48. raise RuntimeError("if %s.py exists, it must be well-formed" % (VERSIONFILE,))
  49. setup_requires = []
  50. # setuptools_trial is needed if you want "./setup.py trial" or
  51. # "./setup.py test" to execute the tests.
  52. # http://pypi.python.org/pypi/setuptools_trial
  53. if 'trial' in sys.argv[1:]:
  54. setup_requires.extend(['setuptools_trial >= 0.5'])
  55. # darcsver is needed only if you want "./setup.py darcsver" to write a new
  56. # version stamp in pyutil/_version.py, with a version number derived from
  57. # darcs history. http://pypi.python.org/pypi/darcsver
  58. if 'darcsver' in sys.argv[1:]:
  59. setup_requires.append('darcsver >= 1.0.0')
  60. # setuptools_darcs is required to produce complete distributions (such
  61. # as with "sdist" or "bdist_egg"), unless there is a
  62. # pyutil.egg-info/SOURCE.txt file present which contains a complete
  63. # list of files that should be included.
  64. # http://pypi.python.org/pypi/setuptools_darcs However, requiring it
  65. # runs afoul of a bug in Distribute, which was shipped in Ubuntu
  66. # Lucid, so for now you have to manually install it before building
  67. # sdists or eggs:
  68. # http://bitbucket.org/tarek/distribute/issue/55/revision-control-plugin-automatically-installed-as-a-build-dependency-is-not-present-when-another-build-dependency-is-being
  69. if False:
  70. setup_requires.append('setuptools_darcs >= 1.1.0')
  71. data_fnames=[ 'COPYING.SPL.txt', 'COPYING.GPL', 'COPYING.TGPPL.html', 'README.rst', 'CREDITS' ]
  72. # In case we are building for a .deb with stdeb's sdist_dsc command, we put the
  73. # docs in "share/doc/python-$PKG".
  74. doc_loc = "share/doc/" + PKG
  75. data_files = [(doc_loc, data_fnames)]
  76. install_requires=['zbase32 >= 1.0']
  77. if sys.version_info < (2, 7):
  78. install_requires.append('argparse >= 0.8')
  79. readmetext = open('README.rst').read()
  80. if readmetext[:3] == '\xef\xbb\xbf':
  81. # utf-8 "BOM"
  82. readmetext = readmetext[3:].decode('utf-8')
  83. setup(name=PKG,
  84. version=verstr,
  85. description='a collection of utilities for Python programmers',
  86. long_description=readmetext,
  87. author='Zooko O\'Whielacronx',
  88. author_email='zooko@zooko.com',
  89. url='http://tahoe-lafs.org/trac/' + PKG,
  90. license='GNU GPL', # see README.rst for details -- there are also alternative licences
  91. packages=find_packages(),
  92. include_package_data=True,
  93. data_files=data_files,
  94. setup_requires=setup_requires,
  95. extras_require={'jsonutil': ['simplejson >= 2.1.0',]},
  96. install_requires=install_requires,
  97. classifiers=trove_classifiers,
  98. entry_points = {
  99. 'console_scripts': [
  100. 'randcookie = pyutil.scripts.randcookie:main',
  101. 'tailx = pyutil.scripts.tailx:main',
  102. 'lines = pyutil.scripts.lines:main',
  103. 'randfile = pyutil.scripts.randfile:main',
  104. 'unsort = pyutil.scripts.unsort:main',
  105. 'verinfo = pyutil.scripts.verinfo:main',
  106. 'try_decoding = pyutil.scripts.try_decoding:main',
  107. ] },
  108. test_suite=PKG+".test",
  109. zip_safe=False, # I prefer unzipped for easier access.
  110. )