Leverage on pbr (Python Build Reasonableness)
authorCédric Ollivier <cedric.ollivier@orange.com>
Sun, 4 Jun 2017 18:05:50 +0000 (20:05 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Wed, 7 Jun 2017 09:34:45 +0000 (11:34 +0200)
pbr can inject requirements into the install_requires, tests_require
and/or dependency_links arguments to setup. They were previously
falsy unset.

It also supports conditional dependencies which can be added to the
requirements (e.g. subprocess32; python_version=='2.7').
Then requirements.py3.txt is removed.

It also removes functest/cli/setup.py which seems false and obsolete.

Dockerfile is updated as well. One temporarily link is created because
of several hardcoded paths in Functest.

Change-Id: I14b3b25e07fbac490dd1d5ce943ec02c5b11f242
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
docker/Dockerfile
docker/Dockerfile.aarch64
functest/cli/setup.py [deleted file]
kingbird_requirements.txt [deleted file]
requirements.py3.txt [deleted file]
requirements.txt
setup.cfg [new file with mode: 0644]
setup.py
tox.ini

index ff532cc..d18c6c9 100644 (file)
@@ -68,7 +68,7 @@ wget \
 
 RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
 
-RUN mkdir -p ${REPOS_DIR} \
+RUN mkdir -p ${FUNCTEST_REPO_DIR} \
     && mkdir -p ${REPOS_VNFS_DIR} \
     && mkdir -p ${FUNCTEST_BASE_DIR}/results \
     && mkdir -p ${FUNCTEST_CONF_DIR} \
@@ -79,8 +79,16 @@ RUN mkdir -p ${REPOS_DIR} \
 
 RUN git config --global http.sslVerify false
 
+RUN pip install \
+  git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \
+  git+https://gerrit.opnfv.org/gerrit/releng@$BRANCH#egg=opnfv\&subdirectory=modules \
+  git+https://gerrit.opnfv.org/gerrit/barometer@$BRANCH#egg=baro_tests \
+  git+https://gerrit.opnfv.org/gerrit/snaps@$BRANCH#egg=snaps
+
+# Hook required by hardcoded paths in Functest
+RUN ln -s /usr/local/lib/python2.7/dist-packages/functest ${FUNCTEST_REPO_DIR}/functest
+
 # OPNFV repositories
-RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/functest ${REPOS_DIR}/functest
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/copper ${REPOS_DIR}/copper
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sdnvpn ${REPOS_DIR}/sdnvpn
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/domino ${REPOS_DIR}/domino
@@ -108,33 +116,28 @@ RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${REPOS_
 
 RUN pip install -r ${REPOS_DIR}/rally/requirements.txt
 RUN pip install -r ${REPOS_DIR}/tempest/requirements.txt
-
-RUN cd ${FUNCTEST_REPO_DIR} \
-    && pip install -r requirements.txt \
-    && pip install -e .
-
 RUN pip install ${REPOS_DIR}/opera
 
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
     -not -path "*tests/unit*" \
     -not -path "*functest_venv*" \
     |xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \
-    && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+    && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
     -not -path "*functest_venv*" \
     |xargs grep -L \#\! |cut -d\:  -f 1 |xargs chmod -c 644
 
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
     -not -path "*tests/unit*" \
     -not -path "*functest_venv*" \
     |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \
-    && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+    && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
     -not -path "*functest_venv*" \
     |xargs grep \#\! |cut -d\:  -f 1 |xargs chmod -c 755
 
 RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR}
 RUN ${REPOS_DIR}/rally/install_rally.sh --yes
 
-RUN /bin/bash ${REPOS_DIR}/functest/docker/add_images.sh
+RUN add_images.sh
 
 RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
 RUN curl -L https://get.rvm.io | bash -s stable
@@ -148,8 +151,7 @@ RUN cd ${REPOS_DIR}/sdnvpn && pip install -e .
 RUN cd ${REPOS_DIR}/bgpvpn && pip install -e .
 
 # Kingbird integration
-RUN cd ${REPOS_DIR}/kingbird && pip install -e .
-RUN cd ${FUNCTEST_REPO_DIR} && pip install -r kingbird_requirements.txt
+RUN cd ${REPOS_DIR}/kingbird && pip install -e . -r test-requirements.txt
 
 # refstack-client integration
 RUN cd ${REPOS_DIR}/refstack-client && ./setup_env -t ${REFSTACK_TAG}
index 44e6904..eea475a 100644 (file)
@@ -67,7 +67,7 @@ wget \
 
 RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0
 
-RUN mkdir -p ${REPOS_DIR} \
+RUN mkdir -p ${FUNCTEST_REPO_DIR} \
     && mkdir -p ${REPOS_VNFS_DIR} \
     && mkdir -p ${FUNCTEST_BASE_DIR}/results \
     && mkdir -p ${FUNCTEST_BASE_DIR}/conf \
@@ -78,8 +78,16 @@ RUN mkdir -p ${REPOS_DIR} \
 
 RUN git config --global http.sslVerify false
 
+RUN pip install \
+  git+https://gerrit.opnfv.org/gerrit/functest@$BRANCH#egg=functest \
+  git+https://gerrit.opnfv.org/gerrit/releng@$BRANCH#egg=opnfv\&subdirectory=modules \
+  git+https://gerrit.opnfv.org/gerrit/barometer@$BRANCH#egg=baro_tests \
+  git+https://gerrit.opnfv.org/gerrit/snaps@$BRANCH#egg=snaps
+
+# Hook required by hardcoded paths in Functest
+RUN ln -s /usr/local/lib/python2.7/dist-packages/functest ${FUNCTEST_REPO_DIR}/functest
+
 # OPNFV repositories
-RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/functest ${REPOS_DIR}/functest
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/copper ${REPOS_DIR}/copper
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sdnvpn ${REPOS_DIR}/sdnvpn
 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/domino ${REPOS_DIR}/domino
@@ -105,30 +113,26 @@ RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${REPOS_
 RUN pip install -r ${REPOS_DIR}/rally/requirements.txt
 RUN pip install -r ${REPOS_DIR}/tempest/requirements.txt
 
-RUN cd ${FUNCTEST_REPO_DIR} \
-    && pip install -r requirements.txt \
-    && pip install -e .
-
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
     -not -path "*tests/unit*" \
     -not -path "*functest_venv*" \
     |xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \
-    && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+    && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
     -not -path "*functest_venv*" \
     |xargs grep -L \#\! |cut -d\:  -f 1 |xargs chmod -c 644
 
-RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
+RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \
     -not -path "*tests/unit*" \
     -not -path "*functest_venv*" \
     |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \
-    && find ${FUNCTEST_REPO_DIR} -name "*.sh" \
+    && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \
     -not -path "*functest_venv*" \
     |xargs grep \#\! |cut -d\:  -f 1 |xargs chmod -c 755
 
 RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR}
 RUN ${REPOS_DIR}/rally/install_rally.sh --yes
 
-RUN /bin/bash ${REPOS_DIR}/functest/docker/add_images.sh
+RUN add_images.sh
 
 RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
 RUN curl -L https://get.rvm.io | bash -s stable
@@ -144,7 +148,7 @@ RUN cd ${REPOS_DIR}/sdnvpn && pip install -e .
 RUN cd ${REPOS_DIR}/bgpvpn && pip install -e .
 
 # Kingbird integration
-RUN cd ${REPOS_DIR}/kingbird && pip install -e .
+RUN cd ${REPOS_DIR}/kingbird && pip install -e . -r test-requirements.txt
 
 # refstack-client integration
 RUN cd ${REPOS_DIR}/refstack-client && ./setup_env -t ${REFSTACK_TAG}
diff --git a/functest/cli/setup.py b/functest/cli/setup.py
deleted file mode 100644 (file)
index 21547e1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-from setuptools import setup
-
-setup(
-    name='functest',
-    version='colorado.0.1',
-    py_modules=['cli_base'],
-    include_package_data=True,
-    install_requires=[
-        'click',
-    ],
-    entry_points='''
-        [console_scripts]
-        functest=cli_base:cli
-    ''',
-)
diff --git a/kingbird_requirements.txt b/kingbird_requirements.txt
deleted file mode 100644 (file)
index adf1082..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-ddt==1.1.1
-oslosphinx==4.11.0
-oslotest==2.14.0
-pylint==1.4.5
-requests-mock==1.3.0
-tempest-lib==1.0.0
-testresources==2.0.1
-testscenarios==0.5.0
diff --git a/requirements.py3.txt b/requirements.py3.txt
deleted file mode 100644 (file)
index 6a003d5..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-pyyaml==3.10
-gitpython==1.0.1
-python-openstackclient==2.3.0
-python-ceilometerclient==2.6.2
-python-heatclient==1.7.0
-python-keystoneclient==3.5.0
-python-neutronclient==6.0.0
-python-novaclient==6.0.0
-python-congressclient==1.5.0
-python-tackerclient==0.7.0
-pexpect==4.0
-requests==2.9.1
-robotframework==3.0.2
-robotframework-httplibrary==0.4.2
-robotframework-requests==0.4.7
-jmespath==0.9.2
-configObj==5.0.6
-Flask==0.10.1
-xmltodict==0.9.2
-scp==0.10.2
-paramiko==2.1.2
-shyaml
-dnspython
-Pillow==3.3.0
-click==6.6
-openbaton-cli==2.2.1-beta7
-mock==1.3.0
-iniparse==0.4
-PrettyTable>=0.7.1,<0.8 # BSD
-six>=1.9.0 # MIT
-git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules
-git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests
index ef6b2f1..787aeaf 100644 (file)
@@ -20,14 +20,14 @@ requests==2.9.1
 robotframework==3.0.2
 robotframework-httplibrary==0.4.2
 robotframework-requests==0.4.7
-robotframework-sshlibrary==2.1.3
+robotframework-sshlibrary==2.1.3; python_version=='2.7'
 jmespath==0.9.2
 configObj==5.0.6
 Flask==0.10.1
 xmltodict==0.9.2
 scp==0.10.2
 paramiko==2.1.2
-subprocess32
+subprocess32; python_version=='2.7'
 shyaml
 dnspython
 Pillow==3.3.0
@@ -37,6 +37,6 @@ mock==1.3.0
 iniparse==0.4
 PrettyTable>=0.7.1,<0.8 # BSD
 six>=1.9.0 # MIT
-git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules
-git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests
-git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps
+opnfv
+baro_tests
+snaps
diff --git a/setup.cfg b/setup.cfg
new file mode 100644 (file)
index 0000000..ba13768
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,15 @@
+[metadata]
+name = functest
+version = 5
+home-page = https://wiki.opnfv.org/display/functest
+
+[files]
+packages = functest
+scripts =
+    docker/docker_remote_api/enable_remote_api.sh
+    docker/add_images.sh
+    docker/config_install_env.sh
+
+[entry_points]
+console_scripts =
+    functest = functest.cli.cli_base:cli
index 0c53ffb..460651c 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,25 +1,17 @@
-##############################################################################
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Apache License, Version 2.0
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
 
-from setuptools import setup, find_packages
+# pylint: disable=missing-docstring
 
+from setuptools import setup
 
 setup(
-    name="functest",
-    version="master",
-    py_modules=['cli_base'],
-    packages=find_packages(),
-    include_package_data=True,
-    package_data={
-    },
-    url="https://www.opnfv.org",
-    entry_points={
-        'console_scripts': [
-            'functest=functest.cli.cli_base:cli'
-        ],
-    },
+    setup_requires=['pbr>=1.9', 'setuptools>=17.1'],
+    pbr=True,
 )
diff --git a/tox.ini b/tox.ini
index 6c2734d..0b3e778 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,9 @@ usedevelop = True
 deps =
   -r{toxinidir}/requirements.txt
   -r{toxinidir}/test-requirements.txt
+  git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules
+  git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests
+  git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps
 commands = nosetests --with-xunit \
   --with-coverage \
   --cover-tests \
@@ -20,14 +23,10 @@ commands = sphinx-build -W -b html api/ api/_build
 
 [testenv:pep8]
 basepython = python2.7
-deps =
-  {[testenv]deps}
 commands = flake8
 
 [testenv:pylint]
 basepython = python2.7
-deps =
-  {[testenv]deps}
 whitelist_externals = bash
 modules =
   functest.core.feature
@@ -51,7 +50,4 @@ dirs =
   functest/tests/unit/core
   functest/tests/unit/odl
   functest/tests/unit/utils/test_decorators.py
-deps =
-  -r{toxinidir}/requirements.py3.txt
-  -r{toxinidir}/test-requirements.txt
 commands = nosetests {[testenv:py35]dirs}