Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
SUSE:SLE-12-SP4:GA
rpmlint
0001-Fix-resolving-Python-source-from-3.5-.opt-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fix-resolving-Python-source-from-3.5-.opt-12.pyc.patch of Package rpmlint
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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor