PageRenderTime 53ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/setup.py

http://github.com/aol/trigger
Python | 182 lines | 164 code | 10 blank | 8 comment | 5 complexity | e5c8ab1dc7e8aac59dbb8b60fcab97ff MD5 | raw file
  1. #!/usr/bin/env python
  2. # Copyright, 2005-2013 AOL Inc.
  3. from setuptools import setup, find_packages, Command
  4. import glob
  5. import os
  6. import sys
  7. import unittest
  8. # Get version from pkg index
  9. from trigger import release as __version__
  10. # Names of required packages
  11. requires = [
  12. 'IPy>=0.73',
  13. 'cryptography>=1.4',
  14. 'Twisted>=15.5.0,<17.0.0',
  15. 'crochet==1.5.0',
  16. 'mock==2.0.0',
  17. 'pyasn1', # Twisted conch needs this, but doesn't say so
  18. 'pyparsing~=2.2.0',
  19. 'pytz',
  20. 'SimpleParse',
  21. 'gtextfsm',
  22. 'redis', # The python interface, not the daemon!
  23. 'PTable',
  24. ]
  25. class CleanCommand(Command):
  26. user_options = []
  27. def initialize_options(self):
  28. self.cwd = None
  29. def finalize_options(self):
  30. self.cwd = os.getcwd()
  31. def run(self):
  32. assert os.getcwd() == self.cwd, 'Must be in package root: %s' % self.cwd
  33. os.system ('rm -rf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info')
  34. class TestCommand(Command):
  35. user_options = []
  36. def initialize_options(self):
  37. pass
  38. def finalize_options(self):
  39. pass
  40. def run(self):
  41. # Change to project root to run tests
  42. project_root = os.path.dirname(__file__)
  43. if project_root:
  44. os.chdir(project_root)
  45. # Set up environment to point to mockup files.
  46. test_path = os.path.join(os.getcwd(), 'tests', 'data')
  47. os.environ['TRIGGER_SETTINGS'] = os.path.join(test_path, 'settings.py')
  48. os.environ['NETDEVICES_SOURCE'] = \
  49. os.path.join(test_path, 'netdevices.xml')
  50. os.environ['AUTOACL_FILE'] = os.path.join(test_path, 'autoacl.py')
  51. os.environ['BOUNCE_FILE'] = os.path.join(test_path, 'bounce.py')
  52. os.environ['TACACSRC'] = os.path.join(test_path, 'tacacsrc')
  53. os.environ['TACACSRC_KEYFILE'] = os.path.join(test_path, 'tackf')
  54. # Run each .py file found under tests.
  55. args = [unittest.__file__]
  56. for root, dirs, files in os.walk('tests'):
  57. for fn in files:
  58. if fn.startswith('test') and fn.endswith('.py'):
  59. args.append(fn[:-3])
  60. # Inject tests dir into beginning of sys.path before we run the tests
  61. sys.path.insert(0, os.path.join(os.getcwd(), 'tests'))
  62. unittest.main(None, None, args)
  63. desc = 'Trigger is a framework and suite of tools for configuring network devices'
  64. long_desc = '''
  65. Trigger is a Python framework and suite of tools for interfacing with network
  66. devices and managing network configuration and security policy. Trigger was
  67. designed to increase the speed and efficiency of network configuration
  68. management.
  69. '''
  70. setup(
  71. name='trigger',
  72. version=__version__,
  73. author='Jathan McCollum',
  74. author_email='jathanism@aol.com',
  75. packages=find_packages(exclude=['tests']) + ['twisted.plugins'],
  76. package_data={
  77. 'twisted': ['plugins/trigger_xmlrpc.py'],
  78. },
  79. license='BSD',
  80. url='https://github.com/trigger/trigger',
  81. description=desc,
  82. long_description=long_desc,
  83. scripts=[
  84. 'bin/acl',
  85. 'bin/acl_script',
  86. 'bin/aclconv',
  87. 'bin/check_access',
  88. 'bin/check_syntax',
  89. 'bin/fe',
  90. 'bin/gong',
  91. 'bin/gnng',
  92. 'bin/load_acl',
  93. 'bin/netdev',
  94. 'bin/optimizer',
  95. 'bin/find_access',
  96. 'bin/run_cmds',
  97. 'tools/gen_tacacsrc.py',
  98. 'tools/convert_tacacsrc.py',
  99. 'tools/tacacsrc2gpg.py',
  100. 'tools/init_task_db',
  101. 'tools/prepend_acl_dot',
  102. ],
  103. install_requires=requires,
  104. keywords = [
  105. 'Configuration Management',
  106. 'IANA',
  107. 'IEEE',
  108. 'IP',
  109. 'IP Address',
  110. 'IPv4',
  111. 'IPv6',
  112. 'Firewall',
  113. 'Network Automation',
  114. 'Networking',
  115. 'Network Engineering',
  116. 'Network Configuration',
  117. 'Network Security',
  118. 'Router',
  119. 'Systems Administration',
  120. 'Security',
  121. 'Switch',
  122. ],
  123. classifiers = [
  124. 'Development Status :: 6 - Mature',
  125. 'Environment :: Console',
  126. 'Environment :: Console :: Curses',
  127. 'Framework :: Twisted',
  128. 'Intended Audience :: Developers',
  129. 'Intended Audience :: Education',
  130. 'Intended Audience :: Information Technology',
  131. 'Intended Audience :: Other Audience',
  132. 'Intended Audience :: Science/Research',
  133. 'Intended Audience :: System Administrators',
  134. 'Intended Audience :: Telecommunications Industry',
  135. 'Natural Language :: English',
  136. 'License :: OSI Approved :: BSD License',
  137. 'Operating System :: OS Independent',
  138. 'Programming Language :: Python',
  139. 'Programming Language :: Python :: 2.7',
  140. 'Topic :: Internet',
  141. 'Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator',
  142. 'Topic :: Security',
  143. 'Topic :: Software Development',
  144. 'Topic :: Software Development :: Libraries :: Python Modules',
  145. 'Topic :: System :: Networking',
  146. 'Topic :: System :: Networking :: Firewalls',
  147. 'Topic :: System :: Networking :: Monitoring',
  148. 'Topic :: System :: Operating System',
  149. 'Topic :: System :: Systems Administration',
  150. 'Topic :: Terminals :: Telnet',
  151. 'Topic :: Utilities',
  152. ],
  153. cmdclass={
  154. 'test': TestCommand,
  155. 'clean': CleanCommand
  156. }
  157. )
  158. def _refresh_twisted_plugins():
  159. """
  160. Make Twisted regenerate the dropin.cache, if possible. This is necessary
  161. because in a site-wide install, dropin.cache cannot be rewritten by normal
  162. users.
  163. """
  164. try:
  165. from twisted.plugin import IPlugin, getPlugins
  166. except ImportError:
  167. pass
  168. else:
  169. list(getPlugins(IPlugin))
  170. _refresh_twisted_plugins()