[Scons-users] Question over the use of powershell in env['SHELL'] or some way to force relative paths

RW garlicbready at googlemail.com
Fri Sep 21 12:42:30 EDT 2018


thanks that was just what I needed
the paths are relative in the script, but because the sconscript lives in a
subdir further down
scons decides to use absoloute paths in it's variable expansion of $TARGET
$SOURCES etc

there are several different ports for different hardware platforms such as
micropython/ports/minimal
micropython/ports/stm32
micropython/ports/esp32 etc
which are independent of each other but all use shared sources under
directories such as micropython/lib for example.

I could link all the scripts together so that everything starts at the top
level directory
then use something like scons -u . in the subdir, but I'd prefer to keep
the ports seperate so that the command line options are different for each
port.

I came up with a tool anyways based on the link you posted which works fine
and supports basic redirection
https://github.com/Grbd-Forks/micropython/blob/scons2/tools/scons/tools/General/WinSpawn/WinSpawn.py

I plan on putting a load of these into a pip installable library at some
point, then seeing if I can add setuptools entry_point type plugin support
to scons (also using namespacing)

Many Thanks
Richard

On Fri, 21 Sep 2018 at 04:48, Bill Deegan <bill at baddogconsulting.com> wrote:

> Take a read of:
> https://github.com/SCons/scons/wiki/LongCmdLinesOnWin32
>
> Also, why are you using full paths?
> And/or can't you place your SConstruct at the top of your tree?
>
> On Thu, Sep 20, 2018 at 10:10 PM RW via Scons-users <scons-users at scons.org>
> wrote:
>
>> Hi,
>> I've got another question
>> I've recently run into an issue whereby the command I'm trying to run
>> within scons / windows exceeds the 8192 path limit
>> This is partially due to scons using absolute paths during the build
>> phase, possibly due to the way I have the scripts setup
>>
>> This leaves me with two options
>>
>> 1. Try to force the use of relative paths within scons
>> 2. Try to use powershell as the shell since it seems to not have this
>> issue
>>
>> The full setup is here
>> https://github.com/Grbd-Forks/micropython/tree/scons2
>> with the top level script being run under
>> micropthon/ports/minimal (this is the only port I've tried setting up so
>> far)
>>
>> The powershell approach nearly works, but seems to ignore the windows
>> PATH when searching for the arm gcc compiler I have installed
>> ```
>> import distutils.spawn
>> powershell_path = distutils.spawn.find_executable("powershell.exe")
>> env.Replace(SHELL=powershell_path)
>> ```
>>
>> The other approach migh be to force scons to change the absolute path to
>> a relative one
>> with the below example D:\SourceCode\GitRepos.Forks\micropython\py\mpz.c
>> to ..\..\py\mpz.c
>> but I'm unsure if theres a way to do that
>>
>> To give an example of the sort of command line I'm ending up with
>> ```
>> arm-none-eabi-gcc -E -std=c99 -DNO_QSTR -mthumb -mtune=cortex-m4
>> -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
>> -fsingle-precision-constant -Wdouble-promotion -Wall -Werror -nostdlib -Os
>> -fdata-sections -ffunction-sections -DNDEBUG -I.
>> -ID:\SourceCode\GitRepos.Forks\micropython -Ibuild
>> D:\SourceCode\GitRepos.Forks\micropython\py\mpstate.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\nlr.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\nlrx86.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\nlrx64.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\nlrthumb.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\nlrxtensa.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\nlrsetjmp.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\malloc.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\gc.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\pystack.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\qstr.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\vstr.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\mpprint.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\unicode.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\mpz.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\reader.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\lexer.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\parse.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\scope.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\compile.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitcommon.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitbc.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\asmbase.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\asmx64.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitnx64.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\asmx86.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitnx86.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\asmthumb.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitnthumb.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitinlinethumb.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\asmarm.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitnarm.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\asmxtensa.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitnxtensa.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitinlinextensa.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\formatfloat.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\parsenumbase.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\parsenum.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\emitglue.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\persistentcode.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\runtime.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\runtime_utils.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\scheduler.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\nativeglue.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\stackctrl.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\argcheck.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\warning.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\map.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\obj.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objarray.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objattrtuple.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objbool.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objboundmeth.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objcell.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objclosure.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objcomplex.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objdeque.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objdict.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objenumerate.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objexcept.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objfilter.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objfloat.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objfun.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objgenerator.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objgetitemiter.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objint.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objint_longlong.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objint_mpz.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objlist.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objmap.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objmodule.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objobject.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objpolyiter.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objproperty.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objnone.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objnamedtuple.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objrange.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objreversed.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objset.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objsingleton.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objslice.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objstr.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objstrunicode.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objstringio.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objtuple.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objtype.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\objzip.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\opmethods.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\sequence.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\stream.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\binary.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\builtinimport.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\builtinevex.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\builtinhelp.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modarray.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modbuiltins.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modcollections.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modgc.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modio.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modmath.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modcmath.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modmicropython.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modstruct.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modsys.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\moduerrno.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\modthread.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\vm.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\bc.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\showbc.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\repl.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\smallint.c
>> D:\SourceCode\GitRepos.Forks\micropython\py\frozenmod.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\moductypes.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modujson.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modure.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\moduzlib.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\moduheapq.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modutimeq.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\moduhashlib.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\moducryptolib.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modubinascii.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\virtpin.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\machine_mem.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\machine_pinbase.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\machine_signal.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\machine_pulse.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\machine_i2c.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\machine_spi.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modussl_axtls.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modussl_mbedtls.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modurandom.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\moduselect.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modwebsocket.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modwebrepl.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\modframebuf.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\vfs.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\vfs_reader.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\vfs_posix.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\vfs_posix_file.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\vfs_fat.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\vfs_fat_diskio.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\vfs_fat_file.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\utime_mphal.c
>> D:\SourceCode\GitRepos.Forks\micropython\extmod\uos_dupterm.c
>> D:\SourceCode\GitRepos.Forks\micropython\lib\embed\abort_.c
>> D:\SourceCode\GitRepos.Forks\micropython\lib\utils\printf.c >
>> build\genhdr\qstr.i.last
>> ```
>>
>> Many Thanks
>> Richard
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180921/7963cef2/attachment-0001.html>


More information about the Scons-users mailing list