commit
3192919355
|
@ -1,6 +1,6 @@
|
|||
import subprocess
|
||||
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
class ArParser:
|
||||
|
@ -16,7 +16,7 @@ class ArParser:
|
|||
|
||||
def parse(self):
|
||||
r = subprocess.run(['ar', 't', self.pkgfile_path], encoding='utf8',
|
||||
capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
return
|
||||
|
|
|
@ -2,7 +2,7 @@ import subprocess
|
|||
from xml.etree import ElementTree
|
||||
|
||||
from rpmlint.checks.AbstractCheck import AbstractFilesCheck
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
class AppDataCheck(AbstractFilesCheck):
|
||||
|
@ -23,7 +23,7 @@ class AppDataCheck(AbstractFilesCheck):
|
|||
|
||||
validation_failed = False
|
||||
try:
|
||||
r = subprocess.run(cmd.split(), env=ENGLISH_ENVIROMENT,
|
||||
r = subprocess.run(cmd.split(), env=ENGLISH_ENVIRONMENT,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
if r.returncode != 0:
|
||||
validation_failed = True
|
||||
|
|
|
@ -2,7 +2,7 @@ import stat
|
|||
import subprocess
|
||||
|
||||
from rpmlint.checks.AbstractCheck import AbstractFilesCheck
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
class BashismsCheck(AbstractFilesCheck):
|
||||
|
@ -52,7 +52,7 @@ class BashismsCheck(AbstractFilesCheck):
|
|||
try:
|
||||
r = subprocess.run(['dash', '-n', filepath],
|
||||
stderr=subprocess.DEVNULL,
|
||||
env=ENGLISH_ENVIROMENT)
|
||||
env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode == 2:
|
||||
yield 'bin-sh-syntax-error'
|
||||
elif r.returncode == 127:
|
||||
|
@ -67,7 +67,7 @@ class BashismsCheck(AbstractFilesCheck):
|
|||
cmd.append('-e')
|
||||
r = subprocess.run(cmd,
|
||||
stderr=subprocess.DEVNULL,
|
||||
env=ENGLISH_ENVIROMENT)
|
||||
env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode == 1:
|
||||
yield 'potential-bashisms'
|
||||
elif r.returncode == 2:
|
||||
|
|
|
@ -12,7 +12,7 @@ import subprocess
|
|||
|
||||
import rpm
|
||||
from rpmlint.checks.AbstractCheck import AbstractCheck
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
menu_file_regex = re.compile(r'^/usr/lib/menu/([^/]+)$')
|
||||
|
@ -94,7 +94,7 @@ class MenuCheck(AbstractCheck):
|
|||
directory = pkg.dir_name()
|
||||
for f in menus:
|
||||
# remove comments and handle cpp continuation lines
|
||||
text = subprocess.run(('/lib/cpp', directory + f), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=ENGLISH_ENVIROMENT, text=True).stdout
|
||||
text = subprocess.run(('/lib/cpp', directory + f), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=ENGLISH_ENVIRONMENT, text=True).stdout
|
||||
if text.endswith('\n'):
|
||||
text = text[:-1]
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ from pathlib import Path
|
|||
import subprocess
|
||||
|
||||
from rpmlint.checks.AbstractCheck import AbstractFilesCheck
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
STANDARD_BIN_DIRS = ('/bin', '/sbin', '/usr/bin', '/usr/sbin')
|
||||
|
||||
|
@ -45,7 +45,7 @@ class MenuXDGCheck(AbstractFilesCheck):
|
|||
f = root + filename
|
||||
try:
|
||||
command = subprocess.run(('desktop-file-validate', f), stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
env=ENGLISH_ENVIROMENT, text=True)
|
||||
env=ENGLISH_ENVIRONMENT, text=True)
|
||||
text = command.stdout
|
||||
if command.returncode:
|
||||
error_printed = False
|
||||
|
|
|
@ -15,7 +15,7 @@ import tempfile
|
|||
import rpm
|
||||
from rpmlint import pkg as Pkg
|
||||
from rpmlint.checks.AbstractCheck import AbstractCheck
|
||||
from rpmlint.helpers import byte_to_string, ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import byte_to_string, ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
# shells that grok the -n switch for debugging
|
||||
|
@ -63,7 +63,7 @@ def check_syntax_script(prog, commandline, script):
|
|||
try:
|
||||
tmpfile.write(script)
|
||||
tmpfile.close()
|
||||
ret = subprocess.run((prog, commandline, tmpname), env=ENGLISH_ENVIROMENT)
|
||||
ret = subprocess.run((prog, commandline, tmpname), env=ENGLISH_ENVIRONMENT)
|
||||
finally:
|
||||
tmpfile.close()
|
||||
os.remove(tmpname)
|
||||
|
|
|
@ -6,7 +6,7 @@ from urllib.parse import urlparse
|
|||
import rpm
|
||||
from rpmlint import pkg as Pkg
|
||||
from rpmlint.checks.AbstractCheck import AbstractCheck
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT, readlines
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT, readlines
|
||||
|
||||
# Don't check for hardcoded library paths in biarch packages
|
||||
DEFAULT_BIARCH_PACKAGES = '^(gcc|glibc)'
|
||||
|
@ -304,7 +304,7 @@ class SpecCheck(AbstractCheck):
|
|||
try:
|
||||
outcmd = subprocess.run(
|
||||
('rpm', '-q', '--qf=', '-D', '_sourcedir %s' % self._spec_file_dir,
|
||||
'--specfile', self._spec_file), stderr=subprocess.PIPE, encoding='utf8', env=ENGLISH_ENVIROMENT)
|
||||
'--specfile', self._spec_file), stderr=subprocess.PIPE, encoding='utf8', env=ENGLISH_ENVIRONMENT)
|
||||
|
||||
for line in outcmd.stderr.splitlines():
|
||||
line = line.strip()
|
||||
|
|
|
@ -8,8 +8,7 @@ import sys
|
|||
from rpmlint.color import Color
|
||||
|
||||
|
||||
ENGLISH_ENVIROMENT = dict(os.environ, LC_ALL='en_US.UTF-8',
|
||||
LANGUAGE='en_US')
|
||||
ENGLISH_ENVIRONMENT = dict(os.environ, LC_ALL='en_US.UTF-8', LANGUAGE='en_US')
|
||||
|
||||
|
||||
def string_center(message, filler=' '):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import re
|
||||
import subprocess
|
||||
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
class LddParser:
|
||||
|
@ -50,7 +50,7 @@ class LddParser:
|
|||
|
||||
def parse_dependencies(self):
|
||||
r = subprocess.run(['ldd', '-u', self.pkgfile_path], encoding='utf8',
|
||||
capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode == 0:
|
||||
return
|
||||
|
||||
|
@ -68,7 +68,7 @@ class LddParser:
|
|||
|
||||
def parse_undefined_symbols(self):
|
||||
r = subprocess.run(['ldd', '-r', self.pkgfile_path], encoding='utf8',
|
||||
capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
# here ldd should always return 0
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
|
@ -85,7 +85,7 @@ class LddParser:
|
|||
# run c++filt demangler for all collected symbols
|
||||
if self.undefined_symbols:
|
||||
r = subprocess.run(['c++filt'] + self.undefined_symbols, encoding='utf8',
|
||||
capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
else:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import subprocess
|
||||
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
class ObjdumpParser:
|
||||
|
@ -32,7 +32,7 @@ class ObjdumpParser:
|
|||
|
||||
def parse_dwarf_compilation_units(self):
|
||||
r = subprocess.run(['objdump', '--dwarf=info', '--dwarf-depth=1', self.pkgfile_path], encoding='utf8',
|
||||
capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
# here ldd should always return 0
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
|
|
|
@ -23,7 +23,7 @@ try:
|
|||
except ImportError:
|
||||
has_magic = False
|
||||
import rpm
|
||||
from rpmlint.helpers import (byte_to_string, ENGLISH_ENVIROMENT,
|
||||
from rpmlint.helpers import (byte_to_string, ENGLISH_ENVIRONMENT,
|
||||
print_warning, pushd)
|
||||
from rpmlint.pkgfile import PkgFile
|
||||
import zstandard as zstd
|
||||
|
@ -578,18 +578,18 @@ class Pkg(AbstractPkg):
|
|||
stderr = None if verbose else subprocess.DEVNULL
|
||||
if shutil.which('rpm2archive'):
|
||||
with open(filename, 'rb') as rpm_data:
|
||||
subprocess.check_output('rpm2archive - | tar -xz && chmod -R +rX .', shell=True, env=ENGLISH_ENVIROMENT,
|
||||
subprocess.check_output('rpm2archive - | tar -xz && chmod -R +rX .', shell=True, env=ENGLISH_ENVIRONMENT,
|
||||
stderr=stderr, stdin=rpm_data)
|
||||
else:
|
||||
command_str = f'rpm2cpio {quote(str(filename))} | cpio -id ; chmod -R +rX .'
|
||||
subprocess.check_output(command_str, shell=True, env=ENGLISH_ENVIROMENT, stderr=stderr)
|
||||
subprocess.check_output(command_str, shell=True, env=ENGLISH_ENVIRONMENT, stderr=stderr)
|
||||
self.extracted = True
|
||||
return dirname
|
||||
|
||||
def check_signature(self):
|
||||
ret = subprocess.run(('rpm', '-Kv', self.filename),
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
env=ENGLISH_ENVIROMENT, text=True)
|
||||
env=ENGLISH_ENVIRONMENT, text=True)
|
||||
text = ret.stdout
|
||||
if text.endswith('\n'):
|
||||
text = text[:-1]
|
||||
|
|
|
@ -2,7 +2,7 @@ from itertools import dropwhile, takewhile
|
|||
import re
|
||||
import subprocess
|
||||
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
class ElfSection:
|
||||
|
@ -75,7 +75,7 @@ class ElfSectionInfo:
|
|||
|
||||
def parse(self):
|
||||
r = subprocess.run(['readelf', '-W', '-S', self.path] + self.extra_flags, encoding='utf8',
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
return
|
||||
|
@ -144,7 +144,7 @@ class ElfProgramHeaderInfo:
|
|||
|
||||
def parse(self):
|
||||
r = subprocess.run(['readelf', '-W', '-l', self.path] + self.extra_flags, encoding='utf8',
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
return
|
||||
|
@ -219,7 +219,7 @@ class ElfDynamicSectionInfo:
|
|||
|
||||
def parse(self):
|
||||
r = subprocess.run(['readelf', '-W', '-d', self.path] + self.extra_flags, encoding='utf8',
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
return
|
||||
|
@ -286,7 +286,7 @@ class ElfSymbolTableInfo:
|
|||
def parse(self):
|
||||
try:
|
||||
r = subprocess.run(['readelf', '-Ui', '-W', '-s', self.path] + self.extra_flags, encoding='utf8',
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
return
|
||||
|
@ -322,7 +322,7 @@ class ElfCommentInfo:
|
|||
|
||||
def parse(self):
|
||||
r = subprocess.run(['readelf', '-p', '.comment', self.path] + self.extra_flags, encoding='utf8',
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
errors='replace', capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
return
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import subprocess
|
||||
|
||||
from rpmlint.helpers import ENGLISH_ENVIROMENT
|
||||
from rpmlint.helpers import ENGLISH_ENVIRONMENT
|
||||
|
||||
|
||||
class StringsParser:
|
||||
|
@ -16,7 +16,7 @@ class StringsParser:
|
|||
|
||||
def parse(self):
|
||||
r = subprocess.run(['strings', self.pkgfile_path], encoding='utf8',
|
||||
capture_output=True, env=ENGLISH_ENVIROMENT)
|
||||
capture_output=True, env=ENGLISH_ENVIRONMENT)
|
||||
if r.returncode != 0:
|
||||
self.parsing_failed_reason = r.stderr
|
||||
return
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
# mock_packages.py
|
||||
from Testing import get_tested_mock_package
|
||||
|
||||
PythonSitePackage = get_tested_mock_package(
|
||||
files=[
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/doc',
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/docs',
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/doc',
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/docs',
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/doc',
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/docs',
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/doc',
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/docs',
|
||||
]
|
||||
)
|
||||
|
||||
PythonModuleMockPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
}
|
||||
)
|
||||
|
||||
PythonDistutilsMockPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python2.7/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
'/usr/lib/python3.10/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
'/usr/lib64/python2.7/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
'/usr/lib64/python3.10/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
}
|
||||
)
|
||||
|
||||
PythonFlitMockPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/flit-3.8.0.dist-info/METADATA': {
|
||||
'content-path': 'files/python-flit-metadata.txt',
|
||||
'create_dirs': True,
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-flit_core',
|
||||
'python-requests',
|
||||
'python-tomli-w',
|
||||
'python310-docutils',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
PythonJupyterServerFileidMockPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/jupyter_server_fileid-0.9.0.dist-info/METADATA': {
|
||||
'content-path': 'files/python-jupyter_server_fileid-metadata.txt',
|
||||
'create_dirs': True,
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-jupyter-events',
|
||||
'python-click',
|
||||
'python-jupyter-server',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
PythonJupyterEventsMockPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/jupyter_events-0.6.3.dist-info/METADATA': {
|
||||
'content-path': 'files/python-jupyter-events-metadata.txt',
|
||||
'create_dirs': True,
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-jsonschema',
|
||||
'python-python-json-logger',
|
||||
'python-pyyaml',
|
||||
'python-rfc3339-validator',
|
||||
'python-rfc3986-validator',
|
||||
'python-traitlets',
|
||||
'python-click',
|
||||
'python-rich',
|
||||
'python-jupyterlite-sphinx',
|
||||
'python-myst-parser',
|
||||
'python-pydata-sphinx-theme',
|
||||
'python-sphinxcontrib-spelling',
|
||||
'python-click',
|
||||
'python-coverage',
|
||||
'python-pre-commit',
|
||||
'python-pytest-asyncio',
|
||||
'python-pytest-console-scripts',
|
||||
'python-pytest-cov',
|
||||
'python-pytest',
|
||||
'python-rich',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
PythonScikitBuildMockPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/scikit_build-0.17.2.dist-info/METADATA': {
|
||||
'content-path': 'files/python-scikit_build-metadata.txt',
|
||||
'create_dirs': True,
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-distro',
|
||||
'python-packaging',
|
||||
'python-setuptools',
|
||||
'python-wheel',
|
||||
'python-tomli',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
PythonFlitUpdatedMockPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/flit-3.8.0.dist-info/METADATA': {
|
||||
'content-path': 'files/python-flit-metadata.txt',
|
||||
'create_dirs': True,
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python3.12dist(docutils)',
|
||||
'python3.12dist(flit-core) >= 3.8',
|
||||
'python3.12dist(requests)',
|
||||
'python3.12dist(tomli-w)',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
PythonIcecreamPackage = get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/icecream-2.1.3-py3.10.egg-info/requires.txt': {
|
||||
'content': """
|
||||
asttokens>=2.0.1
|
||||
colorama>=0.3.9
|
||||
executing>=0.3.1
|
||||
pygments>=2.2.0
|
||||
""",
|
||||
'create_dirs': True
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'asttokens>=2.0.1',
|
||||
'colorama>=0.3.9',
|
||||
'executing>=0.3.1',
|
||||
'pygments>=2.2.0',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
PythonBlinkerMockPackage = get_tested_mock_package(
|
||||
files=[
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.pyc',
|
||||
]
|
||||
)
|
||||
|
||||
PythonSiteBlinkerMockPackage = get_tested_mock_package(
|
||||
files=[
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.pyc',
|
||||
]
|
||||
)
|
|
@ -1,3 +1,16 @@
|
|||
from mock_packages import (
|
||||
PythonBlinkerMockPackage,
|
||||
PythonDistutilsMockPackage,
|
||||
PythonFlitMockPackage,
|
||||
PythonFlitUpdatedMockPackage,
|
||||
PythonIcecreamPackage,
|
||||
PythonJupyterEventsMockPackage,
|
||||
PythonJupyterServerFileidMockPackage,
|
||||
PythonModuleMockPackage,
|
||||
PythonScikitBuildMockPackage,
|
||||
PythonSiteBlinkerMockPackage,
|
||||
PythonSitePackage,
|
||||
)
|
||||
import pytest
|
||||
from rpmlint.checks.PythonCheck import PythonCheck
|
||||
from rpmlint.filter import Filter
|
||||
|
@ -25,18 +38,7 @@ def test(pythoncheck):
|
|||
yield test
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [get_tested_mock_package(
|
||||
files=[
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/doc',
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/docs',
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/doc',
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/docs',
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/doc',
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/docs',
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/doc',
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/docs',
|
||||
]
|
||||
)])
|
||||
@pytest.mark.parametrize('package', [PythonSitePackage])
|
||||
def test_python_doc_in_package(package, test, output):
|
||||
test.check(package)
|
||||
out = output.print_results(output.results)
|
||||
|
@ -50,18 +52,7 @@ def test_python_doc_in_package(package, test, output):
|
|||
assert 'W: python-doc-in-package /usr/lib64/python3.10/site-packages/python-mypackage/docs' in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib/python2.7/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib64/python2.7/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib/python3.10/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/doc/__init__.py': {'create_dirs': True, 'include_dirs': 2},
|
||||
'/usr/lib64/python3.10/site-packages/python-mypackage/docs/__init__.py': {'create_dirs': True, 'include_dirs': 1},
|
||||
}
|
||||
)])
|
||||
@pytest.mark.parametrize('package', [PythonModuleMockPackage])
|
||||
def test_python_doc_module_in_package(package, test, output):
|
||||
test.check(package)
|
||||
out = output.print_results(output.results)
|
||||
|
@ -75,14 +66,7 @@ def test_python_doc_module_in_package(package, test, output):
|
|||
assert 'W: python-doc-in-package /usr/lib64/python3.10/site-packages/python-mypackage/docs' not in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python2.7/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
'/usr/lib/python3.10/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
'/usr/lib64/python2.7/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
'/usr/lib64/python3.10/site-packages/mydistutilspackage.egg-info': {'content': 'Metadata-Version: 2.1\nName: pythoncheck'},
|
||||
},
|
||||
)])
|
||||
@pytest.mark.parametrize('package', [PythonDistutilsMockPackage])
|
||||
def test_python_distutils_egg_info(package, test, output):
|
||||
test.check(package)
|
||||
out = output.print_results(output.results)
|
||||
|
@ -159,104 +143,11 @@ def test_python_tests_in_site_packages(package, test, output):
|
|||
assert 'E: python-tests-in-site-packages /usr/lib64/python3.10/site-packages/tests' in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [
|
||||
get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/flit-3.8.0.dist-info/METADATA': {
|
||||
'content-path': 'files/python-flit-metadata.txt',
|
||||
'create_dirs': True,
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-flit_core',
|
||||
'python-requests',
|
||||
'python-tomli-w',
|
||||
'python310-docutils',
|
||||
],
|
||||
},
|
||||
),
|
||||
get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/jupyter_server_fileid-0.9.0.dist-info/METADATA': {
|
||||
'content-path': 'files/python-jupyter_server_fileid-metadata.txt',
|
||||
'create_dirs': True
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-jupyter-events',
|
||||
'python-click',
|
||||
'python-jupyter-server',
|
||||
],
|
||||
},
|
||||
),
|
||||
get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/jupyter_events-0.6.3.dist-info/METADATA': {
|
||||
'content-path': 'files/python-jupyter-events-metadata.txt',
|
||||
'create_dirs': True
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-jsonschema',
|
||||
'python-python-json-logger',
|
||||
'python-pyyaml',
|
||||
'python-rfc3339-validator',
|
||||
'python-rfc3986-validator',
|
||||
'python-traitlets',
|
||||
'python-click',
|
||||
'python-rich',
|
||||
'python-jupyterlite-sphinx',
|
||||
'python-myst-parser',
|
||||
'python-pydata-sphinx-theme',
|
||||
'python-sphinxcontrib-spelling',
|
||||
'python-click',
|
||||
'python-coverage',
|
||||
'python-pre-commit',
|
||||
'python-pytest-asyncio',
|
||||
'python-pytest-console-scripts',
|
||||
'python-pytest-cov',
|
||||
'python-pytest',
|
||||
'python-rich',
|
||||
],
|
||||
},
|
||||
),
|
||||
get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/scikit_build-0.17.2.dist-info/METADATA': {
|
||||
'content-path': 'files/python-scikit_build-metadata.txt',
|
||||
'create_dirs': True
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python-distro',
|
||||
'python-packaging',
|
||||
'python-setuptools',
|
||||
'python-wheel',
|
||||
'python-tomli',
|
||||
],
|
||||
},
|
||||
),
|
||||
get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/flit-3.8.0.dist-info/METADATA': {
|
||||
'content-path': 'files/python-flit-metadata.txt',
|
||||
'create_dirs': True,
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'python3.12dist(docutils)',
|
||||
'python3.12dist(flit-core) >= 3.8',
|
||||
'python3.12dist(requests)',
|
||||
'python3.12dist(tomli-w)',
|
||||
],
|
||||
},
|
||||
),
|
||||
])
|
||||
@pytest.mark.parametrize('package', [PythonFlitMockPackage,
|
||||
PythonJupyterServerFileidMockPackage,
|
||||
PythonJupyterEventsMockPackage,
|
||||
PythonScikitBuildMockPackage,
|
||||
PythonFlitUpdatedMockPackage,])
|
||||
def test_python_dependencies_metadata(package, test, output):
|
||||
test.check(package)
|
||||
out = output.print_results(output.results)
|
||||
|
@ -264,27 +155,7 @@ def test_python_dependencies_metadata(package, test, output):
|
|||
assert 'W: python-leftover-require' not in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [get_tested_mock_package(
|
||||
files={
|
||||
'/usr/lib/python3.10/site-packages/icecream-2.1.3-py3.10.egg-info/requires.txt': {
|
||||
'content': """
|
||||
asttokens>=2.0.1
|
||||
colorama>=0.3.9
|
||||
executing>=0.3.1
|
||||
pygments>=2.2.0
|
||||
""",
|
||||
'create_dirs': True
|
||||
},
|
||||
},
|
||||
header={
|
||||
'requires': [
|
||||
'asttokens>=2.0.1',
|
||||
'colorama>=0.3.9',
|
||||
'executing>=0.3.1',
|
||||
'pygments>=2.2.0',
|
||||
],
|
||||
},
|
||||
)])
|
||||
@pytest.mark.parametrize('package', [PythonIcecreamPackage])
|
||||
def test_python_dependencies_requires(package, test, output):
|
||||
test.check(package)
|
||||
out = output.print_results(output.results)
|
||||
|
@ -386,40 +257,14 @@ def test_python_dependencies_leftover(package, test, output):
|
|||
assert 'W: python-leftover-require' in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [get_tested_mock_package(
|
||||
files=[
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-310.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.pyc',
|
||||
]
|
||||
)])
|
||||
@pytest.mark.parametrize('package', [PythonBlinkerMockPackage])
|
||||
def test_python_pyc_multiple_versions(package, test, output):
|
||||
test.check(package)
|
||||
out = output.print_results(output.results)
|
||||
assert 'W: python-pyc-multiple-versions expected: 310' in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', [get_tested_mock_package(
|
||||
files=[
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/base.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/__init__.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_saferef.cpython-39.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.opt-1.pyc',
|
||||
'/usr/lib/python3.9/site-packages/blinker/__pycache__/_utilities.cpython-39.pyc',
|
||||
]
|
||||
)])
|
||||
@pytest.mark.parametrize('package', [PythonSiteBlinkerMockPackage])
|
||||
def test_python_pyc_single_version(package, test, output):
|
||||
test.check(package)
|
||||
out = output.print_results(output.results)
|
||||
|
|
Loading…
Reference in New Issue