From nobody Tue Apr 30 12:01:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 151862724833365.79435068842497; Wed, 14 Feb 2018 08:54:08 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 844F25B303; Wed, 14 Feb 2018 16:54:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18A8160BE5; Wed, 14 Feb 2018 16:54:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2AF1D4A46C; Wed, 14 Feb 2018 16:54:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1EGs2iQ011188 for ; Wed, 14 Feb 2018 11:54:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2072A21411B7; Wed, 14 Feb 2018 16:54:02 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-204-233.brq.redhat.com [10.40.204.233]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 626A721411B6 for ; Wed, 14 Feb 2018 16:54:01 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 14 Feb 2018 17:53:57 +0100 Message-Id: <20180214165357.6952-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH] jobs: Set $PYTHONPATH for python-distutils jobs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Feb 2018 16:54:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since we install Python modules under $VIRT_PREFIX, we need to set $PYTHONPATH or the interpreter won't be able to locate them. This is currently being done per-worker in the Jenkins Web interface. However, now that we've introduced Python 3 builds, depending on the project and the OS, we might be using any of Python 2.7, 3.4, 3.5 and 3.6, which means we can't have a single $PYTHONPATH anymore: in particular, while it's okay to have non-esisting directories in $PYTHONPATH, we have to make sure that a Python 3 interpreter will never try to use a Python 2 module and vice versa. To solve the issue, we use a fairly large hammer: we set $PYTHONPATH at the job level, and include all reasonable minor versions for the Python major version (pyver) the job is using, even if they don't yet exist. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- Another approach would be to use something like T=3D$VIRT_PREFIX/lib/python{pyver}.4/site-packages T=3D$T:$VIRT_PREFIX/lib64/python{pyver}.4/site-packages T=3D$T:$VIRT_PREFIX/lib/python{pyver}.5/site-packages T=3D$T:$VIRT_PREFIX/lib64/python{pyver}.5/site-packages T=3D$T:$VIRT_PREFIX/lib/python{pyver}.6/site-packages T=3D$T:$VIRT_PREFIX/lib64/python{pyver}.6/site-packages T=3D$T:$VIRT_PREFIX/lib/python{pyver}.7/site-packages T=3D$T:$VIRT_PREFIX/lib64/python{pyver}.7/site-packages export PYTHONPATH=3D$T but that's just a different kind of ugly :/ jobs/python-distutils.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jobs/python-distutils.yaml b/jobs/python-distutils.yaml index ff68c29..510769e 100644 --- a/jobs/python-distutils.yaml +++ b/jobs/python-distutils.yaml @@ -42,6 +42,7 @@ - shell: | {global_env} {local_env} + export PYTHONPATH=3D$VIRT_PREFIX/lib/python{pyver}.4/site-packag= es:$VIRT_PREFIX/lib64/python{pyver}.4/site-packages:$VIRT_PREFIX/lib/python= {pyver}.5/site-packages:$VIRT_PREFIX/lib64/python{pyver}.5/site-packages:$V= IRT_PREFIX/lib/python{pyver}.6/site-packages:$VIRT_PREFIX/lib64/python{pyve= r}.6/site-packages:$VIRT_PREFIX/lib/python{pyver}.7/site-packages:$VIRT_PRE= FIX/lib64/python{pyver}.7/site-packages {command_pre_build} python{pyver} ./setup.py build python{pyver} ./setup.py install --prefix=3D$VIRT_PREFIX @@ -83,6 +84,7 @@ - shell: | {global_env} {local_env} + export PYTHONPATH=3D$VIRT_PREFIX/lib/python{pyver}.4/site-packag= es:$VIRT_PREFIX/lib64/python{pyver}.4/site-packages:$VIRT_PREFIX/lib/python= {pyver}.5/site-packages:$VIRT_PREFIX/lib64/python{pyver}.5/site-packages:$V= IRT_PREFIX/lib/python{pyver}.6/site-packages:$VIRT_PREFIX/lib64/python{pyve= r}.6/site-packages:$VIRT_PREFIX/lib/python{pyver}.7/site-packages:$VIRT_PRE= FIX/lib64/python{pyver}.7/site-packages python{pyver} ./setup.py test publishers: - email: @@ -121,6 +123,7 @@ - shell: | {global_env} {local_env} + export PYTHONPATH=3D$VIRT_PREFIX/lib/python{pyver}.4/site-packag= es:$VIRT_PREFIX/lib64/python{pyver}.4/site-packages:$VIRT_PREFIX/lib/python= {pyver}.5/site-packages:$VIRT_PREFIX/lib64/python{pyver}.5/site-packages:$V= IRT_PREFIX/lib/python{pyver}.6/site-packages:$VIRT_PREFIX/lib64/python{pyve= r}.6/site-packages:$VIRT_PREFIX/lib/python{pyver}.7/site-packages:$VIRT_PRE= FIX/lib64/python{pyver}.7/site-packages sed -i -e 's/BuildRequires: libvirt.*devel.*//' *.spec.in python{pyver} ./setup.py rpm publishers: --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list