diff options
author | cookedm <cookedm@localhost> | 2006-01-31 22:49:15 +0000 |
---|---|---|
committer | cookedm <cookedm@localhost> | 2006-01-31 22:49:15 +0000 |
commit | f59515e452a522fb3b4989aada18eb84234bacc0 (patch) | |
tree | 6b1da80bee4bf1840657c2606ea9cc1a75b669e1 /numpy/distutils/exec_command.py | |
parent | c1b9a6e8b560ac77dede465a4c0f527429f24d3d (diff) | |
download | numpy-f59515e452a522fb3b4989aada18eb84234bacc0.tar.gz |
Misc cleanups + replace `a` with %r or repr(a)
Also replace some type checks with misc_util.is_sequence or misc_util.is_string
or appropiate isinstance().
Diffstat (limited to 'numpy/distutils/exec_command.py')
-rw-r--r-- | numpy/distutils/exec_command.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py index 6c5554bba..a44fd9abf 100644 --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -65,7 +65,7 @@ def get_pythonexe(): fdir,fn = os.path.split(pythonexe) fn = fn.upper().replace('PYTHONW','PYTHON') pythonexe = os.path.join(fdir,fn) - assert os.path.isfile(pythonexe),`pythonexe`+' is not a file' + assert os.path.isfile(pythonexe), '%r is not a file' % (pythonexe,) return pythonexe ############################################################ @@ -104,19 +104,19 @@ def splitcmdline(line): def test_splitcmdline(): l = splitcmdline('a b cc') - assert l==['a','b','cc'],`l` + assert l==['a','b','cc'], repr(l) l = splitcmdline('a') - assert l==['a'],`l` + assert l==['a'], repr(l) l = splitcmdline('a " b cc"') - assert l==['a','" b cc"'],`l` + assert l==['a','" b cc"'], repr(l) l = splitcmdline('"a bcc" -h') - assert l==['"a bcc"','-h'],`l` + assert l==['"a bcc"','-h'], repr(l) l = splitcmdline(r'"\"a \" bcc" -h') - assert l==[r'"\"a \" bcc"','-h'],`l` + assert l==[r'"\"a \" bcc"','-h'], repr(l) l = splitcmdline(" 'a bcc' -h") - assert l==["'a bcc'",'-h'],`l` + assert l==["'a bcc'",'-h'], repr(l) l = splitcmdline(r"'\'a \' bcc' -h") - assert l==[r"'\'a \' bcc'",'-h'],`l` + assert l==[r"'\'a \' bcc'",'-h'], repr(l) ############################################################ @@ -340,7 +340,8 @@ def _exec_command_python(command, cmd = '%s %s' % (python_exe, cmdfile) status = os.system(cmd) - assert not status,`cmd`+' failed' + if status: + raise RuntimeError("%r failed" % (cmd,)) os.remove(cmdfile) f = open(stsfile,'r') |