Mercurial > lcfOS
changeset 369:5333318ee33d
Python 3.2 compatible issues
author | Windel Bouwman |
---|---|
date | Fri, 21 Mar 2014 11:54:50 +0100 |
parents | d2ddfe134c48 |
children | f86e79246602 |
files | python/ppci/target/msp430/__init__.py test/testemulation.py |
diffstat | 2 files changed, 13 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/ppci/target/msp430/__init__.py Fri Mar 21 11:54:50 2014 +0100 @@ -0,0 +1,3 @@ + +# Stub to make this a package +
--- a/test/testemulation.py Fri Mar 21 11:21:50 2014 +0100 +++ b/test/testemulation.py Fri Mar 21 11:54:50 2014 +0100 @@ -10,17 +10,17 @@ # Store testdir for safe switch back to directory: testdir = os.path.dirname(os.path.abspath(__file__)) +def tryrm(fn): + try: + os.remove(fn) + except OSError: + pass + def runQemu(kernel, machine='lm3s811evb'): """ Runs qemu on a given kernel file """ - try: - os.remove('qemucontrol.sock') - except FileNotFoundError: - pass - try: - os.remove('qemuserial.sock') - except FileNotFoundError: - pass + tryrm('qemucontrol.sock') + tryrm('qemuserial.sock') # Listen to the control socket: qemu_control_serve = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) @@ -70,15 +70,8 @@ qemu_control_serve.close() qemu_serial_serve.close() - try: - os.remove('qemucontrol.sock') - except FileNotFoundError: - pass - - try: - os.remove('qemuserial.sock') - except FileNotFoundError: - pass + tryrm('qemucontrol.sock') + tryrm('qemuserial.sock') # Check that output was correct: return data