public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/g-sorcery:master commit in: gs_pypi/data/, gs_pypi/
@ 2013-09-04 19:09 Jauhien Piatlicki
  0 siblings, 0 replies; only message in thread
From: Jauhien Piatlicki @ 2013-09-04 19:09 UTC (permalink / raw
  To: gentoo-commits

commit:     56d950cfe0abc860c6ff3bac343b36c532a77ac2
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Wed Sep  4 19:09:09 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Wed Sep  4 19:09:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=56d950cf

gs-pypi: depend on correct python version

---
 gs_pypi/data/gs-pypi.eclass |  2 --
 gs_pypi/ebuild.py           |  4 ++--
 gs_pypi/pypi_db.py          | 34 +++++++++++++++++++++++++++++++---
 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
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-04 19:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04 19:09 [gentoo-commits] proj/g-sorcery:master commit in: gs_pypi/data/, gs_pypi/ Jauhien Piatlicki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox