From 91fb95eae5172e593c2621f60ab76dbb45605e75 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Sat, 4 May 2019 17:01:46 -0500 Subject: [PATCH] Use DevStack's setup_*() functions for Python packages These functions do a number of things, specifically they handles the DevStack USE_PYTHON3 switch transparently so we can run both major Python versions. The new setup.cfg files are only used by setup_*() right now, making the switch to use pbr is beyond what I want to do here. Change-Id: Ib9753119235b1ce23030a2b3de0169ed6f8819e0 Signed-off-by: Dean Troyer --- devstack/lib/fault | 36 +++++++++--------------------- fm-api/setup.cfg | 25 +++++++++++++++++++++ fm-common/sources/requirements.txt | 7 ++++++ fm-common/sources/setup.cfg | 25 +++++++++++++++++++++ python-fmclient/fmclient/setup.cfg | 11 ++++----- 5 files changed, 74 insertions(+), 30 deletions(-) create mode 100644 fm-api/setup.cfg create mode 100644 fm-common/sources/requirements.txt create mode 100644 fm-common/sources/setup.cfg diff --git a/devstack/lib/fault b/devstack/lib/fault index 9a8d489d..614fe31d 100644 --- a/devstack/lib/fault +++ b/devstack/lib/fault @@ -29,6 +29,11 @@ set -o xtrace STX_FAULT_DIR=${GITDIR[$STX_FAULT_NAME]} STX_FAULT_CONF_DIR=/etc/fm + +GITDIR["fm-api"]=$STX_FAULT_DIR/fm-api +GITDIR["fm-client"]=$STX_FAULT_DIR/python-fmclient/fmclient +GITDIR["fm-core"]=$STX_FAULT_DIR/fm-common/sources + FM_RESTAPI_CONF=$STX_FAULT_CONF_DIR/fm.conf FM_RESTAPI_PASTE_INI=$STX_FAULT_CONF_DIR/api-paste.ini FM_EVENT_YAML=$STX_FAULT_CONF_DIR/events.yaml @@ -60,7 +65,7 @@ PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; pri # --------- function build_fm_common { - pushd $STX_FAULT_DIR/fm-common/sources + pushd ${GITDIR["fm-core"]} local major minor version x @@ -263,8 +268,7 @@ function init_fault { } function init_rest_api { - # create db for fm - createdb -h 127.0.0.1 -Uroot -l C -T template0 -E utf8 fm + recreate_database fm fm-dbsync --config-file $FM_RESTAPI_CONF } @@ -287,29 +291,15 @@ function install_fault { } function install_fm_api { - pushd $STX_FAULT_DIR/fm-api - sudo python setup.py install \ - --root=/ \ - --install-lib=$PYTHON_SITE_DIR \ - --prefix=/usr \ - --install-data=/usr/share \ - --single-version-externally-managed - popd + setup_dev_lib "fm-api" } function install_fm_client { - pushd $STX_FAULT_DIR/python-fmclient/fmclient - sudo python setup.py install \ - --root=/ \ - --install-lib=$PYTHON_SITE_DIR \ - --prefix=/usr \ - --install-data=/usr/share \ - --single-version-externally-managed - popd + setup_dev_lib "fm-client" } function install_fm_common { - pushd $STX_FAULT_DIR/fm-common/sources + pushd ${GITDIR["fm-core"]} local major minor version x @@ -331,11 +321,7 @@ function install_fm_common { MINOR=$minor \ install - sudo python setup.py install \ - --root=/ \ - --install-lib=$PYTHON_SITE_DIR \ - --prefix=/usr \ - --install-data=/usr/share \ + setup_dev_lib "fm-core" # This _is_ still a little nasty, clean it up $STX_SUDO install -m 755 fm_db_sync_event_suppression.py \ diff --git a/fm-api/setup.cfg b/fm-api/setup.cfg new file mode 100644 index 00000000..cbc39a00 --- /dev/null +++ b/fm-api/setup.cfg @@ -0,0 +1,25 @@ +[metadata] +name = fm_api +summary = Fault Management Python API +author = StarlingX +author-email = starlingx-discuss@lists.starlingx.io +home-page = https://opendev.org/starlingx/fault +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + +[files] +packages = + fm_api + +[wheel] +universal = 1 diff --git a/fm-common/sources/requirements.txt b/fm-common/sources/requirements.txt new file mode 100644 index 00000000..3f812230 --- /dev/null +++ b/fm-common/sources/requirements.txt @@ -0,0 +1,7 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. +pbr!=2.1.0,>=2.0.0 # Apache-2.0 + +PyYAML>=3.10.0 # MIT +SQLAlchemy>=1.0.10,!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8 # MIT diff --git a/fm-common/sources/setup.cfg b/fm-common/sources/setup.cfg new file mode 100644 index 00000000..40d86205 --- /dev/null +++ b/fm-common/sources/setup.cfg @@ -0,0 +1,25 @@ +[metadata] +name = fm_core +summary = Fault Management common components +author = StarlingX +author-email = starlingx-discuss@lists.starlingx.io +home-page = https://opendev.org/starlingx/fault +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + +[files] +packages = + fm_core + +[wheel] +universal = 1 diff --git a/python-fmclient/fmclient/setup.cfg b/python-fmclient/fmclient/setup.cfg index 64cad5fc..b6f007a6 100644 --- a/python-fmclient/fmclient/setup.cfg +++ b/python-fmclient/fmclient/setup.cfg @@ -1,11 +1,9 @@ [metadata] name = fmclient summary = A python client library for Fault Management -#description-file = -# README.rst -#author = OpenStack -#author-email = openstack-discuss@lists.openstack.org -#home-page = https://docs.openstack.org/nova/latest/ +author = StarlingX +author-email = starlingx-discuss@lists.starlingx.io +home-page = https://opendev.org/starlingx/fault classifier = Environment :: OpenStack Intended Audience :: Information Technology @@ -17,6 +15,7 @@ classifier = Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 [global] setup-hooks = @@ -35,3 +34,5 @@ tag_build = tag_date = 0 tag_svn_revision = 0 +[wheel] +universal = 1