cleaning up requirements imports and adding comments to change to .travis.yml
This commit is contained in:
parent
4ec0430a61
commit
beba785b09
|
@ -20,6 +20,7 @@ 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
|
- 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
|
||||||
|
|
46
setup.py
46
setup.py
|
@ -16,24 +16,12 @@ import os.path
|
||||||
import sys
|
import sys
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
|
|
||||||
import pkg_resources
|
|
||||||
from setuptools import Command
|
from setuptools import Command
|
||||||
from setuptools import setup, find_packages
|
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
|
||||||
|
|
||||||
if tuple(map(int, pkg_resources.require("pip")[0].version.split('.'))) >= (19, 3, 0):
|
|
||||||
from pip._internal.network.session import PipSession
|
|
||||||
from pip._internal.req.req_file import parse_requirements
|
|
||||||
|
|
||||||
elif tuple(map(int, pkg_resources.require("pip")[0].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__)))
|
||||||
|
|
||||||
# When executing the setup.py, we need to be able to import ourselves, this
|
# When executing the setup.py, we need to be able to import ourselves, this
|
||||||
|
@ -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, pkg_resources.require("pip")[0].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'))
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue