setup.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/usr/bin/env python
  2. """
  3. script to install pwman3
  4. """
  5. from setuptools import setup
  6. import sys
  7. from setuptools.command.install import install
  8. import os
  9. from subprocess import Popen, PIPE
  10. from build_manpage import BuildManPage
  11. import pwman
  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().decode('utf-8')
  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. if 'win' in sys.platform:
  39. test_requirements = None
  40. else:
  41. test_requirements = ['pexpect']
  42. setup(name=pwman.appname,
  43. version=describe(),
  44. description=pwman.description,
  45. long_description=pwman.long_description,
  46. author=pwman.author,
  47. author_email=pwman.authoremail,
  48. url=pwman.website,
  49. license="GNU GPL",
  50. packages=['pwman',
  51. 'pwman.data',
  52. 'pwman.data.drivers',
  53. 'pwman.exchange',
  54. 'pwman.ui',
  55. 'pwman.util'],
  56. package_data={"data": ["documentation"]},
  57. include_package_data=True,
  58. scripts=['scripts/pwman3'],
  59. zip_safe=False,
  60. install_requires=['pycrypto>=2.6',
  61. 'colorama>=0.2.4'],
  62. classifiers=[
  63. 'Environment :: Console',
  64. 'Intended Audience :: End Users/Desktop',
  65. 'Intended Audience :: Developers',
  66. 'Intended Audience :: System Administrators',
  67. 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
  68. 'Operating System :: OS Independent',
  69. 'Programming Language :: Python',
  70. 'Programming Language :: Python :: 2.7'
  71. ],
  72. test_suite='pwman.tests.suite',
  73. tests_require=test_requirements,
  74. cmdclass={
  75. 'install_pycrypto': PyCryptoInstallCommand,
  76. 'build_manpage': BuildManPage
  77. }
  78. )