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

Berthold Höllmann hoel at gl-group.com
Wed Mar 31 04:44:47 CST 2004

Pearu Peterson <pearu at scipy.org> writes:

Hallo Pearu,

Thank you foru your prompt replay.

> On Tue, 30 Mar 2004, [ISO-8859-15] Berthold Höllmann wrote:
> Could you test on WinXP what is the result of the following expression
>   os.path.realpath(r'C:\Programme')

I just checke out the latest CVS, and now get:

hoel at PC021358 ~/unix/work/CVS/scipy/scipy_core
$ pwd

hoel at PC021358 ~/unix/work/CVS/scipy/scipy_core
$ ls -l /home/hoel/unix
lrwxrwxrwx    1 hoel     Kein           94 Oct 27 14:52 /home/hoel/unix -> /cygdrive/h

hoel at PC021358 ~/unix/work/CVS/scipy/scipy_core
$ python
Enthought Edition build 1028
Python 2.3 (#46, Aug 11 2003, 09:34:05) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os.path.realpath(r'C:\Programme')
>>> os.path.realpath(r"C:\Programme\Microsoft Visual Studio")
'C:\\Programme\\Microsoft Visual Studio'
>>> os.path.realpath(r"C:\Programme\Microsoft Visual Studio\\")
'C:\\Programme\\Microsoft Visual Studio'
>>> os.path.realpath(r'"C:\Programme\Microsoft Visual Studio\\"')
'h:\\work\\CVS\\scipy\\scipy_core\\"C:\\Programme\\Microsoft Visual Studio\\"'
>>> ^Z

> when python was fired up from the H: disk?

So the problem seems to be, the executable name got quoted to early (I
think this was my fault, I moved "quote_arg" to an too early position,
but on I think now it is called again at a wrong position. What I get
now under WinXP is

customize MSVCCompiler
customize MSVCCompiler using build_clib
customize CompaqVisualFCompiler
customize CompaqVisualFCompiler using build_clib
splitcmdline('DF /what')
running build_ext
No module named msvccompiler
customize MSVCCompiler
customize MSVCCompiler using build_ext
customize CompaqVisualFCompiler
customize CompaqVisualFCompiler using build_ext
splitcmdline('DF /what')
building 'SXFPyBase' extension
compling C sources
C:\Programme\Microsoft Visual Studio\VC98\BIN\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -DDEBUG -DVISUAL_CPLUSPLUS -Ilib\SXFPyBase -I"f:\DATA\FBE\ESC\Devel\include" -Ibuild\src -Ic:\Python23\include-Ic:\Python23\PC /Tcbuild\src\fortranobject.c /Fobuild\temp.win32-2.3\Release\build\src\fortranobject.obj
Could not locate executable "C:\Programme\Microsoft Visual Studio\VC98\BIN\cl.exe"
Executable "C:\Programme\Microsoft Visual Studio\VC98\BIN\cl.exe" does not exist

error: Command ""C:\Programme\Microsoft Visual Studio\VC98\BIN\cl.exe" /c /nologo /Ox /MD /W3 /GX /DNDEBUG -DDEBUG -DVISUAL_CPLUSPLUS -Ilib\SXFPyBase -I"f:\DATA\FBE\ESC\Devel\include" -Ibuild\src -Ic:\Python23\include -Ic:\Python23\PC /Tcbuild\src\fortranobject.c /Fobuild\temp.win32-2.3\Release\build\src\fortranobject.obj" failed with exit status 1
make: *** [build] Error 1

The line after "compling C sources" looks wrong (should'nt the word
"compling" in command/build_clib.py be replaced by "compiling" at 4
instances?) but it comes from CCompiler_spawn and the cl.exe part goes
properly quoted to exec_command. Maybe the "_nt_quote_args" and the
part leading to "log.info" should be exchanged for clarity in

# Using customized CCompiler.spawn.
def CCompiler_spawn(self, cmd, display=None):
    if type(cmd) is type([]) and os.name == 'nt':
        cmd = _nt_quote_args(cmd)
    if display is None:
        display = cmd
        if type(display) is type([]): display = ' '.join(display)
    s,o = exec_command(cmd)
    if s:
        if type(cmd) is type([]):
            cmd = ' '.join(cmd)
        print o
        raise DistutilsExecError,\
              'Command "%s" failed with exit status %d' % (cmd, s)
CCompiler.spawn = new.instancemethod(CCompiler_spawn,None,CCompiler)

Back to my problem: It came out to the definition of the include
directory '-I"f:\DATA\FBE\ESC\Devel\include"'. The execution via
"cmd.exe" does not like the quotes (") around the include path, so I
removed them, just to stumble over the next problem:


as an option to DF is interpreted as
"/iface=\DATA\FBE\ESC\Devel\include" and leads to an syntax error in
DF. Luckily for me, "f:" is a network directory so I can write
"\\Glf\Vol1\...", but I guess a general solution should be found.

> Hmm, Python docs say that  os.path.realpath is available only for Unix. 
> This could provide a fix.
>> ---snip---
>>     s,o=exec_command('echo path=%path%')
>>     log.debug((s,o))
>>     assert s==0 and o!='',(s,o)
>>     s,o=exec_command('%s -c "import sys;sys.stderr.write(sys.platform)"' \
>>                      % pythonexe)
>>     log.debug((s,o))
>>     assert s==0 and o=='win32',(s,o)
>> ---snip---
>> With this I get:
>> ---snip---
>> $ python scipy_distutils/exec_command.py
>> ...
>> AssertionError: (0, 'COMMAND \'c:\\\\Python23\\\\PYTHON.EXE -c "import sys;sys.stderr.write(sys.platform)"\' FAILED: win32')
>> ---snip---
>> The problem is, the test writes to stderr, but a result on stderr
>> leads "_exec_command" to generate the "... FAILED ..."
> I think I have fixed that yesterday.
>> AssertionError: (0, '$AAA')
>> ---snip---
>> which I also don't understand
> Ok, I could reproduce this on Sun and this is now fixed in CVS.

python scipy_distutils/exec_command.py

OK on Linux and Solaris (except for the failing svn test, but I have
no svn installed, so this is expected ;-).

But on WinXP I still get 

hoel at PC021358 ~/unix/work/CVS/scipy/scipy_core
$ python scipy_distutils/exec_command.py
splitcmdline('a   b  cc')
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)"')
Traceback (most recent call last):
  File "scipy_distutils/exec_command.py", line 601, in ?
  File "scipy_distutils/exec_command.py", line 502, in test_nt
    assert s==0 and o=='win32',(s,o)
AssertionError: (0, 'COMMAND \'c:\\\\Python23\\\\PYTHON.EXE -c "import sys;sys.stderr.write(sys.platform)"\' FAILED: win32')
maybe line 502 in exec_command.py could be changed to 

    assert s==0 and o[-5:]=='win32',(s,o)


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