You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setup.py 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #! /usr/bin/env python
  2. from os import path
  3. import os
  4. import shutil
  5. from setuptools import setup, find_packages
  6. from setuptools.command.install import install
  7. install_requires = [
  8. 'argcomplete'
  9. ]
  10. here = path.abspath(path.dirname(__file__))
  11. class InstallCommand(install):
  12. def run(self):
  13. install.run(self)
  14. try:
  15. if path.isdir('/etc/bash_completion.d/'):
  16. shutil.copy('extra/bash/sitegen', '/etc/bash_completion.d/')
  17. except Exception as e:
  18. print(e)
  19. try:
  20. if not path.isdir('/etc/sitegen/'):
  21. shutil.copytree('extra/sitegen/', '/etc/sitegen/')
  22. os.mkdir('/etc/sitegen/hooks-enabled/')
  23. for hook_type in ['site', 'cert']:
  24. os.mkdir('/etc/sitegen/hooks-enabled/%1s' % hook_type)
  25. for file in os.listdir('/etc/sitegen/hooks-available/%1s/' % hook_type):
  26. os.symlink('../../hooks-available/%1s/%2s' % (hook_type, file),
  27. '/etc/sitegen/hooks-enabled/%1s/%2s' % (hook_type, file))
  28. except Exception as e:
  29. print(e)
  30. def package_files(directory):
  31. paths = []
  32. for (path, directories, filenames) in os.walk(directory):
  33. for filename in filenames:
  34. paths.append(os.path.join(path, filename))
  35. return paths
  36. setup(
  37. name='sitegencli',
  38. version="1.0.0",
  39. description="CLI tool to build web site configuration",
  40. long_description="""\
  41. CLI tool to build web site configuration and obtain SSL certificates from letsencrypt using certbot.
  42. Also provide a simpler way to request SSL certificate over certbot""",
  43. url='https://git.rthoni.com/robin.thoni/sitegen',
  44. author="Robin Thoni",
  45. author_email='robin@rthoni.com',
  46. license='MIT',
  47. classifiers=[
  48. # How mature is this project? Common values are
  49. # 3 - Alpha
  50. # 4 - Beta
  51. # 5 - Production/Stable
  52. 'Development Status :: 5 - Production/Stable',
  53. # Indicate who your project is intended for
  54. 'Intended Audience :: System Administrators',
  55. 'Topic :: Internet :: WWW/HTTP :: HTTP Servers',
  56. # Pick your license as you wish (should match "license" above)
  57. 'License :: OSI Approved :: MIT License',
  58. # Specify the Python versions you support here. In particular, ensure
  59. # that you indicate whether you support Python 2, Python 3 or both.
  60. 'Programming Language :: Python :: 3',
  61. 'Programming Language :: Python :: 3.3',
  62. 'Programming Language :: Python :: 3.4',
  63. 'Programming Language :: Python :: 3.5',
  64. ],
  65. keywords="certbot apache ssl",
  66. packages=find_packages(),
  67. install_requires=install_requires,
  68. extras_require={
  69. 'dev': [],
  70. 'test': [],
  71. },
  72. package_data={
  73. },
  74. data_files=[
  75. ('share/sitegen/bash_completion.d/', ['extra/bash/sitegen']),
  76. ('share/sitegen/', ['extra/apache/sitegen.conf']),
  77. ('etc/sitegen/', ['extra/sitegen/sitegen.json']),
  78. ('etc/sitegen/hooks-available/cert/', package_files('extra/sitegen/hooks-available/cert/')),
  79. ('etc/sitegen/hooks-available/site/', package_files('extra/sitegen/hooks-available/site/')),
  80. ('etc/sitegen/templates/', package_files('extra/sitegen/templates/'))
  81. ],
  82. entry_points={
  83. 'console_scripts': [
  84. 'sitegen=sitegencli.sitegen:main',
  85. ],
  86. },
  87. cmdclass={
  88. 'install': InstallCommand,
  89. }
  90. )