2015-06-22 22:47:27 +02:00
|
|
|
"""
|
|
|
|
Lemur
|
|
|
|
=====
|
|
|
|
|
2015-09-22 00:16:04 +02:00
|
|
|
Is a TLS management and orchestration tool.
|
2015-06-22 22:47:27 +02:00
|
|
|
|
2018-05-29 19:18:16 +02:00
|
|
|
:copyright: (c) 2018 by Netflix, see AUTHORS for more
|
2015-06-22 22:47:27 +02:00
|
|
|
:license: Apache, see LICENSE for more details.
|
|
|
|
"""
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2020-09-02 01:07:47 +02:00
|
|
|
import datetime
|
2015-09-19 00:50:59 +02:00
|
|
|
import json
|
2020-09-02 01:07:47 +02:00
|
|
|
import logging
|
2015-06-22 22:47:27 +02:00
|
|
|
import os.path
|
2020-09-02 01:07:47 +02:00
|
|
|
import sys
|
|
|
|
from subprocess import check_output
|
2015-06-22 22:47:27 +02:00
|
|
|
|
2020-09-02 01:07:47 +02:00
|
|
|
from setuptools import Command
|
|
|
|
from setuptools import setup, find_packages
|
2015-06-22 22:47:27 +02:00
|
|
|
from setuptools.command.develop import develop
|
2015-07-21 01:13:42 +02:00
|
|
|
from setuptools.command.install import install
|
2015-06-22 22:47:27 +02:00
|
|
|
from setuptools.command.sdist import sdist
|
|
|
|
|
|
|
|
ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__)))
|
|
|
|
|
2015-12-01 18:15:53 +01:00
|
|
|
# When executing the setup.py, we need to be able to import ourselves, this
|
|
|
|
# means that we need to add the src/ directory to the sys.path.
|
|
|
|
sys.path.insert(0, ROOT)
|
|
|
|
|
|
|
|
about = {}
|
2017-07-06 05:17:19 +02:00
|
|
|
with open(os.path.join(ROOT, 'lemur', '__about__.py')) as f:
|
2017-04-25 03:37:03 +02:00
|
|
|
exec(f.read(), about) # nosec: about file is benign
|
2015-12-01 18:15:53 +01:00
|
|
|
|
2020-09-02 02:16:18 +02:00
|
|
|
# Parse requirements files
|
|
|
|
with open('requirements.txt') as f:
|
|
|
|
install_requirements = f.read().splitlines()
|
|
|
|
|
|
|
|
with open('requirements-tests.txt') as f:
|
|
|
|
tests_requirements = f.read().splitlines()
|
2020-04-29 17:51:09 +02:00
|
|
|
|
2020-09-02 02:16:18 +02:00
|
|
|
with open('requirements-docs.txt') as f:
|
|
|
|
docs_requirements = f.read().splitlines()
|
|
|
|
|
|
|
|
with open('requirements-dev.txt') as f:
|
|
|
|
dev_requirements = f.read().splitlines()
|
2015-07-21 01:13:42 +02:00
|
|
|
|
2015-07-23 19:22:16 +02:00
|
|
|
|
2015-07-21 01:13:42 +02:00
|
|
|
class SmartInstall(install):
|
|
|
|
"""
|
|
|
|
Installs Lemur into the Python environment.
|
|
|
|
If the package indicator is missing, this will also force a run of
|
|
|
|
`build_static` which is required for JavaScript assets and other things.
|
|
|
|
"""
|
2020-09-02 02:16:18 +02:00
|
|
|
|
2015-07-21 01:13:42 +02:00
|
|
|
def _needs_static(self):
|
2015-08-11 23:53:28 +02:00
|
|
|
return not os.path.exists(os.path.join(ROOT, 'lemur/static/dist'))
|
2015-07-21 01:13:42 +02:00
|
|
|
|
|
|
|
def run(self):
|
|
|
|
if self._needs_static():
|
|
|
|
self.run_command('build_static')
|
|
|
|
install.run(self)
|
|
|
|
|
2015-07-23 19:22:16 +02:00
|
|
|
|
2015-06-22 22:47:27 +02:00
|
|
|
class DevelopWithBuildStatic(develop):
|
|
|
|
def install_for_development(self):
|
|
|
|
self.run_command('build_static')
|
|
|
|
return develop.install_for_development(self)
|
|
|
|
|
|
|
|
|
|
|
|
class SdistWithBuildStatic(sdist):
|
2015-09-19 00:50:59 +02:00
|
|
|
def make_release_tree(self, *a, **kw):
|
|
|
|
dist_path = self.distribution.get_fullname()
|
|
|
|
|
|
|
|
sdist.make_release_tree(self, *a, **kw)
|
|
|
|
|
|
|
|
self.reinitialize_command('build_static', work_path=dist_path)
|
2015-06-22 22:47:27 +02:00
|
|
|
self.run_command('build_static')
|
2015-09-19 00:50:59 +02:00
|
|
|
|
|
|
|
with open(os.path.join(dist_path, 'lemur-package.json'), 'w') as fp:
|
|
|
|
json.dump({
|
|
|
|
'createdAt': datetime.datetime.utcnow().isoformat() + 'Z',
|
|
|
|
}, fp)
|
2015-06-22 22:47:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
class BuildStatic(Command):
|
|
|
|
def initialize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
2020-09-02 01:07:47 +02:00
|
|
|
logging.info("running [npm install --quiet] in {0}".format(ROOT))
|
2015-09-19 19:12:12 +02:00
|
|
|
try:
|
|
|
|
check_output(['npm', 'install', '--quiet'], cwd=ROOT)
|
|
|
|
|
2020-09-02 01:07:47 +02:00
|
|
|
logging.info("running [gulp build]")
|
2015-09-19 19:12:12 +02:00
|
|
|
check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'build'], cwd=ROOT)
|
2020-09-02 01:07:47 +02:00
|
|
|
logging.info("running [gulp package]")
|
2015-09-19 19:12:12 +02:00
|
|
|
check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'package'], cwd=ROOT)
|
|
|
|
except Exception as e:
|
2020-09-02 01:07:47 +02:00
|
|
|
logging.warn("Unable to build static content")
|
2015-06-22 22:47:27 +02:00
|
|
|
|
2016-12-19 03:21:12 +01:00
|
|
|
|
2015-06-22 22:47:27 +02:00
|
|
|
setup(
|
2015-12-01 18:15:53 +01:00
|
|
|
name=about["__title__"],
|
|
|
|
version=about["__version__"],
|
|
|
|
author=about["__author__"],
|
|
|
|
author_email=about["__email__"],
|
|
|
|
url=about["__uri__"],
|
|
|
|
description=about["__summary__"],
|
2015-08-12 00:46:54 +02:00
|
|
|
long_description=open(os.path.join(ROOT, 'README.rst')).read(),
|
2015-09-08 06:54:23 +02:00
|
|
|
packages=find_packages(),
|
2015-06-22 22:47:27 +02:00
|
|
|
include_package_data=True,
|
|
|
|
zip_safe=False,
|
2020-09-02 02:16:18 +02:00
|
|
|
install_requires=install_requirements,
|
2015-06-22 22:47:27 +02:00
|
|
|
extras_require={
|
2020-09-02 02:16:18 +02:00
|
|
|
'tests': tests_requirements,
|
|
|
|
'docs': docs_requirements,
|
|
|
|
'dev': dev_requirements,
|
2015-06-22 22:47:27 +02:00
|
|
|
},
|
|
|
|
cmdclass={
|
|
|
|
'build_static': BuildStatic,
|
2015-07-21 01:13:42 +02:00
|
|
|
'sdist': SdistWithBuildStatic,
|
|
|
|
'install': SmartInstall
|
2015-06-22 22:47:27 +02:00
|
|
|
},
|
|
|
|
entry_points={
|
|
|
|
'console_scripts': [
|
|
|
|
'lemur = lemur.manage:main',
|
|
|
|
],
|
2015-07-04 21:47:57 +02:00
|
|
|
'lemur.plugins': [
|
2015-07-11 02:02:23 +02:00
|
|
|
'verisign_issuer = lemur.plugins.lemur_verisign.plugin:VerisignIssuerPlugin',
|
2016-06-28 00:57:53 +02:00
|
|
|
'acme_issuer = lemur.plugins.lemur_acme.plugin:ACMEIssuerPlugin',
|
2020-09-29 14:29:23 +02:00
|
|
|
'acme_http_issuer = lemur.plugins.lemur_acme.plugin:ACMEHttpIssuerPlugin',
|
2015-07-11 02:02:23 +02:00
|
|
|
'aws_destination = lemur.plugins.lemur_aws.plugin:AWSDestinationPlugin',
|
2015-08-03 22:51:27 +02:00
|
|
|
'aws_source = lemur.plugins.lemur_aws.plugin:AWSSourcePlugin',
|
2016-10-09 02:06:20 +02:00
|
|
|
'aws_s3 = lemur.plugins.lemur_aws.plugin:S3DestinationPlugin',
|
2020-10-16 19:40:11 +02:00
|
|
|
'aws_sns = lemur.plugins.lemur_aws.plugin:SNSNotificationPlugin',
|
2015-08-03 22:51:27 +02:00
|
|
|
'email_notification = lemur.plugins.lemur_email.plugin:EmailNotificationPlugin',
|
2016-05-08 18:07:16 +02:00
|
|
|
'slack_notification = lemur.plugins.lemur_slack.plugin:SlackNotificationPlugin',
|
2019-04-05 16:52:55 +02:00
|
|
|
'java_truststore_export = lemur.plugins.lemur_jks.plugin:JavaTruststoreExportPlugin',
|
|
|
|
'java_keystore_export = lemur.plugins.lemur_jks.plugin:JavaKeystoreExportPlugin',
|
2016-04-02 01:54:33 +02:00
|
|
|
'openssl_export = lemur.plugins.lemur_openssl.plugin:OpenSSLExportPlugin',
|
2016-06-27 23:40:01 +02:00
|
|
|
'atlas_metric = lemur.plugins.lemur_atlas.plugin:AtlasMetricPlugin',
|
2019-11-06 19:42:59 +01:00
|
|
|
'atlas_metric_redis = lemur.plugins.lemur_atlas_redis.plugin:AtlasMetricRedisPlugin',
|
2016-06-29 18:05:39 +02:00
|
|
|
'kubernetes_destination = lemur.plugins.lemur_kubernetes.plugin:KubernetesDestinationPlugin',
|
|
|
|
'cryptography_issuer = lemur.plugins.lemur_cryptography.plugin:CryptographyIssuerPlugin',
|
2016-10-22 09:52:18 +02:00
|
|
|
'cfssl_issuer = lemur.plugins.lemur_cfssl.plugin:CfsslIssuerPlugin',
|
2016-11-07 23:40:00 +01:00
|
|
|
'digicert_issuer = lemur.plugins.lemur_digicert.plugin:DigiCertIssuerPlugin',
|
2016-11-29 19:02:40 +01:00
|
|
|
'digicert_cis_issuer = lemur.plugins.lemur_digicert.plugin:DigiCertCISIssuerPlugin',
|
2018-03-10 18:44:51 +01:00
|
|
|
'digicert_cis_source = lemur.plugins.lemur_digicert.plugin:DigiCertCISSourcePlugin',
|
2018-04-03 19:30:19 +02:00
|
|
|
'csr_export = lemur.plugins.lemur_csr.plugin:CSRExportPlugin',
|
2019-02-19 21:03:15 +01:00
|
|
|
'sftp_destination = lemur.plugins.lemur_sftp.plugin:SFTPDestinationPlugin',
|
2019-05-07 15:37:30 +02:00
|
|
|
'vault_source = lemur.plugins.lemur_vault_dest.plugin:VaultSourcePlugin',
|
2019-03-01 15:58:43 +01:00
|
|
|
'vault_desination = lemur.plugins.lemur_vault_dest.plugin:VaultDestinationPlugin',
|
2018-12-20 11:54:47 +01:00
|
|
|
'adcs_issuer = lemur.plugins.lemur_adcs.plugin:ADCSIssuerPlugin',
|
2020-09-11 11:16:23 +02:00
|
|
|
'adcs_source = lemur.plugins.lemur_adcs.plugin:ADCSSourcePlugin',
|
|
|
|
'entrust_issuer = lemur.plugins.lemur_entrust.plugin:EntrustIssuerPlugin',
|
2020-11-14 12:49:14 +01:00
|
|
|
'entrust_source = lemur.plugins.lemur_entrust.plugin:EntrustSourcePlugin',
|
|
|
|
'azure_destination = lemur.plugins.lemur_azure_dest.plugin:AzureDestinationPlugin'
|
2015-07-04 21:47:57 +02:00
|
|
|
],
|
2015-06-22 22:47:27 +02:00
|
|
|
},
|
|
|
|
classifiers=[
|
|
|
|
'Framework :: Flask',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'Intended Audience :: System Administrators',
|
|
|
|
'Operating System :: OS Independent',
|
2015-12-01 18:15:53 +01:00
|
|
|
'Topic :: Software Development',
|
2016-11-09 00:22:50 +01:00
|
|
|
"Programming Language :: Python :: 3.5",
|
2015-12-01 18:15:53 +01:00
|
|
|
"Natural Language :: English",
|
|
|
|
"License :: OSI Approved :: Apache Software License"
|
2015-06-22 22:47:27 +02:00
|
|
|
]
|
|
|
|
)
|