public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/g-sorcery:master commit in: /
@ 2013-08-12  0:42 Jauhien Piatlicki
  2013-08-12 11:37 ` [gentoo-commits] proj/g-sorcery:pypi " Jauhien Piatlicki
  0 siblings, 1 reply; 3+ messages in thread
From: Jauhien Piatlicki @ 2013-08-12  0:42 UTC (permalink / raw
  To: gentoo-commits

commit:     fc484ded33c2660139aeee7bf7c9da2f8c837273
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Mon Aug 12 00:43:21 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Mon Aug 12 00:43:21 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=fc484ded

setup.py: pypi config

---
 setup.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/setup.py b/setup.py
index 7344df8..5cdb58c 100644
--- a/setup.py
+++ b/setup.py
@@ -13,6 +13,7 @@ setup(name          = 'g-sorcery',
       scripts       = ['bin/g-sorcery', 'bin/gs-elpa', 'bin/gs-ctan', 'bin/gs-pypi-generate-db'],
       data_files    = [('/etc/g-sorcery/', ['gs-elpa.json']),
                        ('/etc/g-sorcery/', ['gs-ctan.json']),
+                       ('/etc/g-sorcery/', ['gs-pypi.json']),
                        ('/etc/g-sorcery/', ['g-sorcery.cfg']),
                        ('/etc/layman/overlays/', ['gs-elpa-overlays.xml']),
                        ('/etc/layman/overlays/', ['gs-ctan-overlays.xml'])],


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/g-sorcery:master commit in: /
@ 2013-08-14  8:31 Jauhien Piatlicki
  2013-08-14  8:30 ` [gentoo-commits] proj/g-sorcery:pypi " Jauhien Piatlicki
  0 siblings, 1 reply; 3+ messages in thread
From: Jauhien Piatlicki @ 2013-08-14  8:31 UTC (permalink / raw
  To: gentoo-commits

commit:     546f8794ff0a43c177a8ac50e7dc368c397e3a90
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Wed Aug 14 08:29:43 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Wed Aug 14 08:29:43 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=546f8794

merging pypi branch


 gs_pypi/pypi_db.py | 132 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 70 insertions(+), 62 deletions(-)

diff --cc gs_pypi/pypi_db.py
index fca3432,9963b4e..69ad476
--- a/gs_pypi/pypi_db.py
+++ b/gs_pypi/pypi_db.py
@@@ -68,72 -65,73 +70,78 @@@ class PypiDBGenerator(DBGenerator)
          data = {}
          data["files"] = []
          data["info"] = {}
-         for table in soup("table", class_ = "list")[-1:]:
-             if not "File" in table("th")[0].string:
-                 continue
- 
-             for entry in table("tr")[1:-1]:
-                 fields = entry("td")
-                 
-                 FILE = 0
-                 URL = 0
-                 MD5 = 1
-                 
-                 TYPE = 1
-                 PYVERSION = 2
-                 UPLOADED = 3
-                 SIZE = 4
-                 
-                 file_inf = fields[FILE]("a")[0]["href"].split("#")
-                 file_url = file_inf[URL]
-                 file_md5 = file_inf[MD5][4:]
- 
-                 file_type = fields[TYPE].string
-                 file_pyversion = fields[PYVERSION].string
-                 file_uploaded = fields[UPLOADED].string
-                 file_size = fields[SIZE].string
- 
-                 data["files"].append({"url": file_url,
-                                       "md5": file_md5,
-                                       "type": file_type,
-                                       "pyversion": file_pyversion,
-                                       "uploaded": file_uploaded,
-                                       "size": file_size})
-                 entry.decompose()
-             table.decompose()
- 
-         uls = soup("ul", class_ = "nodot")
-         if uls:
-             if "Downloads (All Versions):" in uls[0]("strong")[0].string:
-                 ul = uls[1]
-             else:
-                 ul = uls[0]
- 
-             for entry in ul.contents:
-                 if not hasattr(entry, "name") or entry.name != "li":
-                     continue
-                 entry_name = entry("strong")[0].string
-                 if not entry_name:
-                     continue
- 
-                 if entry_name == "Categories":
-                     data["info"][entry_name] = {}
-                     for cat_entry in entry("a"):
-                         cat_data = cat_entry.string.split(" :: ")
-                         data["info"][entry_name][cat_data[0]] = cat_data[1:]
-                     continue
- 
-                 if entry("span"):
-                     data["info"][entry_name] = entry("span")[0].string
+         try:
+             for table in soup("table", class_ = "list")[-1:]:
+                 if not "File" in table("th")[0].string:
                      continue
  
-                 if entry("a"):
-                     data["info"][entry_name] = entry("a")[0]["href"]
-                     continue
-                 entry.decompose()
-             ul.decompose()
+                 for entry in table("tr")[1:-1]:
+                     fields = entry("td")
+ 
+                     FILE = 0
+                     URL = 0
+                     MD5 = 1
+ 
+                     TYPE = 1
+                     PYVERSION = 2
+                     UPLOADED = 3
+                     SIZE = 4
+ 
+                     file_inf = fields[FILE]("a")[0]["href"].split("#")
+                     file_url = file_inf[URL]
+                     file_md5 = file_inf[MD5][4:]
+ 
+                     file_type = fields[TYPE].string
+                     file_pyversion = fields[PYVERSION].string
+                     file_uploaded = fields[UPLOADED].string
+                     file_size = fields[SIZE].string
+ 
+                     data["files"].append({"url": file_url,
+                                           "md5": file_md5,
+                                           "type": file_type,
+                                           "pyversion": file_pyversion,
+                                           "uploaded": file_uploaded,
+                                           "size": file_size})
++                    entry.decompose()
++                table.decompose()
+ 
+             uls = soup("ul", class_ = "nodot")
+             if uls:
+                 if "Downloads (All Versions):" in uls[0]("strong")[0].string:
+                     ul = uls[1]
+                 else:
+                     ul = uls[0]
+ 
+                 for entry in ul.contents:
+                     if not hasattr(entry, "name") or entry.name != "li":
+                         continue
+                     entry_name = entry("strong")[0].string
+                     if not entry_name:
+                         continue
+ 
+                     if entry_name == "Categories":
+                         data["info"][entry_name] = {}
+                         for cat_entry in entry("a"):
+                             cat_data = cat_entry.string.split(" :: ")
+                             data["info"][entry_name][cat_data[0]] = cat_data[1:]
+                         continue
+ 
+                     if entry("span"):
+                         data["info"][entry_name] = entry("span")[0].string
+                         continue
+ 
+                     if entry("a"):
+                         data["info"][entry_name] = entry("a")[0]["href"]
+                         continue
++                    entry.decompose()
++                ul.decompose()
+ 
+         except Exception as error:
+             print("There was an error during parsing: " + str(error))
+             print("Ignoring this package.")
+             data = {}
  
 +        soup.decompose()
          return data
  
      def process_data(self, pkg_db, data, common_config, config):


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-14  8:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-12  0:42 [gentoo-commits] proj/g-sorcery:master commit in: / Jauhien Piatlicki
2013-08-12 11:37 ` [gentoo-commits] proj/g-sorcery:pypi " Jauhien Piatlicki
  -- strict thread matches above, loose matches on Subject: below --
2013-08-14  8:31 [gentoo-commits] proj/g-sorcery:master " Jauhien Piatlicki
2013-08-14  8:30 ` [gentoo-commits] proj/g-sorcery: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