* [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/
@ 2012-07-18 16:49 André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2012-07-18 16:49 UTC (permalink / raw
To: gentoo-commits
commit: 5cd02da17ef13323aff48dae2d5527396d298211
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Jul 18 16:45:30 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Jul 18 16:45:30 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5cd02da1
util, dodir: catch OSError if dir exists
---
roverlay/util.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/roverlay/util.py b/roverlay/util.py
index 2df4845..3f32646 100644
--- a/roverlay/util.py
+++ b/roverlay/util.py
@@ -94,11 +94,16 @@ def sysnop ( nop_returns_success=True, format_str=None ):
# --- end of sysnop (...) ---
def dodir ( directory, mkdir_p=False, **makedirs_kw ):
- if not os.path.isdir ( directory ):
+ if os.path.isdir ( directory ): return True
+ try:
if mkdir_p:
os.makedirs ( directory, **makedirs_kw )
else:
os.mkdir ( directory )
- return True
+ return True
+ except Exception as e:
+ LOGGER.exception ( e )
+ return os.path.isdir ( directory )
+
# --- end of dodir (...) ---
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/
2012-07-30 8:52 [gentoo-commits] proj/R_overlay:master " André Erdmann
@ 2012-07-19 16:53 ` André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2012-07-19 16:53 UTC (permalink / raw
To: gentoo-commits
commit: 2c8f26987ba0e1fe111b45cd2d9566abb69372b9
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul 19 16:52:16 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul 19 16:52:16 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=2c8f2698
packageinfo: compare_version, has_key
---
roverlay/packageinfo.py | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index a2910c5..f9d26d1 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -114,6 +114,38 @@ class PackageInfo ( object ):
return True
# --- end of _writelock_acquire (...) ---
+ def has_key ( self, *keys ):
+ for k in keys:
+ if k not in self._info:
+ # try harder - use get() with fallback value to see if value
+ # can be calculated
+ if self.get ( k, do_fallback=True ) is None:
+ return False
+ return True
+ # --- end of has_key (...) ---
+
+ has = has_key
+
+ def compare_version ( self, other_package ):
+ """Compares the version of two PackageInfo objects.
+ Returns 1 if self's version is higher, -1 if lower and 0 if equal.
+
+ arguments:
+ * other_package --
+ """
+ if other_package is None: return 1
+
+ my_ver = self.get ( 'version', fallback_value=0 )
+ other_ver = other_package.get ( 'version', fallback_value=0 )
+
+ if my_ver > other_ver:
+ return 1
+ elif my_ver == other_ver:
+ return 0
+ else:
+ return -1
+ # --- end of compare_version (...) ---
+
def get ( self, key, fallback_value=None, do_fallback=False ):
"""Returns the value specified by key.
The value is either calculated or taken from dict self._info.
@@ -172,7 +204,7 @@ class PackageInfo ( object ):
# fallback
- if do_fallback:
+ if do_fallback or fallback_value is not None:
return fallback_value
elif key_low in self.__class__.ALWAYS_FALLBACK:
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/
@ 2012-07-24 16:59 André Erdmann
2012-07-30 8:52 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
0 siblings, 1 reply; 5+ messages in thread
From: André Erdmann @ 2012-07-24 16:59 UTC (permalink / raw
To: gentoo-commits
commit: 6593a3562703348b5008847d92e820a75efaf921
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 24 16:56:54 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 24 16:56:54 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6593a356
PackageInfo: _remove_auto:ebuild_written, fix get
geändert: roverlay/packageinfo.py
---
roverlay/packageinfo.py | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 829b798..07b2e77 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -183,8 +183,9 @@ class PackageInfo ( object ):
# this doesn't work if the package is in a sub directory
# of the repo's distdir
return self._info ['origin'].distdir
- else:
+ elif 'package_file' in self._info:
return os.path.dirname ( self._info ['package_file'] )
+ # else fallback/KeyError
elif key_low == 'has_suggests':
# 'has_suggests' not in self._info -> assume False
@@ -234,6 +235,12 @@ class PackageInfo ( object ):
# --- end of __setitem__ (...) ---
def update_now ( self, **info ):
+ """Updates the package info data with temporarily enabling write access.
+ Data will be readonly after calling this method.
+
+ arguments:
+ * **info --
+ """
if len ( info ) == 0: return
with self._update_lock:
self.set_writeable()
@@ -374,7 +381,27 @@ class PackageInfo ( object ):
after entering status 'ebuild_status' (like ebuild in overlay and
written -> don't need the ebuild string etc.)
"""
- print ( "PackageInfo._remove_auto: method stub, request ignored." )
+ with self._update_lock:
+
+ if ebuild_status == 'ebuild_written':
+ # selectively copying required keys to a new info dict
+
+ to_keep = ( 'distdir', 'desc_data', 'ebuild_file', 'version' )
+
+ # needs python >= 2.7
+ info_new = { k : self.get ( k ) for k in to_keep }
+
+ # also add an ebuild stub to the new dict (workaround, FIXME)
+ info_new ['ebuild'] = True
+
+ if 'physical_only' in self._info:
+ info_new ['physical_only'] = self._info ['physical_only']
+
+ info_old = self._info
+ self._info = info_new
+ del info_old
+ # -- if
+ # -- lock
# --- end of _remove_auto (...) ---
def _use_filepath ( self, _filepath ):
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:master commit in: roverlay/
2012-07-24 16:59 [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/ André Erdmann
@ 2012-07-30 8:52 ` André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2012-07-30 8:52 UTC (permalink / raw
To: gentoo-commits
commit: 6593a3562703348b5008847d92e820a75efaf921
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 24 16:56:54 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 24 16:56:54 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6593a356
PackageInfo: _remove_auto:ebuild_written, fix get
geändert: roverlay/packageinfo.py
---
roverlay/packageinfo.py | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 829b798..07b2e77 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -183,8 +183,9 @@ class PackageInfo ( object ):
# this doesn't work if the package is in a sub directory
# of the repo's distdir
return self._info ['origin'].distdir
- else:
+ elif 'package_file' in self._info:
return os.path.dirname ( self._info ['package_file'] )
+ # else fallback/KeyError
elif key_low == 'has_suggests':
# 'has_suggests' not in self._info -> assume False
@@ -234,6 +235,12 @@ class PackageInfo ( object ):
# --- end of __setitem__ (...) ---
def update_now ( self, **info ):
+ """Updates the package info data with temporarily enabling write access.
+ Data will be readonly after calling this method.
+
+ arguments:
+ * **info --
+ """
if len ( info ) == 0: return
with self._update_lock:
self.set_writeable()
@@ -374,7 +381,27 @@ class PackageInfo ( object ):
after entering status 'ebuild_status' (like ebuild in overlay and
written -> don't need the ebuild string etc.)
"""
- print ( "PackageInfo._remove_auto: method stub, request ignored." )
+ with self._update_lock:
+
+ if ebuild_status == 'ebuild_written':
+ # selectively copying required keys to a new info dict
+
+ to_keep = ( 'distdir', 'desc_data', 'ebuild_file', 'version' )
+
+ # needs python >= 2.7
+ info_new = { k : self.get ( k ) for k in to_keep }
+
+ # also add an ebuild stub to the new dict (workaround, FIXME)
+ info_new ['ebuild'] = True
+
+ if 'physical_only' in self._info:
+ info_new ['physical_only'] = self._info ['physical_only']
+
+ info_old = self._info
+ self._info = info_new
+ del info_old
+ # -- if
+ # -- lock
# --- end of _remove_auto (...) ---
def _use_filepath ( self, _filepath ):
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/
2012-07-30 8:52 André Erdmann
@ 2012-07-30 8:52 ` André Erdmann
0 siblings, 0 replies; 5+ messages in thread
From: André Erdmann @ 2012-07-30 8:52 UTC (permalink / raw
To: gentoo-commits
commit: 370d65c3ceef9ad482e13b4e9fbd98fe2a752b1a
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jul 30 08:40:36 2012 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jul 30 08:40:36 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=370d65c3
fix <str>.format() in packageinfo
---
roverlay/packageinfo.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 07b2e77..731b62c 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -345,7 +345,7 @@ class PackageInfo ( object ):
# TODO: discard or continue with bad version?
logging.error (
"Cannot parse version string {!r} for {!r}".format (
- ( _filename, version_str )
+ _filename, version_str
)
)
raise
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-30 8:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24 16:59 [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/ André Erdmann
2012-07-30 8:52 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
-- strict thread matches above, loose matches on Subject: below --
2012-07-30 8:52 André Erdmann
2012-07-30 8:52 ` [gentoo-commits] proj/R_overlay:overlay_wip " André Erdmann
2012-07-30 8:52 [gentoo-commits] proj/R_overlay:master " André Erdmann
2012-07-19 16:53 ` [gentoo-commits] proj/R_overlay:overlay_wip " André Erdmann
2012-07-18 16:49 André Erdmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox