From bffa240bb7b96d1aa9186cadc77e644c0c255a50 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Dec 20 2017 02:52:41 +0000 Subject: [PATCH 1/2] Run tox without need of sitepackages * Since koji-1.15, it supports setuptools. There is no need of koji installed in system. * So far, koji-1.15 has not been published to PyPI. As a result, koji is installed from source code from tag koji-1.15.0. * tox.ini is updated to run without the need of option sitepackages. Signed-off-by: Chenxiong Qi --- diff --git a/requirements.txt b/requirements.txt index d8444eb..ed43438 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,3 +22,5 @@ enum34 ; python_version <= '2.7' odcs[client] krbcontext dogpile.cache + +git+https://pagure.io/koji.git@koji-1.15.0#egg=koji diff --git a/setup.py b/setup.py index 822bf0c..7c6f4fe 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,33 @@ +# -*- coding: utf-8 -*- + +import os from setuptools import setup, find_packages -with open('requirements.txt') as f: - requirements = f.readlines() -with open('test-requirements.txt') as f: - test_requirements = f.readlines() +def read_requirements(filename): + specifiers = [] + dep_links = [] + + with open(filename, 'r') as f: + for line in f: + if line.startswith('-r') or line.strip() == '': + continue + if line.startswith('git+'): + dep_links.append(line.strip()) + else: + specifiers.append(line.strip()) + + return specifiers, dep_links + + +setup_py_path = os.path.dirname(os.path.realpath(__file__)) +requirements_file = os.path.join(setup_py_path, 'requirements.txt') +test_requirements_file = os.path.join(setup_py_path, 'test-requirements.txt') +install_requires, deps_links = read_requirements(requirements_file) +tests_require, _ = read_requirements(test_requirements_file) +if _: + deps_links.extend(_) + setup(name='freshmaker', description='Continuous Compose Service', @@ -23,8 +46,9 @@ setup(name='freshmaker', packages=find_packages(exclude=['tests']), include_package_data=True, zip_safe=False, - install_requires=requirements, - tests_require=test_requirements, + install_requires=install_requires, + tests_require=tests_require, + dependency_links=deps_links, entry_points={ 'moksha.consumer': 'freshmakerconsumer = freshmaker.consumer:FreshmakerConsumer', 'console_scripts': ['freshmaker-frontend = freshmaker.manage:runssl', diff --git a/test-requirements.txt b/test-requirements.txt index 1e5e44e..d7eb98b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,5 @@ +-r requirements.txt + copr mock pytest diff --git a/tox.ini b/tox.ini index 66a7182..720422c 100644 --- a/tox.ini +++ b/tox.ini @@ -7,11 +7,10 @@ envlist = py27, py35, coverage, flake8, bandit [testenv] -# using sitepackages is not a good idea, but Koji... :( -sitepackages = True -install_command = pip install --force-reinstall --ignore-installed {packages} -deps = pytest -commands = py.test {posargs} +skip_install = True +deps = -r{toxinidir}/test-requirements.txt +commands = + py.test {posargs} [testenv:coverage] basepython = python3 From b14c3fc01d7d2bec585b58f68b94501c5815328e Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Dec 20 2017 02:52:41 +0000 Subject: [PATCH 2/2] Add missing pyldap used to query from LDAP Signed-off-by: Chenxiong Qi --- diff --git a/requirements.txt b/requirements.txt index ed43438..2539676 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,5 +22,6 @@ enum34 ; python_version <= '2.7' odcs[client] krbcontext dogpile.cache +pyldap git+https://pagure.io/koji.git@koji-1.15.0#egg=koji