[SciPy-dev] Re: scipy_distutils under cygwin using DF

Berthold Höllmann hoel at gl-group.com
Mon Mar 29 04:10:31 EST 2004


Pearu Peterson <pearu at scipy.org> writes:

> On Fri, 26 Mar 2004, [ISO-8859-15] Berthold Höllmann wrote:
>
>> I did a "cvs update" in scipy and "python setup.py install" in
>> scipy_core but still get
>> 
<snip>
>> make: *** [build] Error 1
>
> Hmm, not sure what is going on here. Could you try running the 
> exec_command.py tests? Just execute
>
>   python exec_command.py

hoel at PC021358 ~/unix/work/CVS/scipy/scipy_core/scipy_distutils
$ python exec_command.py
splitcmdline('a   b  cc')
splitcmdline('a')
splitcmdline('a "  b  cc"')
splitcmdline('"a bcc"  -h')
splitcmdline('"\\"a \\" bcc" -h')
splitcmdline(" 'a bcc'  -h")
splitcmdline("'\\'a \\' bcc' -h")
Using cygwin echo in win32 environment is not supported
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'AAA\',\'\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'AAA\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'BBB\',\'\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'BBB\',\'\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'BBB\',\'\')"')
splitcmdline('echo path=%path%')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import sys;sys.stderr.write(sys.platform)"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "raise \'Ignore me.\'"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import sys;sys.stderr.write(\'0\');sys.stderr.write(\'1\');sys.stderr.write(\'2\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import sys;sys.exit(15)"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "print \'Heipa\'"')
ok
Using cygwin echo in win32 environment is not supported
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'AAA\',\'\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'AAA\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'BBB\',\'\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'BBB\',\'\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import os;print os.environ.get(\'BBB\',\'\')"')
splitcmdline('echo path=%path%')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import sys;sys.stderr.write(sys.platform)"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "raise \'Ignore me.\'"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import sys;sys.stderr.write(\'0\');sys.stderr.write(\'1\');sys.stderr.write(\'2\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "import sys;sys.exit(15)"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "print \'Heipa\'"')
ok
splitcmdline('c:\\Python23\\PYTHON.EXE -c "print \'Ignore the following IOError:\',open(\'tmp0b66sb\',\'r\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "print open(\'tmp0b66sb\',\'r\').read()"')
ok
splitcmdline('c:\\Python23\\PYTHON.EXE -c "print \'Ignore the following IOError:\',open(\'tmp0zwgk-\',\'r\')"')
splitcmdline('c:\\Python23\\PYTHON.EXE -c "print open(\'tmp0zwgk-\',\'r\').read()"')
ok
Could not locate executable svn
Executable svn does not exist

>
> in scipy_distutils/ directory. There is a function test_svn() that I used 
> to test exec_command on commands having spaces in their paths (`svn` just 
> happened to be such a one in my system). You can play with
>
>   python -c "from exec_command import *;exec_command(['DF','/what'])"

hoel at PC021358 ~/unix/work/CVS/scipy/scipy_core/scipy_distutils
$ python -c "from exec_command import * ; exec_command(['DF','/what'])"

hoel at PC021358 ~/unix/work/CVS/scipy/scipy_core/scipy_distutils
$ python -c "from exec_command import * ; print exec_command(['DF','/what'])"
(999, '[Errno 22] Invalid argument: c:\\Programme\\Microsoft Visual Studio\\DF98\\bin\\DF.exe')


>
> and the code starting at line #397 in exec_command.py to find out what is 
> going on.
>
>> My cygwin does find the DF executable:
>> 
>> hoel at PC021358 ~/work/GLPy/test
>> $ DF /what
>> Compaq Visual Fortran Optimizing Compiler Version 6.1 (Update A)
>> Copyright 2000 Compaq Computer Corp. All rights reserved.
>> 
>> Compaq Visual Fortran 6.1-970-42A1L
>> c:\Programme\Microsoft Visual Studio\DF98\bin\decfor90.exe
>> 
>> hoel at PC021358 ~/work/GLPy/test
>> $ which DF
>> /cygdrive/c/Programme/Microsoft Visual Studio/DF98/bin/DF
>
> That's interesting. Try to replace the following line
>
>   return exe
>
> in find_executable() with
>
>   return os.path.realpath(exe)

after some fiddeling, the following does work for me under Win XP,
cygwin, using the Enthought Python. cygwin python does return "posix"
for "os.name" so the 'argv = [os.environ['COMSPEC'],'/C']+argv' part
could be OK:

Index: scipy_core/scipy_distutils/exec_command.py
===================================================================
RCS file: /home/cvsroot/world/scipy_core/scipy_distutils/exec_command.py,v
retrieving revision 1.17
diff -r1.17 exec_command.py
150c150
<                 return f_ext
---
>                 return os.path.realpath(f_ext)
153c153
<     return exe
---
>     return os.path.realpath(exe)
364c364
<         argv[0] = find_executable(argv[0])
---
>         argv[0] = quote_arg(find_executable(argv[0]))
367,370c367,370
<             if os.name in ['nt','dos']:
<                 # argv[0] might be internal command
<                 argv = [os.environ['COMSPEC'],'/C']+argv
<                 using_command = 1
---
>         if os.name in ['nt','dos']:
>             # argv[0] might be internal command
>             argv = [os.environ['COMSPEC'],'/C']+argv
>             using_command = 1
397,398d396
<     argv0 = quote_arg(argv[0])
< 
400c398
<         status = spawn_command(os.P_WAIT,argv0,argv,os.environ)
---
>         status = spawn_command(os.P_WAIT,argv[0],argv,os.environ)


This version also works for me on Solaris and Linux with Python 2.2.1,
and distutils from 2.3.3 replacing the original one.

Kind regards

Berthold Höllmann
-- 
Germanischer Lloyd AG
CAE Development
Vorsetzen 35
20459 Hamburg
Phone: +49(0)40 36149-7374
Fax: +49(0)40 36149-7320
e-mail: hoel at gl-group.com
Internet: http://www.gl-group.com 
 
 
 
This e-mail contains confidential information for the exclusive attention of the intended addressee. Any access of third parties to this e-mail is unauthorised. Any use of this e-mail by unintended recipients such as copying, distribution, disclosure etc. is prohibited and may be unlawful. When addressed to our clients the content of this e-mail is subject to the General Terms and Conditions of GL's Group of Companies applicable at the date of this e-mail.  
 
GL's Group of Companies does not warrant and/or guarantee that this message at the moment of receipt is authentic, correct and its communication free of errors, interruption etc.  
 


More information about the SciPy-Dev mailing list