From: "Jauhien Piatlicki" <piatlicki@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/g-sorcery:pypi commit in: /
Date: Wed, 14 Aug 2013 08:30:19 +0000 (UTC) [thread overview]
Message-ID: <1376468983.546f8794ff0a43c177a8ac50e7dc368c397e3a90.jauhien@gentoo> (raw)
Message-ID: <20130814083019.yWTgL1Gm2ZmDy7TQ0pyFYSszkELGga82duOXkXqGolk@z> (raw)
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):
next reply other threads:[~2013-08-14 8:30 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 8:31 Jauhien Piatlicki [this message]
2013-08-14 8:30 ` [gentoo-commits] proj/g-sorcery:pypi commit in: / Jauhien Piatlicki
-- strict thread matches above, loose matches on Subject: below --
2015-09-13 19:32 [gentoo-commits] proj/g-sorcery:dev " Jauhien Piatlicki
2015-09-13 19:32 ` [gentoo-commits] proj/g-sorcery:master " Jauhien Piatlicki
2015-04-22 7:35 Jauhien Piatlicki
2015-04-20 21:36 [gentoo-commits] proj/g-sorcery:dev " Jauhien Piatlicki
2015-04-22 7:35 ` [gentoo-commits] proj/g-sorcery:master " Jauhien Piatlicki
2014-09-29 19:38 [gentoo-commits] proj/g-sorcery:dev " Jauhien Piatlicki
2014-09-29 19:39 ` [gentoo-commits] proj/g-sorcery:master " Jauhien Piatlicki
2014-05-10 2:03 Jauhien Piatlicki
2014-05-10 2:03 Jauhien Piatlicki
2014-03-05 17:58 Jauhien Piatlicki
2013-11-22 17:08 Jauhien Piatlicki
2013-11-22 16:55 [gentoo-commits] proj/g-sorcery:dev " Jauhien Piatlicki
2013-11-22 16:54 ` [gentoo-commits] proj/g-sorcery:master " Jauhien Piatlicki
2013-11-22 16:42 [gentoo-commits] proj/g-sorcery:dev " Jauhien Piatlicki
2013-11-22 16:42 ` [gentoo-commits] proj/g-sorcery:master " Jauhien Piatlicki
2013-11-22 16:38 Jauhien Piatlicki
2013-09-19 23:22 Jauhien Piatlicki
2013-09-19 23:21 Jauhien Piatlicki
2013-09-15 22:38 Jauhien Piatlicki
2013-09-15 14:32 Jauhien Piatlicki
2013-09-05 16:33 Jauhien Piatlicki
2013-08-30 17:00 Jauhien Piatlicki
2013-08-29 23:37 Jauhien Piatlicki
2013-08-29 21:30 Jauhien Piatlicki
2013-08-12 0:42 Jauhien Piatlicki
2013-08-12 0:36 Jauhien Piatlicki
2013-08-06 20:16 Jauhien Piatlicki
2013-08-06 20:16 Jauhien Piatlicki
2013-08-05 0:54 Jauhien Piatlicki
2013-08-05 0:46 Jauhien Piatlicki
2013-07-30 19:02 Jauhien Piatlicki
2013-07-26 9:43 Jauhien Piatlicki
2013-07-22 17:10 Jauhien Piatlicki
2013-07-15 0:00 Jauhien Piatlicki
2013-07-14 23:51 Jauhien Piatlicki
2013-07-14 22:53 Jauhien Piatlicki
2013-07-14 1:00 Jauhien Piatlicki
2013-07-13 23:41 Jauhien Piatlicki
2013-07-11 0:09 Jauhien Piatlicki
2013-07-11 0:05 Jauhien Piatlicki
2013-07-02 14:50 Jauhien Piatlicki
2013-07-02 10:21 Jauhien Piatlicki
2013-06-30 19:55 Jauhien Piatlicki
2013-06-20 22:53 Jauhien Piatlicki
2013-06-20 22:53 Jauhien Piatlicki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1376468983.546f8794ff0a43c177a8ac50e7dc368c397e3a90.jauhien@gentoo \
--to=piatlicki@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox