diff -up rpmlint-rpmlint-1.8/FilesCheck.py.py35 rpmlint-rpmlint-1.8/FilesCheck.py --- rpmlint-rpmlint-1.8/FilesCheck.py.py35 2015-11-30 14:04:42.008425141 -0500 +++ rpmlint-rpmlint-1.8/FilesCheck.py 2015-11-30 14:06:31.960635048 -0500 @@ -210,7 +210,7 @@ kernel_package_regex = re.compile('^kern 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 -up rpmlint-rpmlint-1.8/test/test_files.py.py35 rpmlint-rpmlint-1.8/test/test_files.py --- rpmlint-rpmlint-1.8/test/test_files.py.py35 2015-11-30 14:07:38.248158721 -0500 +++ rpmlint-rpmlint-1.8/test/test_files.py 2015-11-30 14:07:32.263201728 -0500 @@ -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