* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/libs/package_info/package_backends/
@ 2012-06-22 0:02 Slava Bacherikov
0 siblings, 0 replies; 4+ messages in thread
From: Slava Bacherikov @ 2012-06-22 0:02 UTC (permalink / raw
To: gentoo-commits
commit: ada7b1719ea4b37d3a9aba0eabad7e7e11d65761
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jun 21 14:56:30 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jun 21 14:56:30 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=ada7b171
Add slots and some properties to pkgcore backend
---
.../libs/package_info/package_backends/pkgcore.py | 27 +++++++++++++++++--
1 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/gpackages/libs/package_info/package_backends/pkgcore.py b/gpackages/libs/package_info/package_backends/pkgcore.py
index 1833efd..79e7375 100644
--- a/gpackages/libs/package_info/package_backends/pkgcore.py
+++ b/gpackages/libs/package_info/package_backends/pkgcore.py
@@ -81,6 +81,8 @@ class PortTree(PortTreeMixin):
class Category(CategoryMixin):
+ __slots__ = ('_repo_obj', 'name')
+
def __init__(self, category_name, repo_obj):
self._repo_obj = repo_obj
self.name = category_name
@@ -101,6 +103,8 @@ class Category(CategoryMixin):
return self._repo_obj._versions[(self.name, package_name)]
class Package(PackageMixin):
+
+ __slots__ = ('name', 'category_obj')
def __init__(self, package_name, category_obj):
self.name = package_name
@@ -118,12 +122,29 @@ class Package(PackageMixin):
return '%s/%s' % (self.category_obj.name, self.name)
+ebuild_prop = lambda var: property(lambda self: getattr(self._ebuild, var))
+
class Ebuild(EbuildMixin):
+ __slots__ = ('_ebuild', 'package_obj')
+
def __init__(self, ebuild, package_obj):
self._ebuild = ebuild
self.package_obj = package_obj
- @property
- def cpv(self):
- return self._ebuild.cpvstr
+ ebuild_path = ebuild_prop('path')
+
+ version = ebuild_prop('version')
+
+ revision = ebuild_prop('revision')
+
+ fullversion = ebuild_prop('fullver')
+
+ eapi = ebuild_prop('eapi')
+
+ slot = ebuild_prop('slot')
+
+ # Maybe homepage_val ?
+ homepage = ebuild_prop('homepage')
+
+ cpv = ebuild_prop('cpvstr')
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/libs/package_info/package_backends/
@ 2012-06-22 0:15 Slava Bacherikov
0 siblings, 0 replies; 4+ messages in thread
From: Slava Bacherikov @ 2012-06-22 0:15 UTC (permalink / raw
To: gentoo-commits
commit: cdb05942e13b61385180882e0a966a58489204f0
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Fri Jun 22 00:15:21 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Fri Jun 22 00:15:21 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=cdb05942
Change in backend loading
---
.../libs/package_info/package_backends/__init__.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/gpackages/libs/package_info/package_backends/__init__.py b/gpackages/libs/package_info/package_backends/__init__.py
index 5b2b89b..559d9e7 100644
--- a/gpackages/libs/package_info/package_backends/__init__.py
+++ b/gpackages/libs/package_info/package_backends/__init__.py
@@ -7,7 +7,7 @@ def import_backend(backend):
backend_module = __import__(__name__, fromlist=[backend], level = 0)
return backend_module
-def get_backend():
+def get_backend_name():
backend = DEFAULT_BACKEND
try:
from main import settings
@@ -19,7 +19,9 @@ def get_backend():
backend = settings.PACKAGE_INFO_BACKEND
except AttributeError:
pass
+ return backend
+def load_backend(backend):
try:
backend_module = import_backend(backend)
except ImportError:
@@ -32,3 +34,7 @@ def get_backend():
portage = backend_module.Portage()
return portage
+
+def get_backend():
+ backend = get_backend_name()
+ return load_backend(backend)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/libs/package_info/package_backends/
@ 2012-08-07 0:10 Slava Bacherikov
0 siblings, 0 replies; 4+ messages in thread
From: Slava Bacherikov @ 2012-08-07 0:10 UTC (permalink / raw
To: gentoo-commits
commit: 21a8e669ca68eca68e0956f8f3f89728aff9f31e
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Mon Aug 6 14:27:59 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Mon Aug 6 14:27:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=21a8e669
Add properties for access to info about depends
---
.../libs/package_info/package_backends/pkgcore.py | 12 ++++++++++++
.../libs/package_info/package_backends/portage.py | 16 ++++++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/gpackages/libs/package_info/package_backends/pkgcore.py b/gpackages/libs/package_info/package_backends/pkgcore.py
index 2ad6b69..f84a712 100644
--- a/gpackages/libs/package_info/package_backends/pkgcore.py
+++ b/gpackages/libs/package_info/package_backends/pkgcore.py
@@ -201,3 +201,15 @@ class Ebuild(EbuildMixin):
def is_hard_masked(self):
return self.package_obj.category_obj._repo_obj. \
porttree.is_masked(self._ebuild)
+
+ @property
+ def depends(self):
+ return str(self._ebuild.depends)
+
+ @property
+ def rdepends(self):
+ return str(self._ebuild.rdepends)
+
+ @property
+ def pdepends(self):
+ return str(self._ebuild.post_rdepends)
diff --git a/gpackages/libs/package_info/package_backends/portage.py b/gpackages/libs/package_info/package_backends/portage.py
index e3707d4..f707fe9 100644
--- a/gpackages/libs/package_info/package_backends/portage.py
+++ b/gpackages/libs/package_info/package_backends/portage.py
@@ -154,8 +154,8 @@ class Ebuild(EbuildMixin):
__slots__ = ('package', 'ebuild', 'cpv_object', '_cache', '_env',
'_is_valid')
- ENV_NEED = set(['KEYWORDS', 'HOMEPAGE', 'LICENSE',
- 'DESCRIPTION', 'EAPI', 'SLOT'])
+ ENV_NEED = set(['KEYWORDS', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION', 'EAPI',
+ 'SLOT', 'DEPEND', 'RDEPEND', 'PDEPEND'])
ENV_VARS = PORTDB._aux_cache_keys | ENV_NEED
@@ -192,6 +192,18 @@ class Ebuild(EbuildMixin):
return self._env.get("KEYWORDS")
@property
+ def depends(self):
+ return self._env.get("DEPEND")
+
+ @property
+ def rdepends(self):
+ return self._env.get("RDEPEND")
+
+ @property
+ def pdepends(self):
+ return self._env.get("PDEPEND")
+
+ @property
def is_valid(self):
"Check if ebuild is valid"
return self._is_valid
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/libs/package_info/package_backends/
@ 2012-08-11 22:30 Slava Bacherikov
0 siblings, 0 replies; 4+ messages in thread
From: Slava Bacherikov @ 2012-08-11 22:30 UTC (permalink / raw
To: gentoo-commits
commit: aa0215920032ef0a139e1c7b56db4d9ec426e726
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Sat Aug 11 15:07:35 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Sat Aug 11 15:07:35 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=aa021592
Changes in pkgcore backend
---
.../libs/package_info/package_backends/pkgcore.py | 28 ++++++++++----------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/gpackages/libs/package_info/package_backends/pkgcore.py b/gpackages/libs/package_info/package_backends/pkgcore.py
index f84a712..c312817 100644
--- a/gpackages/libs/package_info/package_backends/pkgcore.py
+++ b/gpackages/libs/package_info/package_backends/pkgcore.py
@@ -1,6 +1,6 @@
from __future__ import absolute_import
import os.path
-from pkgcore.config import load_config
+from pkgcore.config import load_config, errors
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
@@ -26,7 +26,7 @@ class Portage(PortageMixin):
domain = self._domains[domain_name]
except KeyError:
raise ValueError("Bad domain name - '%s'" % domain_name)
- finally:
+ else:
self._domain = domain
self._mask = generate_unmasking_restrict(domain.profile.masks)
@@ -125,37 +125,37 @@ class Category(CategoryMixin):
class Package(PackageMixin):
- __slots__ = ('name', 'category_obj')
+ __slots__ = ('name', 'category')
- def __init__(self, package_name, category_obj):
+ def __init__(self, package_name, category):
self.name = package_name
- self.category_obj = category_obj
+ self.category = category
def iter_ebuilds(self):
- for ebuild in self.category_obj._repo_obj._itermatch(atom(self.cp)):
+ for ebuild in self.category._repo_obj._itermatch(atom(self.cp)):
yield Ebuild(ebuild, self)
def _get_ebuilds_versions(self):
- return self.category_obj._get_ebuilds_names_by_name(self.name)
+ return self.category._get_ebuilds_names_by_name(self.name)
@property
def cp(self):
- return '%s/%s' % (self.category_obj.name, self.name)
+ return '%s/%s' % (self.category.name, self.name)
@property
def package_path(self):
- return os.path.join(self.category_obj.category_path, self.name)
+ return os.path.join(self.category.category_path, self.name)
ebuild_prop = lambda var: property(lambda self: getattr(self._ebuild, var))
class Ebuild(EbuildMixin):
- __slots__ = ('_ebuild', 'package_obj')
+ __slots__ = ('_ebuild', 'package')
- def __init__(self, ebuild, package_obj):
+ def __init__(self, ebuild, package):
self._ebuild = ebuild
- self.package_obj = package_obj
+ self.package = package
ebuild_path = ebuild_prop('path')
@@ -167,7 +167,7 @@ class Ebuild(EbuildMixin):
if self._ebuild.revision is None:
return ''
else:
- return self._ebuild.revision
+ return 'r' + str(self._ebuild.revision)
fullversion = ebuild_prop('fullver')
@@ -199,7 +199,7 @@ class Ebuild(EbuildMixin):
@property
def is_hard_masked(self):
- return self.package_obj.category_obj._repo_obj. \
+ return self.package.category._repo_obj. \
porttree.is_masked(self._ebuild)
@property
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-11 22:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-07 0:10 [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/libs/package_info/package_backends/ Slava Bacherikov
-- strict thread matches above, loose matches on Subject: below --
2012-08-11 22:30 Slava Bacherikov
2012-06-22 0:15 Slava Bacherikov
2012-06-22 0:02 Slava Bacherikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox