1 |
commit: d12a62bf86564cda836c25546ff8059335fbe7c7 |
2 |
Author: Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Aug 1 15:58:05 2013 +0000 |
4 |
Commit: Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com> |
5 |
CommitDate: Thu Aug 1 15:58:05 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=d12a62bf |
7 |
|
8 |
CTAN backend: Docstrings and different fixes |
9 |
|
10 |
--- |
11 |
gs_ctan/backend.py | 4 ++++ |
12 |
gs_ctan/ctan_db.py | 25 ++++++++++++++++++++++--- |
13 |
gs_ctan/ebuild.py | 6 ++++++ |
14 |
3 files changed, 32 insertions(+), 3 deletions(-) |
15 |
|
16 |
diff --git a/gs_ctan/backend.py b/gs_ctan/backend.py |
17 |
index 42a4a83..92245e6 100644 |
18 |
--- a/gs_ctan/backend.py |
19 |
+++ b/gs_ctan/backend.py |
20 |
@@ -23,10 +23,14 @@ from .ebuild import CtanEbuildWithoutDigestGenerator, CtanEbuildWithDigestGenera |
21 |
|
22 |
|
23 |
class CtanEclassGenerator(EclassGenerator): |
24 |
+ """ |
25 |
+ Implementation of eclass generator. Only specifies a data directory. |
26 |
+ """ |
27 |
def __init__(self): |
28 |
super(CtanEclassGenerator, self).__init__(os.path.join(get_pkgpath(__file__), 'data')) |
29 |
|
30 |
|
31 |
+#Backend instance to be loaded by g_sorcery |
32 |
instance = Backend(CtanDBGenerator, |
33 |
CtanEbuildWithDigestGenerator, CtanEbuildWithoutDigestGenerator, |
34 |
CtanEclassGenerator, MetadataGenerator) |
35 |
|
36 |
diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py |
37 |
index 39195e8..0f7d939 100644 |
38 |
--- a/gs_ctan/ctan_db.py |
39 |
+++ b/gs_ctan/ctan_db.py |
40 |
@@ -12,17 +12,18 @@ |
41 |
""" |
42 |
|
43 |
import itertools |
44 |
-import os |
45 |
import re |
46 |
|
47 |
import portage |
48 |
|
49 |
from g_sorcery.g_collections import Dependency, Package, serializable_elist |
50 |
from g_sorcery.package_db import DBGenerator |
51 |
-from g_sorcery.exceptions import SyncError |
52 |
from g_sorcery.logger import Logger |
53 |
|
54 |
class CtanDBGenerator(DBGenerator): |
55 |
+ """ |
56 |
+ Implementation of database generator for CTAN LaTeX backend. |
57 |
+ """ |
58 |
def __init__(self, package_db_class): |
59 |
super(CtanDBGenerator, self).__init__(package_db_class) |
60 |
|
61 |
@@ -38,10 +39,25 @@ class CtanDBGenerator(DBGenerator): |
62 |
|
63 |
|
64 |
def get_download_uries(self, common_config, config): |
65 |
+ """ |
66 |
+ Get download URI. |
67 |
+ """ |
68 |
tlpdb_uri = config["repo_uri"] + "/tlpkg/texlive.tlpdb.xz" |
69 |
return [tlpdb_uri] |
70 |
|
71 |
def parse_data(self, data_f): |
72 |
+ """ |
73 |
+ Parse downloaded data. |
74 |
+ |
75 |
+ Parsed data is a list of dictionaries. |
76 |
+ Each dictionary corresponds to one package. |
77 |
+ |
78 |
+ Args: |
79 |
+ data_f: Open file wit data. |
80 |
+ |
81 |
+ Returns: |
82 |
+ Parsed data. |
83 |
+ """ |
84 |
data = data_f.read() |
85 |
|
86 |
data = data.split("\n") |
87 |
@@ -98,7 +114,10 @@ class CtanDBGenerator(DBGenerator): |
88 |
return result |
89 |
|
90 |
def process_data(self, pkg_db, data, common_config, config): |
91 |
- |
92 |
+ """ |
93 |
+ Process parsed data and fill database. |
94 |
+ """ |
95 |
+ |
96 |
category = "dev-tex" |
97 |
|
98 |
pkg_db.add_category(category) |
99 |
|
100 |
diff --git a/gs_ctan/ebuild.py b/gs_ctan/ebuild.py |
101 |
index a800cbd..d8b4f65 100644 |
102 |
--- a/gs_ctan/ebuild.py |
103 |
+++ b/gs_ctan/ebuild.py |
104 |
@@ -21,6 +21,9 @@ Layout = collections.namedtuple("Layout", |
105 |
|
106 |
|
107 |
class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator): |
108 |
+ """ |
109 |
+ Implementation of ebuild generator without sources digesting. |
110 |
+ """ |
111 |
def __init__(self, package_db): |
112 |
|
113 |
vars_before_inherit = \ |
114 |
@@ -39,6 +42,9 @@ class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator): |
115 |
super(CtanEbuildWithoutDigestGenerator, self).__init__(package_db, layout) |
116 |
|
117 |
class CtanEbuildWithDigestGenerator(DefaultEbuildGenerator): |
118 |
+ """ |
119 |
+ Implementation of ebuild generator with sources digesting. |
120 |
+ """ |
121 |
def __init__(self, package_db): |
122 |
|
123 |
vars_before_inherit = \ |