[Pkg-bazaar-commits] ./bzr/unstable r63: fix up uuid command

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:27:12 UTC 2009


------------------------------------------------------------
revno: 63
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-22 18:02:07 +1100
message:
  fix up uuid command
modified:
  bzrlib/commands.py
  bzrlib/osutils.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-03-22 06:55:17 +0000
+++ b/bzrlib/commands.py	2005-03-22 07:02:07 +0000
@@ -438,7 +438,7 @@
 
 def cmd_uuid():
     """Print a newly-generated UUID."""
-    print uuid()
+    print bzrlib.osutils.uuid()
 
 
 

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2005-03-19 01:41:44 +0000
+++ b/bzrlib/osutils.py	2005-03-22 07:02:07 +0000
@@ -86,8 +86,11 @@
     ## XXX: Could alternatively read /proc/sys/kernel/random/uuid on
     ## Linux, but we need something portable for other systems;
     ## preferably an implementation in Python.
-    bailout('uuids not allowed!')
-    return chomp(os.popen('uuidgen').readline())
+    try:
+        return chomp(file('/proc/sys/kernel/random/uuid').readline())
+    except IOError:
+        return chomp(os.popen('uuidgen').readline())
+
 
 def chomp(s):
     if s and (s[-1] == '\n'):



More information about the Pkg-bazaar-commits mailing list