aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-09-04 21:09:09 +0200
committerJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-09-04 21:09:09 +0200
commit56d950cfe0abc860c6ff3bac343b36c532a77ac2 (patch)
tree644cacc88c89bcdb04d1081a8fa4601433de0e28
parentg_sorcery/package_db; fix for py-3 (diff)
downloadg-sorcery-56d950cfe0abc860c6ff3bac343b36c532a77ac2.tar.gz
g-sorcery-56d950cfe0abc860c6ff3bac343b36c532a77ac2.tar.bz2
g-sorcery-56d950cfe0abc860c6ff3bac343b36c532a77ac2.zip
gs-pypi: depend on correct python version
-rw-r--r--gs_pypi/data/gs-pypi.eclass2
-rw-r--r--gs_pypi/ebuild.py4
-rw-r--r--gs_pypi/pypi_db.py34
3 files changed, 33 insertions, 7 deletions
diff --git a/gs_pypi/data/gs-pypi.eclass b/gs_pypi/data/gs-pypi.eclass
index 4377808..c35796c 100644
--- a/gs_pypi/data/gs-pypi.eclass
+++ b/gs_pypi/data/gs-pypi.eclass
@@ -12,6 +12,4 @@
# @ECLASS: gs-pypi.eclass
#
-PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3} )
-
inherit distutils-r1 g-sorcery
diff --git a/gs_pypi/ebuild.py b/gs_pypi/ebuild.py
index 7f8fb5f..74ba910 100644
--- a/gs_pypi/ebuild.py
+++ b/gs_pypi/ebuild.py
@@ -25,7 +25,7 @@ class PypiEbuildWithoutDigestGenerator(DefaultEbuildGenerator):
vars_before_inherit = \
[("repo_uri", 'http://pypi.python.org/packages/source/${PN:0:1}/${PN}/'),
- ("sourcefile", '${P}.tar.gz')]
+ ("sourcefile", '${P}.tar.gz'), "python_compat"]
inherit = ["gs-pypi"]
@@ -43,7 +43,7 @@ class PypiEbuildWithDigestGenerator(DefaultEbuildGenerator):
def __init__(self, package_db):
vars_before_inherit = \
- [("digest_sources", "yes")]
+ [("digest_sources", "yes"), "python_compat"]
inherit = ["gs-pypi"]
diff --git a/gs_pypi/pypi_db.py b/gs_pypi/pypi_db.py
index 56b4f1c..188be01 100644
--- a/gs_pypi/pypi_db.py
+++ b/gs_pypi/pypi_db.py
@@ -201,15 +201,42 @@ class PypiDBGenerator(DBGenerator):
homepage = ""
license = ""
+ py_versions = []
if info:
if "Home Page:" in info:
homepage = info["Home Page:"]
categories = {}
if "Categories" in info:
categories = info["Categories"]
- if "License" in categories:
- license = categories["License"][-1]
-
+
+ if 'Programming Language' in categories:
+ for entry in ebuild_data['info']['Categories']['Programming Language']:
+ if entry == '2':
+ py_versions.extend(['2_6', '2_7'])
+ elif entry == '3':
+ py_versions.extend(['3_2', '3_3'])
+ elif entry == '2.6':
+ py_versions.extend(['2_6'])
+ elif entry == '2.7':
+ py_versions.extend(['2_7'])
+ elif entry == '3.2':
+ py_versions.extend(['3_2'])
+ elif entry == '3.3':
+ py_versions.extend(['3_3'])
+
+ if "License" in categories:
+ license = categories["License"][-1]
+
+ if not py_versions:
+ py_versions = ['2_6', '2_7', '3_2', '3_3']
+ if len(py_versions) == 1:
+ python_compat = 'python' + py_versions[0]
+ else:
+ python_compat = '( python{' + py_versions[0]
+ for ver in py_versions[1:]:
+ python_compat += ',' + ver
+ python_compat += '} )'
+
filtered_package = "".join([x for x in package if ord(x) in allowed_ords_pkg])
description = "".join([x for x in description if ord(x) in allowed_ords_desc])
filtered_version = version
@@ -234,6 +261,7 @@ class PypiDBGenerator(DBGenerator):
ebuild_data["license"] = license
ebuild_data["source_uri"] = source_uri
ebuild_data["md5"] = md5
+ ebuild_data["python_compat"] = python_compat
ebuild_data["info"] = info