[Freeipa-devel] [freeipa PR#618][synchronized] [WIP] Tox testing support for client wheel packages
URL: https://github.com/freeipa/freeipa/pull/618 Author: tiran Title: #618: [WIP] Tox testing support for client wheel packages Action: synchronized To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/618/head:pr618 git checkout pr618 From 5a5c840bc994a3e217e22f4ff01eee7f3fe300ab Mon Sep 17 00:00:00 2001 From: Christian HeimesDate: Thu, 17 Nov 2016 16:43:17 +0100 Subject: [PATCH] tox testing support for client wheel packages Signed-off-by: Christian Heimes --- .gitignore | 2 ++ .tox-install.sh | 64 Makefile.am | 2 ++ configure.ac | 1 + ipatests/conftest.py | 5 ++-- tox.ini | 38 +++ 6 files changed, 110 insertions(+), 2 deletions(-) create mode 100755 .tox-install.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 8941fd8..8b57dbc 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ freeipa2-dev-doc # Root directory /freeipa.spec /dist/ +/.tox/ +/.cache/ /*/dist/ /RELEASE /rpmbuild/ diff --git a/.tox-install.sh b/.tox-install.sh new file mode 100755 index 000..9747d14 --- /dev/null +++ b/.tox-install.sh @@ -0,0 +1,64 @@ +#!/bin/bash +set -ex + +ENVPYTHON="$1" +ENVSITEPACKAGESDIR="$2" +# 3...end are package requirements +shift 2 + +TOXINIDIR="$(cd "$(dirname "$0")" && pwd)" + +# sanity checks +if [ ! -x "${ENVPYTHON}" ]; then +echo "${ENVPYTHON}: no such executable" +exit 1 +fi + +if [ ! -d "${ENVSITEPACKAGESDIR}" ]; then +echo "${ENVSITEPACKAGESDIR}: no such directory" +exit 2 +fi + +if [ ! -f "${TOXINIDIR}/tox.ini" ]; then +echo "${TOXINIDIR}: no such directory" +exit 3 +fi + +# https://pip.pypa.io/en/stable/user_guide/#environment-variables +export PIP_CACHE_DIR="${TOXINIDIR}/.tox/cache" +mkdir -p "${PIP_CACHE_DIR}" + +DISTBUNDLE="${TOXINIDIR}/dist/bundle" +mkdir -p "${DISTBUNDLE}" + +# create configure +pushd "${TOXINIDIR}" +if [ ! -f "configure" ]; then +autoreconf -i -f +fi +# (re)create Makefile +./configure --disable-server +popd + +# copy pylint plugin +cp "${TOXINIDIR}/pylint_plugins.py" "${ENVSITEPACKAGESDIR}" + +# build packages and bundles +make -C "${TOXINIDIR}" \ +wheel_bundle \ +PYTHON="${ENVPYTHON}" \ +IPA_EXTRA_WHEELS="$*" + +# chdir to prevent local .egg-info from messing up pip +pushd "${ENVSITEPACKAGESDIR}" + +# Install packages with dist/bundle/ as extra source for wheels while ignoring +# upstream Python Package Index. +$ENVPYTHON -m pip install \ +--no-index \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +$@ + +popd diff --git a/Makefile.am b/Makefile.am index 1989b19..ff3ce2a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,7 @@ EXTRA_DIST = .mailmap \ clean-local: rm -rf "$(RPMBUILD)" rm -rf "$(top_builddir)/dist" + rm -rf "$(top_builddir)/.tox" rm -rf "$(top_srcdir)/__pycache__" rm -f "$(top_builddir)"/$(PACKAGE)-*.tar.gz @@ -212,6 +213,7 @@ pylint: $(top_builddir)/ipapython/version.py ipasetup.py -path './freeipa-*' -prune -o \ -path './dist' -prune -o \ -path './pypi' -prune -o \ + -path './.tox' -prune -o \ -name '.*' -o \ -name '*.in' -o \ -name '*~' -o \ diff --git a/configure.ac b/configure.ac index 8f8751a..68601de 100644 --- a/configure.ac +++ b/configure.ac @@ -276,6 +276,7 @@ AC_CONFIG_COMMANDS([po/POTFILES.in], -path "./${PACKAGE}-*" -prune -o dnl dist directories -path '*/build' -prune -o dnl Python builds -path '*/dist' -prune -o dnl Python dists + -path './.tox' -prune -o dnl Python tox test -path './conf*' -prune -o dnl generated by configure -name '*.py' -print -o dnl -name '*.c' -print -o dnl diff --git a/ipatests/conftest.py b/ipatests/conftest.py index 61e889d..ab17575 100644 --- a/ipatests/conftest.py +++ b/ipatests/conftest.py @@ -52,7 +52,9 @@ 'ipaserver/build', 'ipatests/build', # install/share/wsgi.py -'install/share' +'install/share', +# integration plugin imports from ipaplatform +'ipatests/pytest_plugins', ] @@ -100,7 +102,6 @@ def pytest_cmdline_main(config): ) for klass in cli_plugins: api.add_plugin(klass) - # XXX workaround until https://fedorahosted.org/freeipa/ticket/6408 has # been resolved. if ipaserver is not None: diff --git a/tox.ini b/tox.ini new file mode 100644 index 000..18331af --- /dev/null +++ b/tox.ini @@ -0,0 +1,38 @@ +[tox] +minversion=2.3.1 +envlist=py27,py35,pylint2,pylint3 +skip_missing_interpreters=true +skipsdist=true + +[testenv] +# always re-create virtual env. A special install helper is used to configure, +# build and install packages. +recreate=True +install_command={toxinidir}/.tox-install.sh {envpython} {envsitepackagesdir} {packages} +changedir={envdir} +setenv= +
[Freeipa-devel] [freeipa PR#618][synchronized] [WIP] Tox testing support for client wheel packages
URL: https://github.com/freeipa/freeipa/pull/618 Author: tiran Title: #618: [WIP] Tox testing support for client wheel packages Action: synchronized To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/618/head:pr618 git checkout pr618 From 3b4c9f34c7c5617e2f6dcaac9501072a9fc2880c Mon Sep 17 00:00:00 2001 From: Christian HeimesDate: Thu, 17 Nov 2016 16:43:17 +0100 Subject: [PATCH] tox testing support for client wheel packages Signed-off-by: Christian Heimes --- .gitignore | 2 ++ .tox-install.sh | 72 Makefile.am | 14 +++--- configure.ac | 1 + ipatests/conftest.py | 5 ++-- tox.ini | 38 +++ 6 files changed, 126 insertions(+), 6 deletions(-) create mode 100755 .tox-install.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 8941fd8..8b57dbc 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ freeipa2-dev-doc # Root directory /freeipa.spec /dist/ +/.tox/ +/.cache/ /*/dist/ /RELEASE /rpmbuild/ diff --git a/.tox-install.sh b/.tox-install.sh new file mode 100755 index 000..ab4a4c5 --- /dev/null +++ b/.tox-install.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -x + +PYTHON="$1" +ENVSITEPACKAGESDIR="$2" +# 3...end are package requirements +shift 2 + +TOXINIDIR="$(cd "$(dirname "$0")" && pwd)" + +# sanity checks +if [ ! -x "${PYTHON}" ]; then +echo "${PYTHON}: no such executable" +exit 1 +fi + +if [ ! -d "${ENVSITEPACKAGESDIR}" ]; then +echo "${ENVSITEPACKAGESDIR}: no such directory" +exit 2 +fi + +if [ ! -f "${TOXINIDIR}/tox.ini" ]; then +echo "${TOXINIDIR}: no such directory" +exit 3 +fi + +# https://pip.pypa.io/en/stable/user_guide/#environment-variables +export PIP_CACHE_DIR="${TOXINIDIR}/.tox/cache" +mkdir -p "${PIP_CACHE_DIR}" + +DISTBUNDLE="${TOXINIDIR}/dist/bundle" +mkdir -p "${DISTBUNDLE}" + +# create configure +pushd "${TOXINIDIR}" +if [ ! -f "configure" ]; then +autoreconf -i -f +fi +# (re)create Makefile +./configure --disable-server +popd + +# copy pylint plugin +cp "${TOXINIDIR}/pylint_plugins.py" "${ENVSITEPACKAGESDIR}" + +# build packages and bundles +make -C "${TOXINIDIR}" \ +PYTHON="${PYTHON}" \ +IPA_EXTRA_SUBDIRS="ipatests" \ +wheel_bundle + +# chdir to prevent local .egg-info from messing up pip +pushd "${ENVSITEPACKAGESDIR}" + +# build additional wheels, e.g. pylint +$PYTHON -m pip wheel \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +--wheel-dir "${DISTBUNDLE}" \ +$@ + +# Install packages with dist/bundle/ as extra source for wheels while ignoring +# upstream Python Package Index. +$PYTHON -m pip install \ +--no-index \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +$@ + +popd diff --git a/Makefile.am b/Makefile.am index efa8b73..d1bb12c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,7 @@ EXTRA_DIST = .mailmap \ clean-local: rm -rf "$(RPMBUILD)" rm -rf "$(top_builddir)/dist" + rm -rf "$(top_builddir)/.tox" rm -rf "$(top_srcdir)/__pycache__" rm -f "$(top_builddir)"/$(PACKAGE)-*.tar.gz @@ -212,6 +213,7 @@ pylint: $(top_builddir)/ipapython/version.py ipasetup.py -path './freeipa-*' -prune -o \ -path './dist' -prune -o \ -path './pypi' -prune -o \ + -path './.tox' -prune -o \ -name '.*' -o \ -name '*.in' -o \ -name '*~' -o \ @@ -252,7 +254,10 @@ jslint-html: jsl -nologo -nosummary -nofilelisting -conf jsl.conf endif # WITH_JSLINT -.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages +# Python wheels +# IPA_EXTRA_SUBDIRS: extra subdirs to build wheels (e.g. ipatests) + +.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages WHEELDISTDIR = $(top_builddir)/dist/wheels WHEELBUNDLEDIR = $(top_builddir)/dist/bundle @@ -263,19 +268,20 @@ $(WHEELBUNDLEDIR): mkdir -p $(WHEELBUNDLEDIR) bdist_wheel: $(WHEELDISTDIR) - for dir in $(IPACLIENT_SUBDIRS); do \ + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELDISTDIR)/$(item)-*.whl) + for dir in $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS); do \ $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel .wheelconstraints - rm -f $(foreach item,$(IPACLIENT_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) $(PYTHON) -m pip wheel \ --disable-pip-version-check \ --constraint .wheelconstraints \ --find-links $(WHEELDISTDIR) \ --find-links $(WHEELBUNDLEDIR) \ --wheel-dir $(WHEELBUNDLEDIR) \ - $(IPACLIENT_SUBDIRS) + $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS) wheel_placeholder: $(WHEELDISTDIR) for dir in
[Freeipa-devel] [freeipa PR#618][synchronized] [WIP] Tox testing support for client wheel packages
URL: https://github.com/freeipa/freeipa/pull/618 Author: tiran Title: #618: [WIP] Tox testing support for client wheel packages Action: synchronized To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/618/head:pr618 git checkout pr618 From e5c90a2ceae2e2e44047f67ca05ad9ff9c272abe Mon Sep 17 00:00:00 2001 From: Christian HeimesDate: Thu, 17 Nov 2016 16:43:17 +0100 Subject: [PATCH 1/3] tox testing support for client wheel packages Signed-off-by: Christian Heimes --- .gitignore | 2 ++ .tox-install.sh | 72 Makefile.am | 14 +++--- configure.ac | 1 + ipatests/conftest.py | 1 - tox.ini | 38 +++ 6 files changed, 123 insertions(+), 5 deletions(-) create mode 100755 .tox-install.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 8941fd8..8b57dbc 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ freeipa2-dev-doc # Root directory /freeipa.spec /dist/ +/.tox/ +/.cache/ /*/dist/ /RELEASE /rpmbuild/ diff --git a/.tox-install.sh b/.tox-install.sh new file mode 100755 index 000..ab4a4c5 --- /dev/null +++ b/.tox-install.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -x + +PYTHON="$1" +ENVSITEPACKAGESDIR="$2" +# 3...end are package requirements +shift 2 + +TOXINIDIR="$(cd "$(dirname "$0")" && pwd)" + +# sanity checks +if [ ! -x "${PYTHON}" ]; then +echo "${PYTHON}: no such executable" +exit 1 +fi + +if [ ! -d "${ENVSITEPACKAGESDIR}" ]; then +echo "${ENVSITEPACKAGESDIR}: no such directory" +exit 2 +fi + +if [ ! -f "${TOXINIDIR}/tox.ini" ]; then +echo "${TOXINIDIR}: no such directory" +exit 3 +fi + +# https://pip.pypa.io/en/stable/user_guide/#environment-variables +export PIP_CACHE_DIR="${TOXINIDIR}/.tox/cache" +mkdir -p "${PIP_CACHE_DIR}" + +DISTBUNDLE="${TOXINIDIR}/dist/bundle" +mkdir -p "${DISTBUNDLE}" + +# create configure +pushd "${TOXINIDIR}" +if [ ! -f "configure" ]; then +autoreconf -i -f +fi +# (re)create Makefile +./configure --disable-server +popd + +# copy pylint plugin +cp "${TOXINIDIR}/pylint_plugins.py" "${ENVSITEPACKAGESDIR}" + +# build packages and bundles +make -C "${TOXINIDIR}" \ +PYTHON="${PYTHON}" \ +IPA_EXTRA_SUBDIRS="ipatests" \ +wheel_bundle + +# chdir to prevent local .egg-info from messing up pip +pushd "${ENVSITEPACKAGESDIR}" + +# build additional wheels, e.g. pylint +$PYTHON -m pip wheel \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +--wheel-dir "${DISTBUNDLE}" \ +$@ + +# Install packages with dist/bundle/ as extra source for wheels while ignoring +# upstream Python Package Index. +$PYTHON -m pip install \ +--no-index \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +$@ + +popd diff --git a/Makefile.am b/Makefile.am index af22315..ba81c55 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,7 @@ EXTRA_DIST = .mailmap \ clean-local: rm -rf "$(RPMBUILD)" rm -rf "$(top_builddir)/dist" + rm -rf "$(top_builddir)/.tox" rm -rf "$(top_srcdir)/__pycache__" rm -f "$(top_builddir)"/$(PACKAGE)-*.tar.gz @@ -183,6 +184,7 @@ pylint: $(top_builddir)/ipapython/version.py ipasetup.py -path './freeipa-*' -prune -o \ -path './dist' -prune -o \ -path './pypi' -prune -o \ + -path './.tox' -prune -o \ -name '.*' -o \ -name '*.in' -o \ -name '*~' -o \ @@ -223,7 +225,10 @@ jslint-html: jsl -nologo -nosummary -nofilelisting -conf jsl.conf endif # WITH_JSLINT -.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages +# Python wheels +# IPA_EXTRA_SUBDIRS: extra subdirs to build wheels (e.g. ipatests) + +.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages WHEELDISTDIR = $(top_builddir)/dist/wheels WHEELBUNDLEDIR = $(top_builddir)/dist/bundle @@ -234,19 +239,20 @@ $(WHEELBUNDLEDIR): mkdir -p $(WHEELBUNDLEDIR) bdist_wheel: $(WHEELDISTDIR) - for dir in $(IPACLIENT_SUBDIRS); do \ + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELDISTDIR)/$(item)-*.whl) + for dir in $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS); do \ $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel .wheelconstraints - rm -f $(foreach item,$(IPACLIENT_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) $(PYTHON) -m pip wheel \ --disable-pip-version-check \ --constraint .wheelconstraints \ --find-links $(WHEELDISTDIR) \ --find-links $(WHEELBUNDLEDIR) \ --wheel-dir $(WHEELBUNDLEDIR) \ - $(IPACLIENT_SUBDIRS) + $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS) wheel_placeholder: $(WHEELDISTDIR) for dir in
[Freeipa-devel] [freeipa PR#618][synchronized] [WIP] Tox testing support for client wheel packages
URL: https://github.com/freeipa/freeipa/pull/618 Author: tiran Title: #618: [WIP] Tox testing support for client wheel packages Action: synchronized To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/618/head:pr618 git checkout pr618 From 69d19bb585b80aa45683676ef2cba34c511e302e Mon Sep 17 00:00:00 2001 From: Christian HeimesDate: Thu, 17 Nov 2016 16:43:17 +0100 Subject: [PATCH 1/4] tox testing support for client wheel packages Signed-off-by: Christian Heimes --- .gitignore | 2 ++ .tox-install.sh | 72 Makefile.am | 14 +++--- configure.ac | 1 + ipatests/conftest.py | 1 - tox.ini | 38 +++ 6 files changed, 123 insertions(+), 5 deletions(-) create mode 100755 .tox-install.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 90d7d23..8f4c2aa 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ freeipa2-dev-doc # Root directory /freeipa.spec /dist/ +/.tox/ +/.cache/ /*/dist/ /RELEASE /rpmbuild/ diff --git a/.tox-install.sh b/.tox-install.sh new file mode 100755 index 000..ab4a4c5 --- /dev/null +++ b/.tox-install.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -x + +PYTHON="$1" +ENVSITEPACKAGESDIR="$2" +# 3...end are package requirements +shift 2 + +TOXINIDIR="$(cd "$(dirname "$0")" && pwd)" + +# sanity checks +if [ ! -x "${PYTHON}" ]; then +echo "${PYTHON}: no such executable" +exit 1 +fi + +if [ ! -d "${ENVSITEPACKAGESDIR}" ]; then +echo "${ENVSITEPACKAGESDIR}: no such directory" +exit 2 +fi + +if [ ! -f "${TOXINIDIR}/tox.ini" ]; then +echo "${TOXINIDIR}: no such directory" +exit 3 +fi + +# https://pip.pypa.io/en/stable/user_guide/#environment-variables +export PIP_CACHE_DIR="${TOXINIDIR}/.tox/cache" +mkdir -p "${PIP_CACHE_DIR}" + +DISTBUNDLE="${TOXINIDIR}/dist/bundle" +mkdir -p "${DISTBUNDLE}" + +# create configure +pushd "${TOXINIDIR}" +if [ ! -f "configure" ]; then +autoreconf -i -f +fi +# (re)create Makefile +./configure --disable-server +popd + +# copy pylint plugin +cp "${TOXINIDIR}/pylint_plugins.py" "${ENVSITEPACKAGESDIR}" + +# build packages and bundles +make -C "${TOXINIDIR}" \ +PYTHON="${PYTHON}" \ +IPA_EXTRA_SUBDIRS="ipatests" \ +wheel_bundle + +# chdir to prevent local .egg-info from messing up pip +pushd "${ENVSITEPACKAGESDIR}" + +# build additional wheels, e.g. pylint +$PYTHON -m pip wheel \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +--wheel-dir "${DISTBUNDLE}" \ +$@ + +# Install packages with dist/bundle/ as extra source for wheels while ignoring +# upstream Python Package Index. +$PYTHON -m pip install \ +--no-index \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +$@ + +popd diff --git a/Makefile.am b/Makefile.am index af22315..ba81c55 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,7 @@ EXTRA_DIST = .mailmap \ clean-local: rm -rf "$(RPMBUILD)" rm -rf "$(top_builddir)/dist" + rm -rf "$(top_builddir)/.tox" rm -rf "$(top_srcdir)/__pycache__" rm -f "$(top_builddir)"/$(PACKAGE)-*.tar.gz @@ -183,6 +184,7 @@ pylint: $(top_builddir)/ipapython/version.py ipasetup.py -path './freeipa-*' -prune -o \ -path './dist' -prune -o \ -path './pypi' -prune -o \ + -path './.tox' -prune -o \ -name '.*' -o \ -name '*.in' -o \ -name '*~' -o \ @@ -223,7 +225,10 @@ jslint-html: jsl -nologo -nosummary -nofilelisting -conf jsl.conf endif # WITH_JSLINT -.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages +# Python wheels +# IPA_EXTRA_SUBDIRS: extra subdirs to build wheels (e.g. ipatests) + +.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages WHEELDISTDIR = $(top_builddir)/dist/wheels WHEELBUNDLEDIR = $(top_builddir)/dist/bundle @@ -234,19 +239,20 @@ $(WHEELBUNDLEDIR): mkdir -p $(WHEELBUNDLEDIR) bdist_wheel: $(WHEELDISTDIR) - for dir in $(IPACLIENT_SUBDIRS); do \ + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELDISTDIR)/$(item)-*.whl) + for dir in $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS); do \ $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel .wheelconstraints - rm -f $(foreach item,$(IPACLIENT_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) $(PYTHON) -m pip wheel \ --disable-pip-version-check \ --constraint .wheelconstraints \ --find-links $(WHEELDISTDIR) \ --find-links $(WHEELBUNDLEDIR) \ --wheel-dir $(WHEELBUNDLEDIR) \ - $(IPACLIENT_SUBDIRS) + $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS) wheel_placeholder: $(WHEELDISTDIR) for dir in
[Freeipa-devel] [freeipa PR#618][synchronized] [WIP] Tox testing support for client wheel packages
URL: https://github.com/freeipa/freeipa/pull/618 Author: tiran Title: #618: [WIP] Tox testing support for client wheel packages Action: synchronized To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/618/head:pr618 git checkout pr618 From 69d19bb585b80aa45683676ef2cba34c511e302e Mon Sep 17 00:00:00 2001 From: Christian HeimesDate: Thu, 17 Nov 2016 16:43:17 +0100 Subject: [PATCH 1/3] tox testing support for client wheel packages Signed-off-by: Christian Heimes --- .gitignore | 2 ++ .tox-install.sh | 72 Makefile.am | 14 +++--- configure.ac | 1 + ipatests/conftest.py | 1 - tox.ini | 38 +++ 6 files changed, 123 insertions(+), 5 deletions(-) create mode 100755 .tox-install.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 90d7d23..8f4c2aa 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ freeipa2-dev-doc # Root directory /freeipa.spec /dist/ +/.tox/ +/.cache/ /*/dist/ /RELEASE /rpmbuild/ diff --git a/.tox-install.sh b/.tox-install.sh new file mode 100755 index 000..ab4a4c5 --- /dev/null +++ b/.tox-install.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -x + +PYTHON="$1" +ENVSITEPACKAGESDIR="$2" +# 3...end are package requirements +shift 2 + +TOXINIDIR="$(cd "$(dirname "$0")" && pwd)" + +# sanity checks +if [ ! -x "${PYTHON}" ]; then +echo "${PYTHON}: no such executable" +exit 1 +fi + +if [ ! -d "${ENVSITEPACKAGESDIR}" ]; then +echo "${ENVSITEPACKAGESDIR}: no such directory" +exit 2 +fi + +if [ ! -f "${TOXINIDIR}/tox.ini" ]; then +echo "${TOXINIDIR}: no such directory" +exit 3 +fi + +# https://pip.pypa.io/en/stable/user_guide/#environment-variables +export PIP_CACHE_DIR="${TOXINIDIR}/.tox/cache" +mkdir -p "${PIP_CACHE_DIR}" + +DISTBUNDLE="${TOXINIDIR}/dist/bundle" +mkdir -p "${DISTBUNDLE}" + +# create configure +pushd "${TOXINIDIR}" +if [ ! -f "configure" ]; then +autoreconf -i -f +fi +# (re)create Makefile +./configure --disable-server +popd + +# copy pylint plugin +cp "${TOXINIDIR}/pylint_plugins.py" "${ENVSITEPACKAGESDIR}" + +# build packages and bundles +make -C "${TOXINIDIR}" \ +PYTHON="${PYTHON}" \ +IPA_EXTRA_SUBDIRS="ipatests" \ +wheel_bundle + +# chdir to prevent local .egg-info from messing up pip +pushd "${ENVSITEPACKAGESDIR}" + +# build additional wheels, e.g. pylint +$PYTHON -m pip wheel \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +--wheel-dir "${DISTBUNDLE}" \ +$@ + +# Install packages with dist/bundle/ as extra source for wheels while ignoring +# upstream Python Package Index. +$PYTHON -m pip install \ +--no-index \ +--disable-pip-version-check \ +--constraint "${TOXINIDIR}/.wheelconstraints" \ +--find-links "${DISTBUNDLE}" \ +$@ + +popd diff --git a/Makefile.am b/Makefile.am index af22315..ba81c55 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,6 +57,7 @@ EXTRA_DIST = .mailmap \ clean-local: rm -rf "$(RPMBUILD)" rm -rf "$(top_builddir)/dist" + rm -rf "$(top_builddir)/.tox" rm -rf "$(top_srcdir)/__pycache__" rm -f "$(top_builddir)"/$(PACKAGE)-*.tar.gz @@ -183,6 +184,7 @@ pylint: $(top_builddir)/ipapython/version.py ipasetup.py -path './freeipa-*' -prune -o \ -path './dist' -prune -o \ -path './pypi' -prune -o \ + -path './.tox' -prune -o \ -name '.*' -o \ -name '*.in' -o \ -name '*~' -o \ @@ -223,7 +225,10 @@ jslint-html: jsl -nologo -nosummary -nofilelisting -conf jsl.conf endif # WITH_JSLINT -.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages +# Python wheels +# IPA_EXTRA_SUBDIRS: extra subdirs to build wheels (e.g. ipatests) + +.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages WHEELDISTDIR = $(top_builddir)/dist/wheels WHEELBUNDLEDIR = $(top_builddir)/dist/bundle @@ -234,19 +239,20 @@ $(WHEELBUNDLEDIR): mkdir -p $(WHEELBUNDLEDIR) bdist_wheel: $(WHEELDISTDIR) - for dir in $(IPACLIENT_SUBDIRS); do \ + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELDISTDIR)/$(item)-*.whl) + for dir in $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS); do \ $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel .wheelconstraints - rm -f $(foreach item,$(IPACLIENT_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) + rm -f $(foreach item,$(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) $(PYTHON) -m pip wheel \ --disable-pip-version-check \ --constraint .wheelconstraints \ --find-links $(WHEELDISTDIR) \ --find-links $(WHEELBUNDLEDIR) \ --wheel-dir $(WHEELBUNDLEDIR) \ - $(IPACLIENT_SUBDIRS) + $(IPACLIENT_SUBDIRS) $(IPA_EXTRA_SUBDIRS) wheel_placeholder: $(WHEELDISTDIR) for dir in
[Freeipa-devel] [freeipa PR#618][synchronized] [WIP] Tox testing support for client wheel packages
URL: https://github.com/freeipa/freeipa/pull/618 Author: tiran Title: #618: [WIP] Tox testing support for client wheel packages Action: synchronized To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/618/head:pr618 git checkout pr618 From 8d976a4c9f7f4ddf46e03ba9e7d99aa705e23ae6 Mon Sep 17 00:00:00 2001 From: Christian HeimesDate: Fri, 17 Mar 2017 10:35:48 +0100 Subject: [PATCH 1/4] Constrain wheel package versions The presence of IPA packages on PyPI revealed an interesting issue with make wheel_bundle. pip gives final releases a higher precedence than our development packages. make wheel_bundle downloads ipa 4.5.0 from PyPI instead of using our own wheels. Use a constraint file to enforce correct versions. https://pagure.io/freeipa/issue/6468 Signed-off-by: Christian Heimes --- .gitignore | 1 + .wheelconstraints.in | 11 +++ Makefile.am | 19 --- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .wheelconstraints.in diff --git a/.gitignore b/.gitignore index 7e78a93..90d7d23 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ freeipa2-dev-doc /rpmbuild/ # Build /ipasetup.py +/.wheelconstraints *.egg-info # Subdirectories diff --git a/.wheelconstraints.in b/.wheelconstraints.in new file mode 100644 index 000..eba4ec9 --- /dev/null +++ b/.wheelconstraints.in @@ -0,0 +1,11 @@ +# placeholder +freeipa == @VERSION@ +ipa == @VERSION@ +# actual packages +ipaclient == @VERSION@ +ipalib == @VERSION@ +ipaplatform == @VERSION@ +ipapython == @VERSION@ +ipaserver == @VERSION@ +ipatests == @VERSION@ + diff --git a/Makefile.am b/Makefile.am index df4e05a..af22315 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,11 @@ ipasetup.py: ipasetup.py.in $(CONFIG_STATUS) -e 's|@VERSION[@]|$(VERSION)|g' \ $< > $@ +.wheelconstraints: .wheelconstraints.in $(CONFIG_STATUS) + $(AM_V_GEN)sed \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + $< > $@ + EXTRA_DIST = .mailmap \ ACI.txt \ API.txt \ @@ -46,7 +51,8 @@ EXTRA_DIST = .mailmap \ doc \ freeipa.spec.in \ ipasetup.py.in \ - pylintrc + pylintrc \ + .wheelconstraints.in clean-local: rm -rf "$(RPMBUILD)" @@ -232,8 +238,15 @@ bdist_wheel: $(WHEELDISTDIR) $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done -wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel - $(PYTHON) -m pip wheel --wheel-dir $(WHEELBUNDLEDIR) $(WHEELDISTDIR)/*.whl +wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel .wheelconstraints + rm -f $(foreach item,$(IPACLIENT_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) + $(PYTHON) -m pip wheel \ + --disable-pip-version-check \ + --constraint .wheelconstraints \ + --find-links $(WHEELDISTDIR) \ + --find-links $(WHEELBUNDLEDIR) \ + --wheel-dir $(WHEELBUNDLEDIR) \ + $(IPACLIENT_SUBDIRS) wheel_placeholder: $(WHEELDISTDIR) for dir in $(IPA_PLACEHOLDERS); do \ From 9212c59eeb4255f897763a831d35f6d7518cb0de Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 17 Nov 2016 16:43:17 +0100 Subject: [PATCH 2/4] tox testing support for client wheel packages Signed-off-by: Christian Heimes --- .gitignore | 2 ++ .tox-install.sh | 72 Makefile.am | 14 +++--- configure.ac | 1 + ipatests/conftest.py | 1 - tox.ini | 38 +++ 6 files changed, 123 insertions(+), 5 deletions(-) create mode 100755 .tox-install.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 90d7d23..8f4c2aa 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ freeipa2-dev-doc # Root directory /freeipa.spec /dist/ +/.tox/ +/.cache/ /*/dist/ /RELEASE /rpmbuild/ diff --git a/.tox-install.sh b/.tox-install.sh new file mode 100755 index 000..ab4a4c5 --- /dev/null +++ b/.tox-install.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -x + +PYTHON="$1" +ENVSITEPACKAGESDIR="$2" +# 3...end are package requirements +shift 2 + +TOXINIDIR="$(cd "$(dirname "$0")" && pwd)" + +# sanity checks +if [ ! -x "${PYTHON}" ]; then +echo "${PYTHON}: no such executable" +exit 1 +fi + +if [ ! -d "${ENVSITEPACKAGESDIR}" ]; then +echo "${ENVSITEPACKAGESDIR}: no such directory" +exit 2 +fi + +if [ ! -f "${TOXINIDIR}/tox.ini" ]; then +echo "${TOXINIDIR}: no such directory" +exit 3 +fi + +# https://pip.pypa.io/en/stable/user_guide/#environment-variables +export PIP_CACHE_DIR="${TOXINIDIR}/.tox/cache" +mkdir -p "${PIP_CACHE_DIR}" + +DISTBUNDLE="${TOXINIDIR}/dist/bundle" +mkdir -p "${DISTBUNDLE}" + +# create configure +pushd "${TOXINIDIR}" +if [ ! -f "configure" ]; then +autoreconf -i -f +fi +# (re)create Makefile +./configure --disable-server +popd + +# copy pylint plugin +cp "${TOXINIDIR}/pylint_plugins.py" "${ENVSITEPACKAGESDIR}" +
[Freeipa-devel] [freeipa PR#618][synchronized] [WIP] Tox testing support for client wheel packages
URL: https://github.com/freeipa/freeipa/pull/618 Author: tiran Title: #618: [WIP] Tox testing support for client wheel packages Action: synchronized To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/618/head:pr618 git checkout pr618 From 8d976a4c9f7f4ddf46e03ba9e7d99aa705e23ae6 Mon Sep 17 00:00:00 2001 From: Christian HeimesDate: Fri, 17 Mar 2017 10:35:48 +0100 Subject: [PATCH 1/3] Constrain wheel package versions The presence of IPA packages on PyPI revealed an interesting issue with make wheel_bundle. pip gives final releases a higher precedence than our development packages. make wheel_bundle downloads ipa 4.5.0 from PyPI instead of using our own wheels. Use a constraint file to enforce correct versions. https://pagure.io/freeipa/issue/6468 Signed-off-by: Christian Heimes --- .gitignore | 1 + .wheelconstraints.in | 11 +++ Makefile.am | 19 --- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .wheelconstraints.in diff --git a/.gitignore b/.gitignore index 7e78a93..90d7d23 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ freeipa2-dev-doc /rpmbuild/ # Build /ipasetup.py +/.wheelconstraints *.egg-info # Subdirectories diff --git a/.wheelconstraints.in b/.wheelconstraints.in new file mode 100644 index 000..eba4ec9 --- /dev/null +++ b/.wheelconstraints.in @@ -0,0 +1,11 @@ +# placeholder +freeipa == @VERSION@ +ipa == @VERSION@ +# actual packages +ipaclient == @VERSION@ +ipalib == @VERSION@ +ipaplatform == @VERSION@ +ipapython == @VERSION@ +ipaserver == @VERSION@ +ipatests == @VERSION@ + diff --git a/Makefile.am b/Makefile.am index df4e05a..af22315 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,11 @@ ipasetup.py: ipasetup.py.in $(CONFIG_STATUS) -e 's|@VERSION[@]|$(VERSION)|g' \ $< > $@ +.wheelconstraints: .wheelconstraints.in $(CONFIG_STATUS) + $(AM_V_GEN)sed \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + $< > $@ + EXTRA_DIST = .mailmap \ ACI.txt \ API.txt \ @@ -46,7 +51,8 @@ EXTRA_DIST = .mailmap \ doc \ freeipa.spec.in \ ipasetup.py.in \ - pylintrc + pylintrc \ + .wheelconstraints.in clean-local: rm -rf "$(RPMBUILD)" @@ -232,8 +238,15 @@ bdist_wheel: $(WHEELDISTDIR) $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done -wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel - $(PYTHON) -m pip wheel --wheel-dir $(WHEELBUNDLEDIR) $(WHEELDISTDIR)/*.whl +wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel .wheelconstraints + rm -f $(foreach item,$(IPACLIENT_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) + $(PYTHON) -m pip wheel \ + --disable-pip-version-check \ + --constraint .wheelconstraints \ + --find-links $(WHEELDISTDIR) \ + --find-links $(WHEELBUNDLEDIR) \ + --wheel-dir $(WHEELBUNDLEDIR) \ + $(IPACLIENT_SUBDIRS) wheel_placeholder: $(WHEELDISTDIR) for dir in $(IPA_PLACEHOLDERS); do \ From 9212c59eeb4255f897763a831d35f6d7518cb0de Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 17 Nov 2016 16:43:17 +0100 Subject: [PATCH 2/3] tox testing support for client wheel packages Signed-off-by: Christian Heimes --- .gitignore | 2 ++ .tox-install.sh | 72 Makefile.am | 14 +++--- configure.ac | 1 + ipatests/conftest.py | 1 - tox.ini | 38 +++ 6 files changed, 123 insertions(+), 5 deletions(-) create mode 100755 .tox-install.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 90d7d23..8f4c2aa 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ freeipa2-dev-doc # Root directory /freeipa.spec /dist/ +/.tox/ +/.cache/ /*/dist/ /RELEASE /rpmbuild/ diff --git a/.tox-install.sh b/.tox-install.sh new file mode 100755 index 000..ab4a4c5 --- /dev/null +++ b/.tox-install.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -x + +PYTHON="$1" +ENVSITEPACKAGESDIR="$2" +# 3...end are package requirements +shift 2 + +TOXINIDIR="$(cd "$(dirname "$0")" && pwd)" + +# sanity checks +if [ ! -x "${PYTHON}" ]; then +echo "${PYTHON}: no such executable" +exit 1 +fi + +if [ ! -d "${ENVSITEPACKAGESDIR}" ]; then +echo "${ENVSITEPACKAGESDIR}: no such directory" +exit 2 +fi + +if [ ! -f "${TOXINIDIR}/tox.ini" ]; then +echo "${TOXINIDIR}: no such directory" +exit 3 +fi + +# https://pip.pypa.io/en/stable/user_guide/#environment-variables +export PIP_CACHE_DIR="${TOXINIDIR}/.tox/cache" +mkdir -p "${PIP_CACHE_DIR}" + +DISTBUNDLE="${TOXINIDIR}/dist/bundle" +mkdir -p "${DISTBUNDLE}" + +# create configure +pushd "${TOXINIDIR}" +if [ ! -f "configure" ]; then +autoreconf -i -f +fi +# (re)create Makefile +./configure --disable-server +popd + +# copy pylint plugin +cp "${TOXINIDIR}/pylint_plugins.py" "${ENVSITEPACKAGESDIR}" +