From 580e34acc30264c4412a8f27ce0ab181cabf3de9 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 17 Jul 2024 08:49:20 +0200 Subject: [PATCH] always install into a virtualenv system-packages is required for RHSM --- Makefile | 2 +- images/Dockerfile.debian11 | 2 +- images/Dockerfile.el7 | 2 +- images/Dockerfile.suseLeap42 | 2 +- test/test_runner.sh | 6 +++++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 780e7e182..8b4ec18a3 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ install: cd src/ && $(PYTHON) setup.py install test-install: - $(PIP) install -r test-requirements.txt --user + $(PIP) install -r test-requirements.txt test: test-install $(PYTHON) test/unittest_suite.py diff --git a/images/Dockerfile.debian11 b/images/Dockerfile.debian11 index 1b1392952..f4d885872 100644 --- a/images/Dockerfile.debian11 +++ b/images/Dockerfile.debian11 @@ -1,6 +1,6 @@ FROM debian:11 -RUN apt-get update && apt-get install --yes --no-install-recommends curl make python3 python3-pip python3-setuptools && apt-get clean +RUN apt-get update && apt-get install --yes --no-install-recommends curl make python3 python3-pip python3-setuptools python3-venv && apt-get clean RUN curl -o /etc/apt/trusted.gpg.d/atix.asc https://oss.atix.de/atix_gpg.pub RUN echo 'deb https://oss.atix.de/Debian11/ stable main' >> /etc/apt/sources.list RUN apt-get update && apt-get install --yes --no-install-recommends python3-subscription-manager && apt-get clean diff --git a/images/Dockerfile.el7 b/images/Dockerfile.el7 index 3ea21e1d4..cc1a8a16f 100644 --- a/images/Dockerfile.el7 +++ b/images/Dockerfile.el7 @@ -2,5 +2,5 @@ FROM quay.io/centos/centos:7 RUN sed -i -e 's/^mirrorlist/#mirrorlist/g; /^#baseurl/ s/^#//; /baseurl/ s/mirror/vault/g' /etc/yum.repos.d/CentOS-Base.repo RUN yum install -y epel-release https://yum.theforeman.org/client/nightly/el7/x86_64/foreman-client-release.rpm && yum clean all -RUN yum install make python-setuptools python-tracer subscription-manager python-pip python2-mock -y && yum clean all +RUN yum install make python-setuptools python-tracer subscription-manager python-pip python-virtualenv python2-mock -y && yum clean all WORKDIR /app diff --git a/images/Dockerfile.suseLeap42 b/images/Dockerfile.suseLeap42 index 517d75b45..6ab7f8d2f 100644 --- a/images/Dockerfile.suseLeap42 +++ b/images/Dockerfile.suseLeap42 @@ -3,6 +3,6 @@ FROM opensuse/leap:42 RUN zypper addrepo -c --no-gpgcheck https://oss.atix.de/SLES12SP5/ subscription-manager RUN zypper removerepo 'OSS Update' RUN zypper clean --all -RUN zypper install -y make python-pip subscription-manager zypp-plugin-python which python-setuptools lsof +RUN zypper install -y make python-pip subscription-manager zypp-plugin-python which python-setuptools python-virtualenv lsof WORKDIR /app diff --git a/test/test_runner.sh b/test/test_runner.sh index 8c20751d0..4d05e7afc 100755 --- a/test/test_runner.sh +++ b/test/test_runner.sh @@ -4,11 +4,15 @@ set -e if command -v python3; then export PYTHON=python3 - mkdir -p /usr/local/lib/python3.6/site-packages + VENV="${PYTHON} -m venv" else export PYTHON=python2 + VENV="virtualenv" fi; +${VENV} --system-site-packages ./venv +. ./venv/bin/activate + make install make test