Permalink
Browse files

setup.py: launch `pyuic4` with 'sh -c' to work around old pyuic4 bugs

Older versions of pyuic4 were implemented as a shell script instead
of as python script.  Interestingly, an older version existed
that didn't have a '#!/bin/sh' shebang line.

Use 'sh -c' to accomodate both current and older, buggy pyuic4s.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information...
1 parent c3830cf commit 9751d6c8ee0811f40eb7727e8503c4a723a92810 @davvid davvid committed Jun 14, 2009
Showing with 7 additions and 5 deletions.
  1. +7 −5 setup.py
View
@@ -120,7 +120,10 @@ def _check_pyqt_version():
"""
failed = False
try:
- pyqtver = _run_cmd(['pyuic4', '--version']).split()[-1]
+ # We avoid utils.run_cmd() because older versions of
+ # pyuic4 were implemented as a shell script with a missing
+ # #!/bin/sh line.
+ pyqtver = _run_cmd('sh -c "pyuic4 --version"').split()[-1]
except IndexError:
pyqtver = 'nothing'
failed = True
@@ -174,10 +177,9 @@ def _build_translations():
print '\tmsgfmt --qt %s -o %s' % (src, dst)
utils.run_cmd('msgfmt', '--qt', src, '-o', dst)
-def _run_cmd(args):
- """Runs a command and returns its output"""
- argstr = utils.shell_quote(*args)
- pipe = os.popen(argstr)
+def _run_cmd(cmd):
+ """Runs a command and returns its output."""
+ pipe = os.popen(cmd)
contents = core.read_nointr(pipe).strip()
pipe.close()
return contents

0 comments on commit 9751d6c

Please sign in to comment.