- Fix Python byte compilation for Python3 only packages

- Fixes #1411588
This commit is contained in:
Florian Festi 2017-02-14 14:23:54 +01:00
parent 056ac06464
commit e38c401574
2 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,49 @@
From a8e51b3bb05c6acb1d9b2e3d34f859ddda1677be Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Tue, 14 Feb 2017 14:04:35 +0100
Subject: [PATCH] brp-python-bytecompile: Process python lib dirs even without
standard Python
There is no need for /usr/bin/python when byte compiling files in
/usr/lib/pythonX.Y (only /usr/bin/pythonX.Y). Moved check so we do not exit
prematurely.
Fixes: rhbz#1411588
---
scripts/brp-python-bytecompile | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile
index 838f23d..894fa34 100644
--- a/scripts/brp-python-bytecompile
+++ b/scripts/brp-python-bytecompile
@@ -6,12 +6,6 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
-# If we don't have a python interpreter, avoid changing anything.
-default_python=${1:-/usr/bin/python}
-if [ ! -x "$default_python" ]; then
- exit 0
-fi
-
# Figure out how deep we need to descend. We could pick an insanely high
# number and hope it's enough, but somewhere, somebody's sure to run into it.
depth=`(find "$RPM_BUILD_ROOT" -type f -name "*.py" -print0 ; echo /) | \
@@ -86,7 +80,12 @@ done
# Handle other locations in the filesystem using the default python
-# implementation:
+# implementation - if we have a default python interpreter
+
+default_python=${1:-/usr/bin/python}
+if [ ! -x "$default_python" ]; then
+ exit 0
+fi
# Generate normal (.pyc) byte-compiled files.
python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"
--
2.5.5

View File

@ -29,7 +29,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}11%{?dist}.1
Release: %{?snapver:0.%{snapver}.}12%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
@ -63,9 +63,11 @@ Patch136: rpm-4.13.x-pythondistdeps.py-skip-distribution-metadata-if-ther.patch
Patch137: rpm-4.13.x-pythondistdeps.py-show-warning-if-version-is-not-fou.patch
Patch138: rpm-4.13.x-pythondistdeps.py-skip-.egg-link-files.patch
Patch139: rpm-4.13.x-pythondistdeps.py-add-forgotten-import.patch
Patch140: rpm-4.13.x-brp-python-bytecompile-Python3-only.patch
# Fedora-specific (python3) patch (RHBZ #1405483)
Patch140: rpm-4.13.x-pythondistdeps-python3.patch
Patch200: rpm-4.13.x-pythondistdeps-python3.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@ -567,6 +569,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Tue Feb 14 2017 Florian Festi <ffesti@rpm.org> - 4.13.0-12
- Fix Python byte compilation for Python3 only packages (#1411588)
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-11.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild