implement Menno's fix for Mac OSX

This commit is contained in:
Kilian Valkhof 2010-03-24 12:51:26 +01:00
parent 70181f97ef
commit 19308292c0

View file

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
import sys import sys
import errno
from os import listdir from os import listdir
from os import path from os import path
from subprocess import call, PIPE from subprocess import call, PIPE
@ -203,22 +204,31 @@ class StartQT4(QMainWindow):
def checkapps(self): def checkapps(self):
"""Check if the required command line apps exist.""" """Check if the required command line apps exist."""
status = False status = False
retcode = call("jpegoptim --version", shell=True, stdout=PIPE) retcode = self.safe_call("jpegoptim --version")
if retcode != 0: if retcode != 0:
status = True status = True
sys.stderr.write("[error] please install jpegoptim") sys.stderr.write("[error] please install jpegoptim")
retcode = call("optipng -v", shell=True, stdout=PIPE) retcode = self.safe_call("optipng -v")
if retcode != 0: if retcode != 0:
status = True status = True
sys.stderr.write("[error] please install optipng") sys.stderr.write("[error] please install optipng")
retcode = call("advpng --version", shell=True, stdout=PIPE) retcode = self.save_call("advpng --version")
if retcode != 0: if retcode != 0:
status = True status = True
sys.stderr.write("[error] please install advancecomp") sys.stderr.write("[error] please install advancecomp")
return status return status
def safe_call(self, command):
while True:
try:
return call(command, shell=True, stdout=PIPE)
except OSError, e:
if e.errno == errno.EINTR:
continue
else:
raise
class TriTableModel(QAbstractTableModel): class TriTableModel(QAbstractTableModel):