| |
@@ -1,6 +1,7 @@
|
| |
# -*- coding: utf-8 -*-
|
| |
''' Python package tests '''
|
| |
|
| |
+ import re
|
| |
|
| |
from FedoraReview import CheckBase, RegistryBase
|
| |
|
| |
@@ -39,3 +40,31 @@
|
| |
br = self.spec.build_requires
|
| |
passed = 'python2-devel' in br or 'python3-devel' in br
|
| |
self.set_passed(self.PASS if passed else self.FAIL)
|
| |
+
|
| |
+
|
| |
+ class CheckPythonRequires(PythonCheckBase):
|
| |
+ """ Check that there is no unversioned Python dependencies """
|
| |
+ def __init__(self, base):
|
| |
+ PythonCheckBase.__init__(self, base)
|
| |
+ self.url = 'https://fedoraproject.org/wiki/Packaging:Python' \
|
| |
+ '#Dependencies'
|
| |
+ self.text = 'Packages MUST NOT have dependencies (either build-time ' \
|
| |
+ 'or runtime) on packages named with the unversioned python- ' \
|
| |
+ 'prefix unless no properly versioned package exists. ' \
|
| |
+ 'Dependencies on Python packages instead MUST use names ' \
|
| |
+ 'beginning with python2- or python3- as appropriate.'
|
| |
+ self.automatic = True
|
| |
+ self.type = 'MUST'
|
| |
+
|
| |
+ def run_on_applicable(self):
|
| |
+ """ Run the check """
|
| |
+ regex = re.compile('(^python-)|(-python$)|(-python-)', re.M)
|
| |
+ br = self.spec.build_requires
|
| |
+ rr = self.spec.get_requires()
|
| |
+
|
| |
+ if regex.search('\n'.join(br)) or regex.search('\n'.join(rr)):
|
| |
+ self.set_passed(self.FAIL, 'Unversionned Python dependency ' \
|
| |
+ 'found.')
|
| |
+ return
|
| |
+ self.set_passed(self.PASS)
|
| |
+
|
| |
Packages MUST NOT have dependencies (either build-time or runtime) on packages named with the unversioned python- prefix unless no properly versioned package exists. Dependencies on Python packages instead MUST use names beginning with python2- or python3- as appropriate.
https://fedoraproject.org/wiki/Packaging:Python#Dependencies