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 <dtroyer@gmail.com>
This commit is contained in:
Dean Troyer 2019-05-04 17:01:46 -05:00
parent 2441aededf
commit 91fb95eae5
5 changed files with 74 additions and 30 deletions

View File

@ -29,6 +29,11 @@ set -o xtrace
STX_FAULT_DIR=${GITDIR[$STX_FAULT_NAME]} STX_FAULT_DIR=${GITDIR[$STX_FAULT_NAME]}
STX_FAULT_CONF_DIR=/etc/fm 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_CONF=$STX_FAULT_CONF_DIR/fm.conf
FM_RESTAPI_PASTE_INI=$STX_FAULT_CONF_DIR/api-paste.ini FM_RESTAPI_PASTE_INI=$STX_FAULT_CONF_DIR/api-paste.ini
FM_EVENT_YAML=$STX_FAULT_CONF_DIR/events.yaml 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 { function build_fm_common {
pushd $STX_FAULT_DIR/fm-common/sources pushd ${GITDIR["fm-core"]}
local major minor version x local major minor version x
@ -263,8 +268,7 @@ function init_fault {
} }
function init_rest_api { function init_rest_api {
# create db for fm recreate_database fm
createdb -h 127.0.0.1 -Uroot -l C -T template0 -E utf8 fm
fm-dbsync --config-file $FM_RESTAPI_CONF fm-dbsync --config-file $FM_RESTAPI_CONF
} }
@ -287,29 +291,15 @@ function install_fault {
} }
function install_fm_api { function install_fm_api {
pushd $STX_FAULT_DIR/fm-api setup_dev_lib "fm-api"
sudo python setup.py install \
--root=/ \
--install-lib=$PYTHON_SITE_DIR \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
popd
} }
function install_fm_client { function install_fm_client {
pushd $STX_FAULT_DIR/python-fmclient/fmclient setup_dev_lib "fm-client"
sudo python setup.py install \
--root=/ \
--install-lib=$PYTHON_SITE_DIR \
--prefix=/usr \
--install-data=/usr/share \
--single-version-externally-managed
popd
} }
function install_fm_common { function install_fm_common {
pushd $STX_FAULT_DIR/fm-common/sources pushd ${GITDIR["fm-core"]}
local major minor version x local major minor version x
@ -331,11 +321,7 @@ function install_fm_common {
MINOR=$minor \ MINOR=$minor \
install install
sudo python setup.py install \ setup_dev_lib "fm-core"
--root=/ \
--install-lib=$PYTHON_SITE_DIR \
--prefix=/usr \
--install-data=/usr/share \
# This _is_ still a little nasty, clean it up # This _is_ still a little nasty, clean it up
$STX_SUDO install -m 755 fm_db_sync_event_suppression.py \ $STX_SUDO install -m 755 fm_db_sync_event_suppression.py \

25
fm-api/setup.cfg Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,11 +1,9 @@
[metadata] [metadata]
name = fmclient name = fmclient
summary = A python client library for Fault Management summary = A python client library for Fault Management
#description-file = author = StarlingX
# README.rst author-email = starlingx-discuss@lists.starlingx.io
#author = OpenStack home-page = https://opendev.org/starlingx/fault
#author-email = openstack-discuss@lists.openstack.org
#home-page = https://docs.openstack.org/nova/latest/
classifier = classifier =
Environment :: OpenStack Environment :: OpenStack
Intended Audience :: Information Technology Intended Audience :: Information Technology
@ -17,6 +15,7 @@ classifier =
Programming Language :: Python :: 2.7 Programming Language :: Python :: 2.7
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
[global] [global]
setup-hooks = setup-hooks =
@ -35,3 +34,5 @@ tag_build =
tag_date = 0 tag_date = 0
tag_svn_revision = 0 tag_svn_revision = 0
[wheel]
universal = 1