Merge branch 'master' into validity

This commit is contained in:
Hossein Shafagh 2020-09-01 17:56:52 -07:00 committed by GitHub
commit 8e30305596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 43 deletions

View File

@ -20,6 +20,8 @@ cache:
env: env:
global: global:
- PIP_DOWNLOAD_CACHE=".pip_download_cache" - PIP_DOWNLOAD_CACHE=".pip_download_cache"
# The following line is a temporary workaround for this issue: https://github.com/pypa/setuptools/issues/2230
- SETUPTOOLS_USE_DISTUTILS=stdlib
# do not load /etc/boto.cfg with Python 3 incompatible plugin # do not load /etc/boto.cfg with Python 3 incompatible plugin
# https://github.com/travis-ci/travis-ci/issues/5246#issuecomment-166460882 # https://github.com/travis-ci/travis-ci/issues/5246#issuecomment-166460882
- BOTO_CONFIG=/doesnotexist - BOTO_CONFIG=/doesnotexist

View File

@ -50,8 +50,10 @@ reset-db:
setup-git: setup-git:
@echo "--> Installing git hooks" @echo "--> Installing git hooks"
git config branch.autosetuprebase always if [ -d .git/hooks ]; then \
cd .git/hooks && ln -sf ../../hooks/* ./ git config branch.autosetuprebase always; \
cd .git/hooks && ln -sf ../../hooks/* ./; \
fi
@echo "" @echo ""
clean: clean:

View File

@ -9,30 +9,18 @@ Is a TLS management and orchestration tool.
""" """
from __future__ import absolute_import from __future__ import absolute_import
import sys
import json
import os.path
import datetime import datetime
import json
import logging
import os.path
import sys
from subprocess import check_output
from distutils import log from setuptools import Command
from distutils.core import Command from setuptools import setup, find_packages
from setuptools.command.develop import develop from setuptools.command.develop import develop
from setuptools.command.install import install from setuptools.command.install import install
from setuptools.command.sdist import sdist from setuptools.command.sdist import sdist
from setuptools import setup, find_packages
from subprocess import check_output
import pip
if tuple(map(int, pip.__version__.split('.'))) >= (19, 3, 0):
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements
elif tuple(map(int, pip.__version__.split('.'))) >= (10, 0, 0):
from pip._internal.download import PipSession
from pip._internal.req import parse_requirements
else:
from pip.download import PipSession
from pip.req import parse_requirements
ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__))) ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__)))
@ -44,21 +32,18 @@ about = {}
with open(os.path.join(ROOT, 'lemur', '__about__.py')) as f: with open(os.path.join(ROOT, 'lemur', '__about__.py')) as f:
exec(f.read(), about) # nosec: about file is benign exec(f.read(), about) # nosec: about file is benign
install_requires_g = parse_requirements("requirements.txt", session=PipSession()) # Parse requirements files
tests_require_g = parse_requirements("requirements-tests.txt", session=PipSession()) with open('requirements.txt') as f:
docs_require_g = parse_requirements("requirements-docs.txt", session=PipSession()) install_requirements = f.read().splitlines()
dev_requires_g = parse_requirements("requirements-dev.txt", session=PipSession())
if tuple(map(int, pip.__version__.split('.'))) >= (20, 1): with open('requirements-tests.txt') as f:
install_requires = [str(ir.requirement) for ir in install_requires_g] tests_requirements = f.read().splitlines()
tests_require = [str(ir.requirement) for ir in tests_require_g]
docs_require = [str(ir.requirement) for ir in docs_require_g] with open('requirements-docs.txt') as f:
dev_requires = [str(ir.requirement) for ir in dev_requires_g] docs_requirements = f.read().splitlines()
else:
install_requires = [str(ir.req) for ir in install_requires_g] with open('requirements-dev.txt') as f:
tests_require = [str(ir.req) for ir in tests_require_g] dev_requirements = f.read().splitlines()
docs_require = [str(ir.req) for ir in docs_require_g]
dev_requires = [str(ir.req) for ir in dev_requires_g]
class SmartInstall(install): class SmartInstall(install):
@ -67,6 +52,7 @@ class SmartInstall(install):
If the package indicator is missing, this will also force a run of If the package indicator is missing, this will also force a run of
`build_static` which is required for JavaScript assets and other things. `build_static` which is required for JavaScript assets and other things.
""" """
def _needs_static(self): def _needs_static(self):
return not os.path.exists(os.path.join(ROOT, 'lemur/static/dist')) return not os.path.exists(os.path.join(ROOT, 'lemur/static/dist'))
@ -105,16 +91,16 @@ class BuildStatic(Command):
pass pass
def run(self): def run(self):
log.info("running [npm install --quiet] in {0}".format(ROOT)) logging.info("running [npm install --quiet] in {0}".format(ROOT))
try: try:
check_output(['npm', 'install', '--quiet'], cwd=ROOT) check_output(['npm', 'install', '--quiet'], cwd=ROOT)
log.info("running [gulp build]") logging.info("running [gulp build]")
check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'build'], cwd=ROOT) check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'build'], cwd=ROOT)
log.info("running [gulp package]") logging.info("running [gulp package]")
check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'package'], cwd=ROOT) check_output([os.path.join(ROOT, 'node_modules', '.bin', 'gulp'), 'package'], cwd=ROOT)
except Exception as e: except Exception as e:
log.warn("Unable to build static content") logging.warn("Unable to build static content")
setup( setup(
@ -128,11 +114,11 @@ setup(
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False,
install_requires=install_requires, install_requires=install_requirements,
extras_require={ extras_require={
'tests': tests_require, 'tests': tests_requirements,
'docs': docs_require, 'docs': docs_requirements,
'dev': dev_requires, 'dev': dev_requirements,
}, },
cmdclass={ cmdclass={
'build_static': BuildStatic, 'build_static': BuildStatic,