| |
@@ -2,6 +2,7 @@
|
| |
''' Python package tests '''
|
| |
|
| |
import re
|
| |
+ import rpm
|
| |
|
| |
from FedoraReview import CheckBase, RegistryBase
|
| |
|
| |
@@ -67,3 +68,45 @@
|
| |
'found.')
|
| |
return
|
| |
self.set_passed(self.PASS)
|
| |
+
|
| |
+
|
| |
+ class CheckPythonX_Site(PythonCheckBase):
|
| |
+ '''
|
| |
+ MUST: One must not use any of the following in the %files section:
|
| |
+
|
| |
+ %{python3_sitelib}/*
|
| |
+ %{python3_sitearch}/*
|
| |
+ %{python2_sitelib}/*
|
| |
+ %{python2_sitearch}/*
|
| |
+ %{python_sitelib}/*
|
| |
+ %{python_sitearch}/*
|
| |
+
|
| |
+ https://pagure.io/packaging-committee/issue/782
|
| |
+
|
| |
+ '''
|
| |
+ def __init__(self, base):
|
| |
+ PythonCheckBase.__init__(self, base)
|
| |
+ self.url = 'https://pagure.io/packaging-committee/issue/782'
|
| |
+ self.text = 'Python packages must not contain %{pythonX_site(lib|arch)}/* in %files'
|
| |
+ self.automatic = True
|
| |
+ self.type = 'MUST'
|
| |
+
|
| |
+ def run_on_applicable(self):
|
| |
+ has_python_site = False
|
| |
+ python_sitelib = re.compile(rpm.expandMacro(r'^%{python_sitelib}\/\*$') + '|' + \
|
| |
+ rpm.expandMacro(r'^%{python_sitearch}\/\*$') + '|' + \
|
| |
+ rpm.expandMacro(r'^%{python2_sitelib}\/\*$') + '|' + \
|
| |
+ rpm.expandMacro(r'^%{python2_sitearch}\/\*$') + '|' + \
|
| |
+ rpm.expandMacro(r'^%{python3_sitelib}\/\*$') + '|' + \
|
| |
+ rpm.expandMacro(r'^%{python3_sitearch}\/\*$'))
|
| |
+
|
| |
+ for pkg in self.spec.packages:
|
| |
+ for line in self.spec.get_files(pkg):
|
| |
+ if python_sitelib.match(line):
|
| |
+ has_python_site = True
|
| |
+ break
|
| |
+ if has_python_site:
|
| |
+ self.set_passed(self.FAIL, 'Package contains %{pythonX_site(lib|arch)}/* in %files')
|
| |
+ else:
|
| |
+ self.set_passed(self.PASS)
|
| |
+
|
| |
Implements https://pagure.io/packaging-committee/issue/782