Add setup.py for install with pip

Make possible installation with pip.
Change-Id: I8eec015142c4f29eadff0dac2781782b76dea308
This commit is contained in:
Sagi Shnaidman 2020-05-22 21:22:46 +03:00
parent f3610ad0e1
commit c9da50e7e7
5 changed files with 81 additions and 8 deletions

View File

@ -46,6 +46,16 @@
- name: github.com/ansible/ansible
override-checkout: stable-2.9
- job:
name: ansible-collections-openstack-functional-devstack-ansible-2.9-pip
parent: ansible-collections-openstack-functional-devstack-ansible-2.9
description: |
Run openstack collections functional tests against a master devstack
using master of openstacksdk and stable 2.9 branch of ansible.
Ansible collection is built using PIP
vars:
tox_envlist: ansible-pip
- job:
name: ansible-collections-openstack-functional-devstack-train-ansible-devel
parent: ansible-collections-openstack-functional-devstack
@ -225,6 +235,9 @@
- ansible-collections-openstack-functional-devstack-queens-ansible-2.9:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
- ansible-collections-openstack-functional-devstack-ansible-2.9-pip:
dependencies: *deps_unit_lint
irrelevant-files: *ignore_files
gate:

View File

@ -97,14 +97,19 @@ then
fi
# install collections
tox -ebuild
ansible-galaxy collection build --force . --output-path ./build_artifact
ansible-galaxy collection install $(ls build_artifact/openstack-cloud-*) --force
if [[ -z "$PIP_INSTALL" ]]; then
tox -ebuild
ansible-galaxy collection install $(ls build_artifact/openstack-cloud-*) --force
TEST_COLLECTIONS_PATHS=${HOME}/.ansible/collections:$ANSIBLE_COLLECTIONS_PATHS
else
pip freeze | grep ansible-collections-openstack
TEST_COLLECTIONS_PATHS=$VIRTUAL_ENV/share/ansible/collections:$ANSIBLE_COLLECTIONS_PATHS
fi
# Discover openstackSDK version
SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)")
pushd ci/
# run tests
ANSIBLE_COLLECTIONS_PATHS=${HOME}/.ansible/collections ansible-playbook \
ANSIBLE_COLLECTIONS_PATHS=$TEST_COLLECTIONS_PATHS ansible-playbook \
-vvv ./run-collection.yml \
-e "sdk_version=${SDK_VER} cloud=${CLOUD} image=${IMAGE} ${ANSIBLE_VARS}" \
${tag_opt}

View File

@ -1,3 +1,38 @@
[metadata]
# This is a stub file to enable tox-siblings to work
name = ansible-collections-openstack
name = ansible-collections-openstack.cloud
summary = Ansible collections for Openstack cloud
description-file =
README.md
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = https://opendev.org/openstack/ansible-collections-openstack/
classifier =
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Intended Audience :: System Administrators
Intended Audience :: Information Technology
Topic :: System :: Systems Administration
Topic :: Utilities
[global]
setup-hooks =
pbr.hooks.setup_hook
[files]
data_files =
share/ansible/collections/ansible_collections/openstack/cloud/ = README.md
share/ansible/collections/ansible_collections/openstack/cloud/roles/ = roles/*
share/ansible/collections/ansible_collections/openstack/cloud/plugins/ = plugins/*
share/ansible/collections/ansible_collections/openstack/cloud/playbooks/ = playbooks/*
share/ansible/collections/ansible_collections/openstack/cloud/scripts/ = scripts/*
share/ansible/collections/ansible_collections/openstack/cloud/docs/ = docs/*
share/ansible/collections/ansible_collections/openstack/cloud/meta/ = meta/*
[wheel]
universal = 1
[pbr]
skip_authors = True
skip_changelog = True

8
setup.py Normal file
View File

@ -0,0 +1,8 @@
# Copyright Red Hat, Inc. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)

16
tox.ini
View File

@ -8,7 +8,9 @@ ignore_basepython_conflict = True
skip_install = True
install_command = python -m pip install {opts} {packages}
basepython = python3
passenv = OS_*
passenv =
OS_*
pip: PIP_INSTALL
setenv =
VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
@ -17,8 +19,10 @@ setenv =
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
pip: PIP_INSTALL={env:PIP_INSTALL:true}
deps =
-r{toxinidir}/test-requirements.txt
pip: {toxinidir}
commands = stestr run {posargs}
stestr slowest
@ -36,6 +40,7 @@ deps =
ruamel.yaml
galaxy-importer
git+https://github.com/ansible/ansible
commands =
python {toxinidir}/tools/build.py
ansible-galaxy collection build --force {toxinidir} --output-path {toxinidir}/build_artifact
@ -66,8 +71,15 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible_collections
[testenv:ansible]
# Need to pass some env vars for the Ansible playbooks
passenv = HOME USER ANSIBLE_VAR_*
passenv =
HOME
USER
ANSIBLE_*
deps =
{[testenv]deps}
commands =
/bin/bash {toxinidir}/ci/run-ansible-tests-collection.sh -e {envdir} {posargs}
[testenv:ansible-pip]
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}