Skip to content

Commit 13ab3f2

Browse files
committed
Python 3 fixes and also less verbose output
1 parent a0fd0d3 commit 13ab3f2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mbed/mbed.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ def log(msg, is_error=False):
157157
sys.stderr.write(msg) if is_error else sys.stdout.write(msg)
158158

159159
def message(msg):
160-
return "[mbed-%s] %s\n" % (os.getpid(), msg)
160+
if very_verbose:
161+
return "[mbed-%s] %s\n" % (os.getpid(), msg)
162+
else:
163+
return "[mbed] %s\n" % msg
161164

162165
def info(msg, level=1):
163166
if level <= 0 or verbose:
@@ -1361,7 +1364,7 @@ def cache_lock(self, url):
13611364
if os.path.exists(lock_dir):
13621365
try:
13631366
if os.path.isfile(lock_file):
1364-
with open(lock_file, 'r', 0) as f:
1367+
with open(lock_file, 'r') as f:
13651368
pid = f.read(8)
13661369
if not pid:
13671370
if int(os.path.getmtime(lock_file)) + timeout < int(time.time()):
@@ -1382,7 +1385,7 @@ def cache_lock(self, url):
13821385
else:
13831386
try:
13841387
os.mkdir(lock_dir)
1385-
with open(lock_file, 'wb', 0) as f:
1388+
with open(lock_file, 'w') as f:
13861389
info("Writing cache lock file %s for pid %s" % (lock_file, os.getpid()))
13871390
f.write(str(os.getpid()))
13881391
f.flush()
@@ -1414,7 +1417,7 @@ def cache_unlock(self, url):
14141417
if os.path.exists(lock_dir):
14151418
if os.path.isfile(lock_file):
14161419
try:
1417-
with open(lock_file, 'r', 0) as f:
1420+
with open(lock_file, 'r') as f:
14181421
pid = f.read(8)
14191422
if int(pid) != os.getpid():
14201423
error("Cache lock file exists with a different pid (\"%s\" vs \"%s\")" % (pid, os.getpid()))

0 commit comments

Comments
 (0)