SHA256
1
0
forked from pool/rpmlint

Accepting request 400225 from devel:openSUSE:Factory:rpmlint

1

OBS-URL: https://build.opensuse.org/request/show/400225
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=251
This commit is contained in:
Dominique Leuenberger 2016-06-12 16:52:49 +00:00 committed by Git OBS Bridge
commit 7fe9a5f272
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,50 @@
From 3b0286ba7f2192807b6d1eadf1fe7c46cc364854 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sun, 29 Nov 2015 22:13:14 +0200
Subject: [PATCH] Fix resolving Python source from 3.5 *.opt-[12].pyc
https://bugzilla.redhat.com/show_bug.cgi?id=1286382
---
FilesCheck.py | 2 +-
test/test_files.py | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 test/test_files.py
diff --git a/FilesCheck.py b/FilesCheck.py
index 977b47f..76b8f89 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -211,7 +211,7 @@
normal_zero_length_regex = re.compile('^/etc/security/console\.apps/|/\.nosearch$|/__init__\.py$')
perl_regex = re.compile('^/usr/lib/perl5/(?:vendor_perl/)?([0-9]+\.[0-9]+)\.([0-9]+)/')
python_regex = re.compile('^/usr/lib(?:64)?/python([.0-9]+)/')
-python_bytecode_regex_pep3147 = re.compile('^(.*)/__pycache__/(.*)\.(.*)(\.py[oc])$')
+python_bytecode_regex_pep3147 = re.compile('^(.*)/__pycache__/(.*?)\.([^.]+)(\.opt-[12])?\.py[oc]$')
python_bytecode_regex = re.compile('^(.*)(\.py[oc])$')
python_default_version = Config.getOption('PythonDefaultVersion', None)
perl_version_trick = Config.getOption('PerlVersionTrick', True)
diff --git a/test/test_files.py b/test/test_files.py
new file mode 100644
index 0000000..84359d2
--- /dev/null
+++ b/test/test_files.py
@@ -0,0 +1,19 @@
+from FilesCheck import python_bytecode_to_script as pbts
+
+
+class TestPythonBytecodeToScript(object):
+
+ def test_pep3147(self):
+ assert pbts("/usr/lib64/python3.4/__pycache__/__phello__.foo.cpython-34.pyc") == "/usr/lib64/python3.4/__phello__.foo.py"
+ assert pbts("/usr/lib64/python3.4/__pycache__/__phello__.foo.cpython-34.pyo") == "/usr/lib64/python3.4/__phello__.foo.py"
+
+ def test_py2(self):
+ assert pbts("/usr/lib/python2.7/site-packages/_pytest/main.pyc") == "/usr/lib/python2.7/site-packages/_pytest/main.py"
+ assert pbts("/usr/lib/python2.7/site-packages/_pytest/main.pyo") == "/usr/lib/python2.7/site-packages/_pytest/main.py"
+
+ def test_pep0488(self):
+ assert pbts("/usr/lib/python3.5/site-packages/__pycache__/pytest.cpython-35.opt-1.pyc") == "/usr/lib/python3.5/site-packages/pytest.py"
+ assert pbts("/usr/lib/python3.5/site-packages/__pycache__/pytest.cpython-35.opt-2.pyc") == "/usr/lib/python3.5/site-packages/pytest.py"
+ assert pbts("/usr/lib/python3.5/site-packages/__pycache__/pytest.cpython-35.pyc") == "/usr/lib/python3.5/site-packages/pytest.py"
+
+# ex: ts=4 sw=4 et

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri May 27 15:27:28 UTC 2016 - alarrosa@suse.com
- add 0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch:
Fixes FilesCheck to resolve correctly the python source file
from pyc files following PEP0488 (like *.{tag}.opt-[12].pyc).
(bsc#982076)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu May 19 19:49:25 UTC 2016 - dmueller@suse.com Thu May 19 19:49:25 UTC 2016 - dmueller@suse.com

View File

@ -114,6 +114,8 @@ Patch61: postin-speedup.diff
Patch62: binaryinfo-speedup.diff Patch62: binaryinfo-speedup.diff
Patch63: 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch Patch63: 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch
Patch64: omit_BUILDROOT_from_pyo_files.patch Patch64: omit_BUILDROOT_from_pyo_files.patch
# PATCH-FIX-UPSTREAM 0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch alarrosa@suse.com -- Fixes resolving python source from files generated following PEP0488
Patch65: 0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch
# PATCHLIST END # PATCHLIST END
# BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766 # BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766
BuildArch: noarch BuildArch: noarch