* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/
@ 2011-03-14 16:24 Zac Medico
0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-03-14 16:24 UTC (permalink / raw
To: gentoo-commits
commit: b0115fb837bf197c64bb686ba6cf94aa52465379
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 2 17:59:11 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 16:03:20 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b0115fb8
grablines: allow inline comments
---
pym/portage/util/__init__.py | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index f31f33d..8b27be5 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -125,8 +125,18 @@ def grabfile(myfilename, compat_level=0, recursive=0, remember_source_file=False
for x, source_file in mylines:
#the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line
#into single spaces.
- myline = _unicode_decode(' ').join(x.split())
- if not len(myline):
+ myline = x.split()
+ if x and x[0] != "#":
+ mylinetemp = []
+ for item in myline:
+ if item[:1] != "#":
+ mylinetemp.append(item)
+ else:
+ break
+ myline = mylinetemp
+
+ myline = " ".join(myline)
+ if not myline:
continue
if myline[0]=="#":
# Check if we have a compat-level string. BC-integration data.
@@ -316,7 +326,7 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
myline=x.split()
mylinetemp = []
for item in myline:
- if not item.startswith('#'):
+ if item[:1] != "#":
mylinetemp.append(item)
else:
break
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/
@ 2011-03-14 16:24 Zac Medico
0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-03-14 16:24 UTC (permalink / raw
To: gentoo-commits
commit: bd20421195bfc73789494759c4a43617fdc66ce6
Author: Theo Chatzimichos <tampakrap <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 2 17:39:56 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 16:03:12 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bd204211
grabdict: allow inline comments
---
pym/portage/util/__init__.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 55ffcfc..f31f33d 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -314,6 +314,13 @@ def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
if x[0] == "#":
continue
myline=x.split()
+ mylinetemp = []
+ for item in myline:
+ if not item.startswith('#'):
+ mylinetemp.append(item)
+ else:
+ break
+ myline = mylinetemp
if len(myline) < 2 and empty == 0:
continue
if len(myline) < 1 and empty == 1:
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/
@ 2011-03-26 19:31 Zac Medico
0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-03-26 19:31 UTC (permalink / raw
To: gentoo-commits
commit: 04c3783fe1287a8db510d19a35936c0f0af67434
Author: David James <davidjames <AT> google <DOT> com>
AuthorDate: Fri Mar 25 17:10:54 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 19:22:24 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=04c3783f
env_update: remove sleep_for_mtime_granularity
Instead of sleeping, use os.utime to avoid mtime ambiguity.
Change-Id: I359ececca19b6be9f5997ac5c8fe6fea6ea49dd5
Review URL: http://codereview.chromium.org/6676150
---
pym/portage/util/env_update.py | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 68531da..e2cb97f 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -181,11 +181,6 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
newprelink.write("-b %s\n" % (x,))
newprelink.close()
- # Portage stores mtimes with 1 second granularity but in >=python-2.5 finer
- # granularity is possible. In order to avoid the potential ambiguity of
- # mtimes that differ by less than 1 second, sleep here if any of the
- # directories have been modified during the current second.
- sleep_for_mtime_granularity = False
current_time = long(time.time())
mtime_changed = False
lib_dirs = set()
@@ -205,8 +200,13 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
continue
raise
if newldpathtime == current_time:
- sleep_for_mtime_granularity = True
- if x in prev_mtimes:
+ # Reset mtime to avoid the potential ambiguity of times that
+ # differ by less than 1 second.
+ newldpathtime -= 1
+ os.utime(x, (newldpathtime, newldpathtime))
+ prev_mtimes[x] = newldpathtime
+ mtime_changed = True
+ elif x in prev_mtimes:
if prev_mtimes[x] == newldpathtime:
pass
else:
@@ -287,7 +287,3 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
for x in env_keys:
outfile.write("setenv %s '%s'\n" % (x, env[x]))
outfile.close()
-
- if sleep_for_mtime_granularity:
- while current_time == long(time.time()):
- time.sleep(1)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/
@ 2011-05-26 6:18 Zac Medico
0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26 6:18 UTC (permalink / raw
To: gentoo-commits
commit: 272c1b19b0ab5681c566d8984cfaad1dba9df9fa
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 15 04:39:26 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 02:50:54 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=272c1b19
movefile: handle EEXIST when os.symlink fails
---
pym/portage/util/movefile.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/pym/portage/util/movefile.py b/pym/portage/util/movefile.py
index f8cc695..e07e8ca 100644
--- a/pym/portage/util/movefile.py
+++ b/pym/portage/util/movefile.py
@@ -90,7 +90,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None,
# to tolerate these links being recreated during the merge
# process. In any case, if the link is pointing at the right
# place, we're in good shape.
- if e.errno != errno.ENOENT or target != os.readlink(dest):
+ if e.errno not in (errno.ENOENT, errno.EEXIST) or \
+ target != os.readlink(dest):
raise
lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
# utime() only works on the target of a symlink, so it's not
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/
@ 2011-05-26 6:18 Zac Medico
0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26 6:18 UTC (permalink / raw
To: gentoo-commits
commit: b4e3696832da26b5394867f239694ea133272faf
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 18 01:43:32 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 03:11:27 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b4e36968
digraph: implement __bool__
---
pym/portage/util/digraph.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/pym/portage/util/digraph.py b/pym/portage/util/digraph.py
index df024fb..1bbe10f 100644
--- a/pym/portage/util/digraph.py
+++ b/pym/portage/util/digraph.py
@@ -1,9 +1,11 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ['digraph']
from collections import deque
+import sys
+
from portage import _unicode_decode
from portage.util import writemsg
@@ -221,6 +223,9 @@ class digraph(object):
root_nodes.append(node)
return root_nodes
+ def __bool__(self):
+ return bool(self.nodes)
+
def is_empty(self):
"""Checks if the digraph is empty"""
return len(self.nodes) == 0
@@ -332,3 +337,6 @@ class digraph(object):
__contains__ = contains
empty = is_empty
copy = clone
+
+ if sys.hexversion < 0x3000000:
+ __nonzero__ = __bool__
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/
@ 2011-05-26 6:18 Zac Medico
0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26 6:18 UTC (permalink / raw
To: gentoo-commits
commit: af02772f2235bb37858f563f34ecf0132b89c38e
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 04:52:40 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=af02772f
atomic_ofstream: suppress redundant open error
---
pym/portage/util/__init__.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 43ff98e..7d071e4 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1090,9 +1090,9 @@ class atomic_ofstream(ObjectProxy):
except IOError as e:
if canonical_path == filename:
raise
- writemsg(_("!!! Failed to open file: '%s'\n") % tmp_name,
- noiselevel=-1)
- writemsg("!!! %s\n" % str(e), noiselevel=-1)
+ # Ignore this error, since it's irrelevant
+ # and the below open call will produce a
+ # new error if necessary.
object.__setattr__(self, '_real_name', filename)
tmp_name = "%s.%i" % (filename, os.getpid())
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/
@ 2011-05-26 6:18 Zac Medico
0 siblings, 0 replies; 7+ messages in thread
From: Zac Medico @ 2011-05-26 6:18 UTC (permalink / raw
To: gentoo-commits
commit: 689fd034c812c7a64be64f34b50026472d766579
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 04:55:59 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 26 06:12:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=689fd034
writedict: raise any exceptions
We don't have any code that checks the writedict return value, so we'd
better raise an exception if it fails.
---
pym/portage/util/__init__.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 7d071e4..60b9575 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -470,8 +470,7 @@ def writedict(mydict,myfilename,writekey=True):
except IOError:
if myfile is not None:
myfile.abort()
- return 0
- return 1
+ raise
def shlex_split(s):
"""
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-05-26 6:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-26 6:18 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/util/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2011-05-26 6:18 Zac Medico
2011-05-26 6:18 Zac Medico
2011-05-26 6:18 Zac Medico
2011-03-26 19:31 Zac Medico
2011-03-14 16:24 Zac Medico
2011-03-14 16:24 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox