From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E90841381F3 for ; Thu, 1 Aug 2013 15:58:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0B6E0E0A68; Thu, 1 Aug 2013 15:58:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7E795E0A68 for ; Thu, 1 Aug 2013 15:58:26 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 45F3A33EAD8 for ; Thu, 1 Aug 2013 15:58:25 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id F25FDE546D for ; Thu, 1 Aug 2013 15:58:21 +0000 (UTC) From: "Jauhien Piatlicki" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jauhien Piatlicki" Message-ID: <1375372685.d12a62bf86564cda836c25546ff8059335fbe7c7.jauhien@gentoo> Subject: [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/ X-VCS-Repository: proj/g-sorcery X-VCS-Files: gs_ctan/backend.py gs_ctan/ctan_db.py gs_ctan/ebuild.py X-VCS-Directories: gs_ctan/ X-VCS-Committer: jauhien X-VCS-Committer-Name: Jauhien Piatlicki X-VCS-Revision: d12a62bf86564cda836c25546ff8059335fbe7c7 X-VCS-Branch: master Date: Thu, 1 Aug 2013 15:58:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: cce6a571-e998-46c0-b14d-b8a678f6e887 X-Archives-Hash: 104584b548545ce664c607d038f6fbe6 commit: d12a62bf86564cda836c25546ff8059335fbe7c7 Author: Jauhien Piatlicki (jauhien) gmail com> AuthorDate: Thu Aug 1 15:58:05 2013 +0000 Commit: Jauhien Piatlicki gmail com> CommitDate: Thu Aug 1 15:58:05 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=d12a62bf CTAN backend: Docstrings and different fixes --- gs_ctan/backend.py | 4 ++++ gs_ctan/ctan_db.py | 25 ++++++++++++++++++++++--- gs_ctan/ebuild.py | 6 ++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/gs_ctan/backend.py b/gs_ctan/backend.py index 42a4a83..92245e6 100644 --- a/gs_ctan/backend.py +++ b/gs_ctan/backend.py @@ -23,10 +23,14 @@ from .ebuild import CtanEbuildWithoutDigestGenerator, CtanEbuildWithDigestGenera class CtanEclassGenerator(EclassGenerator): + """ + Implementation of eclass generator. Only specifies a data directory. + """ def __init__(self): super(CtanEclassGenerator, self).__init__(os.path.join(get_pkgpath(__file__), 'data')) +#Backend instance to be loaded by g_sorcery instance = Backend(CtanDBGenerator, CtanEbuildWithDigestGenerator, CtanEbuildWithoutDigestGenerator, CtanEclassGenerator, MetadataGenerator) diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py index 39195e8..0f7d939 100644 --- a/gs_ctan/ctan_db.py +++ b/gs_ctan/ctan_db.py @@ -12,17 +12,18 @@ """ import itertools -import os import re import portage from g_sorcery.g_collections import Dependency, Package, serializable_elist from g_sorcery.package_db import DBGenerator -from g_sorcery.exceptions import SyncError from g_sorcery.logger import Logger class CtanDBGenerator(DBGenerator): + """ + Implementation of database generator for CTAN LaTeX backend. + """ def __init__(self, package_db_class): super(CtanDBGenerator, self).__init__(package_db_class) @@ -38,10 +39,25 @@ class CtanDBGenerator(DBGenerator): def get_download_uries(self, common_config, config): + """ + Get download URI. + """ tlpdb_uri = config["repo_uri"] + "/tlpkg/texlive.tlpdb.xz" return [tlpdb_uri] def parse_data(self, data_f): + """ + Parse downloaded data. + + Parsed data is a list of dictionaries. + Each dictionary corresponds to one package. + + Args: + data_f: Open file wit data. + + Returns: + Parsed data. + """ data = data_f.read() data = data.split("\n") @@ -98,7 +114,10 @@ class CtanDBGenerator(DBGenerator): return result def process_data(self, pkg_db, data, common_config, config): - + """ + Process parsed data and fill database. + """ + category = "dev-tex" pkg_db.add_category(category) diff --git a/gs_ctan/ebuild.py b/gs_ctan/ebuild.py index a800cbd..d8b4f65 100644 --- a/gs_ctan/ebuild.py +++ b/gs_ctan/ebuild.py @@ -21,6 +21,9 @@ Layout = collections.namedtuple("Layout", class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator): + """ + Implementation of ebuild generator without sources digesting. + """ def __init__(self, package_db): vars_before_inherit = \ @@ -39,6 +42,9 @@ class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator): super(CtanEbuildWithoutDigestGenerator, self).__init__(package_db, layout) class CtanEbuildWithDigestGenerator(DefaultEbuildGenerator): + """ + Implementation of ebuild generator with sources digesting. + """ def __init__(self, package_db): vars_before_inherit = \