+ self.get_python_depend()
+
+ def get_python_depend(self):
+ """Generate PYTHON_DEPEND and RESTRICT_PYTHON_ABIS strings
+ """
+ possible_versions = [(2, i) for i in range(2, 8)]
+ possible_versions.extend([(3, i) for i in range(3)])
+
+ allowed_versions = []
+ allowed_version_strings = []
+ start = 'Programming Language :: Python ::'
+ for data in self.metadata.get('classifiers', []):
+ if data.startswith(start):
+ version = data[len(start):].strip()
+ allowed_version_strings.append(version)
+ allowed_versions.append(
+ [int(x) for x in version.split('.')])
+
+ # TODO: also use PEP 345's Requires-Python
+
+ self.logger.info('supported Python versions: %s' %
+ ', '.join(sorted(allowed_version_strings)))
+ major_versions = set([v[0] for v in allowed_versions])
+ v3 = 3 in major_versions
+ v2 = 2 in major_versions
+
+ # HACK! need an algorithm for determining these
+ self.vars['python_depend'] = '*:2.6'
+ self.vars['restrict_python_abis'] = '3.*'
+ self.vars['supported_python_versions'] = ', '.join(
+ sorted(allowed_version_strings))
+