From c5ad993648ed078619ddc1dc4c8cdce966cfd115ee2bea548e107823f47012b5 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 6 Jun 2016 11:07:16 +0000 Subject: [PATCH] Accepting request 398392 from home:alarrosa:branches:devel:openSUSE:Factory:rpmlint - 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) OBS-URL: https://build.opensuse.org/request/show/398392 OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=391 --- ...g-Python-source-from-3.5-.opt-12.pyc.patch | 50 +++++++++++++++++++ rpmlint.changes | 8 +++ rpmlint.spec | 2 + 3 files changed, 60 insertions(+) create mode 100644 0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch diff --git a/0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch b/0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch new file mode 100644 index 0000000..034fb69 --- /dev/null +++ b/0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch @@ -0,0 +1,50 @@ +From 3b0286ba7f2192807b6d1eadf1fe7c46cc364854 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +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 diff --git a/rpmlint.changes b/rpmlint.changes index 40c9818..6fa2913 100644 --- a/rpmlint.changes +++ b/rpmlint.changes @@ -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 diff --git a/rpmlint.spec b/rpmlint.spec index 6420bd7..9ca4bce 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -114,6 +114,8 @@ Patch61: postin-speedup.diff Patch62: binaryinfo-speedup.diff Patch63: 0001-Avoid-messing-with-the-error-encoding-Fixes-61.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 # BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766 BuildArch: noarch