diff options
author | 2013-07-18 02:12:14 +0200 | |
---|---|---|
committer | 2013-07-18 02:12:14 +0200 | |
commit | 72e80df4afd6561b240f076471790bfdeda6df62 (patch) | |
tree | 01143393ec5794392fdfe8454c4c43a26bcbc721 /gs_ctan | |
parent | gs_ctan/ctan_db: parse_data, dependency parsing (diff) | |
download | g-sorcery-72e80df4afd6561b240f076471790bfdeda6df62.tar.gz g-sorcery-72e80df4afd6561b240f076471790bfdeda6df62.tar.bz2 g-sorcery-72e80df4afd6561b240f076471790bfdeda6df62.zip |
gs_ctan/ctan_db: process_data, some progress ;-)
Diffstat (limited to 'gs_ctan')
-rw-r--r-- | gs_ctan/ctan_db.py | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py index 47d7160..a85488e 100644 --- a/gs_ctan/ctan_db.py +++ b/gs_ctan/ctan_db.py @@ -76,7 +76,54 @@ class CtanDB(PackageDB): return result def process_data(self, data): + + self.add_category('dev-tex') + for entry in data["texlive.tlpdb"]: - for key, value in entry.items(): - print(key + ": " + str(value)) + + realname = entry["name"] + + #todo: work on common data vars processing: external deps, filtering etc. + #at the moment just copy necessary code from elpa_db.py + allowed_ords = set(range(ord('a'), ord('z'))) | set(range(ord('A'), ord('Z'))) | \ + set(range(ord('0'), ord('9'))) | set(list(map(ord, + ['+', '_', '-', ' ', '.', '(', ')', '[', ']', '{', '}', ',']))) + + if "shortdesc" in entry: + description = entry["shortdesc"] + else: + description = entry["name"] + description = "".join([x for x in description if ord(x) in allowed_ords]) + + if "longdesc" in entry: + longdescription = entry["longdesc"] + longdescription = "".join([x for x in longdescription if ord(x) in allowed_ords]) + else: + longdescription = description + + if "catalogue-version" in entry: + version = entry["catalogue-version"] + else: + version = entry["revision"] + + #todo: convert to gentoo licenses + if "catalogue-license" in entry: + license = entry["catalogue-license"] + else: + license = "unknown" + + if "catalogue-ctan" in entry: + source_type = "zip" + base_src_uri = "http://www.ctan.org/tex-archive" + catalogue = entry["catalogue-ctan"] + else: + source_type = "tar.xz" + base_src_uri = "http://mirror.ctan.org/systems/texlive/tlnet/archive" + catalogue = "" + + print("dev-tex/" + realname + "-" + version) + print(" license: " + license) + print(" " + description) + print + print(" " + longdescription) print |