setup.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/usr/bin/env python
  2. """
  3. script to install pwman3
  4. """
  5. from setuptools import setup
  6. import pwman
  7. import sys
  8. from setuptools.command.install import install
  9. import os
  10. from subprocess import Popen, PIPE
  11. from build_manpage import BuildManPage
  12. def describe():
  13. des = Popen('git describe', shell=True, stdout=PIPE)
  14. ver = des.stdout.readlines()
  15. if ver:
  16. return ver[0].strip()
  17. else:
  18. return pwman.version
  19. class PyCryptoInstallCommand(install):
  20. """
  21. A Custom command to download and install pycrypto26
  22. binary from voidspace. Not optimal, but it should work ...
  23. """
  24. description = ("A Custom command to download and install pycrypto26"
  25. "binary from voidspace.")
  26. def run(self):
  27. base_path = "http://www.voidspace.org.uk/downloads/pycrypto26"
  28. if 'win32' in sys.platform:
  29. if 'AMD64' not in sys.version:
  30. pycrypto = 'pycrypto-2.6.win32-py2.7.exe'
  31. else: # 'for AMD64'
  32. pycrypto = 'pycrypto-2.6.win-amd64-py2.7.exe'
  33. os.system('easy_install '+base_path+'/'+pycrypto)
  34. install.run(self)
  35. else:
  36. print(('Please use pip or your Distro\'s package manager '
  37. 'to install pycrypto ...'))
  38. setup(name=pwman.appname,
  39. version=describe(),
  40. description=pwman.description,
  41. long_description=pwman.long_description,
  42. author=pwman.author,
  43. author_email=pwman.authoremail,
  44. url=pwman.website,
  45. license="GNU GPL",
  46. packages=['pwman',
  47. 'pwman.data',
  48. 'pwman.data.drivers',
  49. 'pwman.exchange',
  50. 'pwman.ui',
  51. 'pwman.util'],
  52. package_data={"data": ["documentation"]},
  53. include_package_data=True,
  54. scripts=['scripts/pwman3'],
  55. zip_safe=False,
  56. install_requires=['pycrypto>=2.6',
  57. 'colorama>=0.2.4'],
  58. classifiers=[
  59. 'Environment :: Console',
  60. 'Intended Audience :: End Users/Desktop',
  61. 'Intended Audience :: Developers',
  62. 'Intended Audience :: System Administrators',
  63. 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
  64. 'Operating System :: OS Independent',
  65. 'Programming Language :: Python',
  66. 'Programming Language :: Python :: 2.7'
  67. ],
  68. test_suite='pwman.tests.suite',
  69. tests_require=['pexpect'],
  70. cmdclass={
  71. 'install_pycrypto': PyCryptoInstallCommand,
  72. 'build_manpage': BuildManPage,
  73. }
  74. )