#Variables that will be passed to the Cheetah template
self.vars = {
- 'need_python': '',
+ 'python_depend': '*',
+ 'restrict_python_abis': '',
+ 'supported_python_versions': '',
'python_modname': '',
'description': '',
'homepage': '',
self.vars['license'] = "%s" % my_license
+ 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))
+
def add_warning(self, warning):
"""Add warning to be shown after ebuild is created"""
if warning not in self.warnings:
#for warn in $warnings:
\# Warning: $warn
#end for
+
+#end if
+# API of python.eclass in EAPI > 3 not established (see python.eclass)'
+EAPI="3"
+
+# HACK: PYTHON_DEPEND and RESTRICT_PYTHON_ABIS currently hardcoded.
+#if $supported_python_versions
+# This package claims to support the following versions:
+# $supported_python_versions
#end if
-#if $need_python
-NEED_PYTHON="$need_python"
+PYTHON_DEPEND="$python_depend"
+SUPPORT_PYTHON_ABIS="1"
+#if $restrict_python_abis
+RESTRICT_PYTHON_ABIS="$restrict_python_abis"
#end if
#if $python_modname