setup.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. import shutil
  11. class PyCryptoInstallCommand(install):
  12. """
  13. A Custom command to download and install pycrypto26
  14. binary from voidspace. Not optimal, but it should work ...
  15. """
  16. description = ("A Custom command to download and install pycrypto26"
  17. "binary from voidspace.")
  18. def run(self):
  19. base_path = "http://www.voidspace.org.uk/downloads/pycrypto26"
  20. if 'win32' in sys.platform:
  21. if not 'AMD64' in sys.version:
  22. pycrypto = 'pycrypto-2.6.win32-py2.7.exe'
  23. else: # 'for AMD64'
  24. pycrypto = 'pycrypto-2.6.win-amd64-py2.7.exe'
  25. os.system('easy_install '+base_path+'/'+pycrypto)
  26. install.run(self)
  27. else:
  28. print(('Please use pip or your Distro\'s package manager '
  29. 'to install pycrypto ...'))
  30. class CustomInstallCommand(install):
  31. """Customized setuptools install command - prints a friendly greeting."""
  32. def run(self):
  33. install.run(self)
  34. shutil.copy("documentation/man_page/pwman3.1", "/usr/share/man/man1/")
  35. setup(name=pwman.appname,
  36. version=pwman.version,
  37. description=pwman.description,
  38. author=pwman.author,
  39. author_email=pwman.authoremail,
  40. url=pwman.website,
  41. license="GNU GPL",
  42. packages=['pwman',
  43. 'pwman.data',
  44. 'pwman.data.drivers',
  45. 'pwman.exchange',
  46. 'pwman.ui',
  47. 'pwman.util'],
  48. scripts=['scripts/pwman3'],
  49. zip_safe=False,
  50. install_requires=['pycrypto>=2.6',
  51. 'colorama>=0.2.4'],
  52. classifiers=[
  53. 'Environment :: Console',
  54. 'Intended Audience :: End Users/Desktop',
  55. 'Intended Audience :: Developers',
  56. 'Intended Audience :: System Administrators',
  57. 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
  58. 'Operating System :: MacOS :: MacOS X',
  59. 'Operating System :: Microsoft :: Windows',
  60. 'Operating System :: POSIX',
  61. 'Programming Language :: Python',
  62. 'Programming Language :: Python :: 2.7'
  63. ],
  64. test_suite='pwman.tests.suite',
  65. cmdclass={'install': CustomInstallCommand,
  66. 'install_pycrypto': PyCryptoInstallCommand},
  67. )