diff options
author | Alexander Belchenko <bialix@ukr.net> | 2006-08-11 18:15:02 +0300 |
---|---|---|
committer | Alexander Belchenko <bialix@ukr.net> | 2006-08-11 18:15:02 +0300 |
commit | ceddaf2589e8111671f10ed92fa45bd0a2c34845 (patch) | |
tree | 148f3a862fc6754eb994b11d1e70905f9b378bc8 | |
parent | 6fb3c0b6a0d6695c9678ee810977a3fe79fc288a (diff) | |
download | bugseverywhere-ceddaf2589e8111671f10ed92fa45bd0a2c34845.tar.gz |
don't use std. commands module 'cause it's Linux-only. Grab code from this module and adapt it to win32
-rw-r--r-- | libbe/names.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libbe/names.py b/libbe/names.py index cbcfbf8..d2e077a 100644 --- a/libbe/names.py +++ b/libbe/names.py @@ -14,13 +14,21 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -import commands + import os import sys def uuid(): - return commands.getoutput('uuidgen') + # this code borrowed from standard commands module + # but adapted to win32 + pipe = os.popen('uuidgen', 'r') + text = pipe.read() + sts = pipe.close() + if sts not in (0, None): + raise "Failed to run uuidgen" + if text[-1:] == '\n': text = text[:-1] + return text def creator(): if sys.platform != "win32": |