This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Very weird MAKE/PYTHON/ASH problem.


I've got a very weird MAKE/PYTHON/ASH problem.

Synopsis: Python running under Make cannot export a new PATH value unless 
SHELL variable in Make is overridden to something other than "sh.exe"

"Huh?" I hear you say.

Ok, Let's look at this one step at a time. Consider the following Makefile:

    milhouse% cat Makefile
    default:
            python foo.py
    other:
            echo ${SHELL}

And the following Python file.

    milhouse% cat foo.py
    import os, os.path

    os.environ['PATH'] = "/some/junk" + os.pathsep + os.environ['PATH']
    os.environ['PATHX'] = "fooness"

    os.system("printenv")


Now, typing "make" should print an environment in which /some/junk is
prepended to PATH, right? Wrong!

    milhouse% make | egrep '^PATH'
    PATH=/home/stodghil/bib/bin:...
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PATHX=fooness

What gives? I have no idea, but I discovered that overriding Make's SHELL
variable seems to fix the problem. First, here is what Make's SHELL variable
is initially set to

    milhouse% make other
    echo sh.exe
    sh.exe

I tried setting SHELL to /bin/sh, /bin/bash, bash.exe, and sh.exe. Of the
four, the first three work and the last fails.

    milhouse% make SHELL=/bin/sh | egrep '^PATH'
    PATH=/some/junk:/home/stodghil/bib/bin:...
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PATHX=fooness

    milhouse% make SHELL=/bin/bash | egrep '^PATH'
    PATH=/some/junk:/home/stodghil/bib/bin:...
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PATHX=fooness

    milhouse% make SHELL=bash.exe | egrep '^PATH'
    PATH=/some/junk:/home/stodghil/bib/bin:...
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PATHX=fooness

    milhouse% make SHELL=sh.exe | egrep '^PATH'
    PATH=/home/stodghil/bib/bin:...
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PATHX=fooness

Does anyone have any idea what is going wrong?

Thanks.
----
Paul Stodghill <stodghil@cs.cornell.edu>
4128 Upson Hall, Dept of CS, Cornell Univ., Ithaca, NY 14853
http://www.cs.cornell.edu/stodghil/
Voice: 607-254-8838 Fax: 607-255-4428

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]