Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Slava Bacherikov" <slava@...>
Subject: proj/gentoo-packages:master commit in: gpackages/main/, gpackages/apps/packages/, ...
Date: Thu, 21 Jun 2012 00:51:44 +0000 (UTC)
commit:     314a11842f67a18f590692d0eec7331418b3bd58
Author:     Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jun 21 00:51:40 2012 +0000
Commit:     Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jun 21 00:51:40 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=314a1184

Move package info layer

---
 gpackages/apps/packages/managers.py                |    4 +-
 gpackages/apps/packages/models.py                  |    6 ++--
 gpackages/libs/package_info/__init__.py            |    1 +
 gpackages/libs/package_info/abstract.py            |    4 ++
 .../libs/{ => package_info}/category_metadata.py   |    0
 gpackages/libs/{ => package_info}/generic.py       |    0
 .../libs/{ => package_info}/generic_objects.py     |    0
 gpackages/libs/{ => package_info}/herds.py         |    0
 gpackages/libs/{ => package_info}/mixins.py        |    0
 gpackages/libs/{ => package_info}/my_etree.py      |    0
 .../libs/package_info/package_backends/__init__.py |   15 ++++++++
 .../package_backends}/pkgcore_porttree.py          |   38 ++++---------------
 .../package_backends/portage.py}                   |   12 +++---
 gpackages/libs/{ => package_info}/repo_info.py     |    0
 gpackages/libs/{ => package_info}/use_info.py      |    0
 gpackages/libs/{ => package_info}/validators.py    |    0
 gpackages/main/settings.py                         |    2 +
 17 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/gpackages/apps/packages/managers.py b/gpackages/apps/packages/managers.py
index 45033d8..3162ef7 100644
--- a/gpackages/apps/packages/managers.py
+++ b/gpackages/apps/packages/managers.py
@@ -1,7 +1,7 @@
 from django.db import models, connections, router, transaction, IntegrityError
-from porttree import Category, Package, Ebuild, Keyword
+from package_info.package_backends.portage import Category, Package, Ebuild, Keyword
 import packages.models
-from generic import get_from_kwargs_and_del
+from package_info.generic import get_from_kwargs_and_del
 
 def _gen_query_and_manager(MixinClass, QueryClassName, ManagerClassName):
     QueryClass = type(QueryClassName, (MixinClass, models.query.QuerySet), {})

diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index 1f7c6e8..89a5f75 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -1,9 +1,9 @@
 from django.db import models
 
-from porttree import Category, Package, Ebuild
+from package_info.package_backends.portage import Category, Package, Ebuild
 import managers
-from generic import get_from_kwargs_and_del
-from repo_info import REPOS_TYPE
+from package_info.generic import get_from_kwargs_and_del
+from package_info.repo_info import REPOS_TYPE
 
 from django.core.validators import URLValidator, validate_email 
 from django.core.exceptions import ValidationError

diff --git a/gpackages/libs/__init__.py b/gpackages/libs/__init__.py
deleted file mode 100644
index e69de29..0000000

diff --git a/gpackages/libs/package_info/__init__.py b/gpackages/libs/package_info/__init__.py
new file mode 100644
index 0000000..3173dba
--- /dev/null
+++ b/gpackages/libs/package_info/__init__.py
@@ -0,0 +1 @@
+__name__ = 'package_info'

diff --git a/gpackages/libs/package_info/abstract.py b/gpackages/libs/package_info/abstract.py
new file mode 100644
index 0000000..cdf6b30
--- /dev/null
+++ b/gpackages/libs/package_info/abstract.py
@@ -0,0 +1,4 @@
+from abc import ABCMeta, abstractmethod, abstractproperty
+
+class AbstractPortage(ABCMeta):
+    pass

diff --git a/gpackages/libs/category_metadata.py b/gpackages/libs/package_info/category_metadata.py
similarity index 100%
rename from gpackages/libs/category_metadata.py
rename to gpackages/libs/package_info/category_metadata.py

diff --git a/gpackages/libs/generic.py b/gpackages/libs/package_info/generic.py
similarity index 100%
rename from gpackages/libs/generic.py
rename to gpackages/libs/package_info/generic.py

diff --git a/gpackages/libs/generic_objects.py b/gpackages/libs/package_info/generic_objects.py
similarity index 100%
rename from gpackages/libs/generic_objects.py
rename to gpackages/libs/package_info/generic_objects.py

diff --git a/gpackages/libs/herds.py b/gpackages/libs/package_info/herds.py
similarity index 100%
rename from gpackages/libs/herds.py
rename to gpackages/libs/package_info/herds.py

diff --git a/gpackages/libs/mixins.py b/gpackages/libs/package_info/mixins.py
similarity index 100%
rename from gpackages/libs/mixins.py
rename to gpackages/libs/package_info/mixins.py

diff --git a/gpackages/libs/my_etree.py b/gpackages/libs/package_info/my_etree.py
similarity index 100%
rename from gpackages/libs/my_etree.py
rename to gpackages/libs/package_info/my_etree.py

diff --git a/gpackages/libs/package_info/package_backends/__init__.py b/gpackages/libs/package_info/package_backends/__init__.py
new file mode 100644
index 0000000..c682f91
--- /dev/null
+++ b/gpackages/libs/package_info/package_backends/__init__.py
@@ -0,0 +1,15 @@
+from __future__ import absolute_import
+__name__ = 'package_backends'
+
+from main import settings
+
+DEFAULT_BACKEND = 'portage'
+
+try:
+    backend = settings.PACKAGE_INFO_BACKEND
+except AttributeError:
+    backend = DEFAULT_BACKEND
+
+#backend = __import__('package_backends.' + backend) 
+
+#portage = backend.Portage()

diff --git a/gpackages/libs/pkgcore_porttree.py b/gpackages/libs/package_info/package_backends/pkgcore_porttree.py
similarity index 81%
rename from gpackages/libs/pkgcore_porttree.py
rename to gpackages/libs/package_info/package_backends/pkgcore_porttree.py
index ac15e2f..704c73f 100644
--- a/gpackages/libs/pkgcore_porttree.py
+++ b/gpackages/libs/package_info/package_backends/pkgcore_porttree.py
@@ -3,17 +3,13 @@ from pkgcore.ebuild.repository import UnconfiguredTree, SlavedTree
 from pkgcore.util.repo_utils import get_raw_repos, get_virtual_repos
 from pkgcore.ebuild.atom import atom
 
-from generic import ToStrMixin
-
-from porttree import AutoGeneratorMixin
-
+#Mixins
+from mixins import PortageMixin, PortTreeMixin, CategoryMixin, PackageMixin, \
+                   EbuildMixin
 import os.path
 
 
-class Portage(AutoGeneratorMixin):
-
-    generator_names = ('iter_categories', 'iter_packages', 'iter_ebuilds')
-    main_iterator = 'iter_trees'
+class Portage(PortageMixin):
 
     def __init__(self):
         self._config = load_config()
@@ -52,10 +48,7 @@ class Portage(AutoGeneratorMixin):
         else:
             raise ValueError
         
-class PortTree(ToStrMixin, AutoGeneratorMixin):
-
-    generator_names = ('iter_packages', 'iter_ebuilds')
-    main_iterator = 'iter_categories'
+class PortTree(PortTreeMixin):
 
     def __init__(self, repo_obj):
         self._repo_obj = repo_obj
@@ -71,9 +64,6 @@ class PortTree(ToStrMixin, AutoGeneratorMixin):
         "Full path to portage tree"
         return self._repo_obj.location
 
-    def __unicode__(self):
-        return self.name
-
     @property
     def _packages(self):
         return self._repo_obj.packages
@@ -85,10 +75,7 @@ class PortTree(ToStrMixin, AutoGeneratorMixin):
     def _versions(self):
         return self._repo_obj.versions
 
-class Category(ToStrMixin, AutoGeneratorMixin):
-
-    generator_names = ('iter_ebuilds', )
-    main_iterator = 'iter_packages'
+class Category(CategoryMixin):
     
     def __init__(self, category_name, repo_obj):
         self._repo_obj = repo_obj
@@ -109,10 +96,7 @@ class Category(ToStrMixin, AutoGeneratorMixin):
     def _get_ebuilds_names_by_name(self, package_name):
         return self._repo_obj._versions[(self.name, package_name)]
 
-    def __unicode__(self):
-        return self.name
-
-class Package(ToStrMixin):
+class Package(PackageMixin):
     
     def __init__(self, package_name, category_obj):
         self.name = package_name
@@ -122,9 +106,6 @@ class Package(ToStrMixin):
         for ebuild in self.category_obj._repo_obj._itermatch(atom(self.cp)):
             yield Ebuild(ebuild, self)
 
-    def __unicode__(self):
-        return self.cp
-
     def _get_ebuilds_versions(self):
         return self.category_obj._get_ebuilds_names_by_name(self.name)
 
@@ -133,15 +114,12 @@ class Package(ToStrMixin):
         return '%s/%s' % (self.category_obj.name, self.name)
 
 
-class Ebuild(ToStrMixin):
+class Ebuild(EbuildMixin):
     
     def __init__(self, ebuild, package_obj):
         self._ebuild = ebuild
         self.package_obj = package_obj
 
-    def __unicode__(self):
-        return self.cpv
-
     @property
     def cpv(self):
         return self._ebuild.cpvstr

diff --git a/gpackages/libs/porttree.py b/gpackages/libs/package_info/package_backends/portage.py
similarity index 95%
rename from gpackages/libs/porttree.py
rename to gpackages/libs/package_info/package_backends/portage.py
index 74a6e6e..682f39a 100644
--- a/gpackages/libs/porttree.py
+++ b/gpackages/libs/package_info/package_backends/portage.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
 import portage
 from portage.util.listdir import listdir
 from portage.dep import Atom
@@ -7,21 +8,21 @@ from portage.exception import PortageException, FileNotFound, InvalidAtom, \
 from gentoolkit.package import Package as PackageInfo
 from gentoolkit.metadata import MetaData
 from gentoolkit import errors
-from generic import cached_property, lofstr_to_ig 
+from package_info.generic import cached_property, lofstr_to_ig 
 
 import os.path
 
 #Generic objects
-from generic_objects import Use, Keyword, KeywordsSet
+from ..generic_objects import Use, Keyword, KeywordsSet
 
 #Mixins
-from mixins import PortageMixin, PortTreeMixin, CategoryMixin, PackageMixin, \
+from ..mixins import PortageMixin, PortTreeMixin, CategoryMixin, PackageMixin, \
                    EbuildMixin
 
 # Validators
-from validators import validate_url, validate_url, ValidationError
+from ..validators import validate_url, validate_url, ValidationError
 
-from category_metadata import CategoryMetadata, FakeMetaData
+from ..category_metadata import CategoryMetadata, FakeMetaData
 
 __all__ = ('Portage','PortTree', 'Category', 'Package', 'Ebuild')
 
@@ -281,7 +282,6 @@ class Ebuild(EbuildMixin):
                 ret.append(homepage)
         return ret
         
-
     @cached_property
     def homepages(self):
         "Tuple of homepages"

diff --git a/gpackages/libs/repo_info.py b/gpackages/libs/package_info/repo_info.py
similarity index 100%
rename from gpackages/libs/repo_info.py
rename to gpackages/libs/package_info/repo_info.py

diff --git a/gpackages/libs/use_info.py b/gpackages/libs/package_info/use_info.py
similarity index 100%
rename from gpackages/libs/use_info.py
rename to gpackages/libs/package_info/use_info.py

diff --git a/gpackages/libs/validators.py b/gpackages/libs/package_info/validators.py
similarity index 100%
rename from gpackages/libs/validators.py
rename to gpackages/libs/package_info/validators.py

diff --git a/gpackages/main/settings.py b/gpackages/main/settings.py
index bda45fd..9c4834b 100644
--- a/gpackages/main/settings.py
+++ b/gpackages/main/settings.py
@@ -162,6 +162,8 @@ LOGGING = {
     }
 }
 
+PACKAGE_INFO_BACKEND = 'portage'
+
 try:
     from local_settings import *
 except ImportError:


Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
gentoo-x86 commit in www-client/google-chrome: google-chrome-20.0.1132.39_beta143121.ebuild ChangeLog google-chrome-20.0.1132.34_beta141824.ebuild
Next by thread:
gentoo-x86 commit in dev-lang/v8: v8-3.10.8.18.ebuild ChangeLog v8-3.10.8.13.ebuild
Previous by date:
gentoo-x86 commit in www-client/google-chrome: google-chrome-20.0.1132.39_beta143121.ebuild ChangeLog google-chrome-20.0.1132.34_beta141824.ebuild
Next by date:
gentoo-x86 commit in dev-lang/v8: v8-3.10.8.18.ebuild ChangeLog v8-3.10.8.13.ebuild


Updated Jun 26, 2012

Summary: Archive of the gentoo-commits mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.