Discussion:
[Scons-users] Provide default Import to SConscript
Hua Yanghao
2018-02-16 19:28:48 UTC
Permalink
Does anyone know in scons there are ways to implicitly make a object
(e.g. xyz) available for SConscript without explicity Import(xyz)?

Just want to eliminate the annoying repeated Import(xyz) in every
single SConscript.

And what about implicit Return()? e.g. xyz() returns a list of object,
then in every SConscript if the top level SConstruct want to collect
the complete list of object returned from every single SConscript.

For example:
SConscript-1:
Import("xyz")

ret = xyz(...)

Return("ret")

Would ideally become:
SConscript-2:
xyz(...)

Thanks,
Yanghao
Bill Deegan
2018-02-16 20:09:56 UTC
Permalink
No, there is no way without hacking the core code.

It is the way it is by design.

-Bill
SCons Project Co-Manager

On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com> wrote:

> Does anyone know in scons there are ways to implicitly make a object
> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>
> Just want to eliminate the annoying repeated Import(xyz) in every
> single SConscript.
>
> And what about implicit Return()? e.g. xyz() returns a list of object,
> then in every SConscript if the top level SConstruct want to collect
> the complete list of object returned from every single SConscript.
>
> For example:
> SConscript-1:
> Import("xyz")
>
> ret = xyz(...)
>
> Return("ret")
>
> Would ideally become:
> SConscript-2:
> xyz(...)
>
> Thanks,
> Yanghao
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Hua Yanghao
2018-02-16 20:20:43 UTC
Permalink
Hi Bill,
Do you think if it is useful to add a new keyword for
env.SConscript(default_imports=[xyz,abc,...])?
For return I think I can abuse some global variables. This can really
make the SConscript clean/minimal.

Best Regards,
Yanghao

On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan <***@baddogconsulting.com> wrote:
> No, there is no way without hacking the core code.
>
> It is the way it is by design.
>
> -Bill
> SCons Project Co-Manager
>
> On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com> wrote:
>>
>> Does anyone know in scons there are ways to implicitly make a object
>> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>>
>> Just want to eliminate the annoying repeated Import(xyz) in every
>> single SConscript.
>>
>> And what about implicit Return()? e.g. xyz() returns a list of object,
>> then in every SConscript if the top level SConstruct want to collect
>> the complete list of object returned from every single SConscript.
>>
>> For example:
>> SConscript-1:
>> Import("xyz")
>>
>> ret = xyz(...)
>>
>> Return("ret")
>>
>> Would ideally become:
>> SConscript-2:
>> xyz(...)
>>
>> Thanks,
>> Yanghao
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Bill Deegan
2018-02-16 21:40:43 UTC
Permalink
Feel free to make a pull request, though I can't promise that it will be
accepted.

Is it really that much of an inconvenience?
-Bill

On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com> wrote:

> Hi Bill,
> Do you think if it is useful to add a new keyword for
> env.SConscript(default_imports=[xyz,abc,...])?
> For return I think I can abuse some global variables. This can really
> make the SConscript clean/minimal.
>
> Best Regards,
> Yanghao
>
> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
> > No, there is no way without hacking the core code.
> >
> > It is the way it is by design.
> >
> > -Bill
> > SCons Project Co-Manager
> >
> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >>
> >> Does anyone know in scons there are ways to implicitly make a object
> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
> >>
> >> Just want to eliminate the annoying repeated Import(xyz) in every
> >> single SConscript.
> >>
> >> And what about implicit Return()? e.g. xyz() returns a list of object,
> >> then in every SConscript if the top level SConstruct want to collect
> >> the complete list of object returned from every single SConscript.
> >>
> >> For example:
> >> SConscript-1:
> >> Import("xyz")
> >>
> >> ret = xyz(...)
> >>
> >> Return("ret")
> >>
> >> Would ideally become:
> >> SConscript-2:
> >> xyz(...)
> >>
> >> Thanks,
> >> Yanghao
> >> _______________________________________________
> >> Scons-users mailing list
> >> Scons-***@scons.org
> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Hua Yanghao
2018-02-16 23:02:26 UTC
Permalink
Will do. It is really not good if a particular framework force user to
create repeated code. In comparison kbuild can easily create a one line
make file for a module.

I am using localized scons anyway if not accepted will just use it on my
own.

On Fri, Feb 16, 2018 at 22:46 Bill Deegan <***@baddogconsulting.com> wrote:

> Feel free to make a pull request, though I can't promise that it will be
> accepted.
>
> Is it really that much of an inconvenience?
> -Bill
>
>
> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com> wrote:
>
>> Hi Bill,
>> Do you think if it is useful to add a new keyword for
>> env.SConscript(default_imports=[xyz,abc,...])?
>> For return I think I can abuse some global variables. This can really
>> make the SConscript clean/minimal.
>>
>> Best Regards,
>> Yanghao
>>
>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan <***@baddogconsulting.com>
>> wrote:
>> > No, there is no way without hacking the core code.
>> >
>> > It is the way it is by design.
>> >
>> > -Bill
>> > SCons Project Co-Manager
>> >
>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
>> wrote:
>> >>
>> >> Does anyone know in scons there are ways to implicitly make a object
>> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>> >>
>> >> Just want to eliminate the annoying repeated Import(xyz) in every
>> >> single SConscript.
>> >>
>> >> And what about implicit Return()? e.g. xyz() returns a list of object,
>> >> then in every SConscript if the top level SConstruct want to collect
>> >> the complete list of object returned from every single SConscript.
>> >>
>> >> For example:
>> >> SConscript-1:
>> >> Import("xyz")
>> >>
>> >> ret = xyz(...)
>> >>
>> >> Return("ret")
>> >>
>> >> Would ideally become:
>> >> SConscript-2:
>> >> xyz(...)
>> >>
>> >> Thanks,
>> >> Yanghao
>> >> _______________________________________________
>> >> Scons-users mailing list
>> >> Scons-***@scons.org
>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> >
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-***@scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Jonathon Reinhart
2018-02-17 00:18:43 UTC
Permalink
Hua,

If you are importing lots of variables into SConscripts, then you're using
SCons wrong. Most of your variables should probably be construction
variables (in the environment).

I've written many, many SConscripts and I've never used more than 3 or 4
Import() statements in a single SConscript. Before you critique a
long-established framework, you might want to consider if you're using it
inappropriately.

Jonathon



On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com> wrote:

> Will do. It is really not good if a particular framework force user to
> create repeated code. In comparison kbuild can easily create a one line
> make file for a module.
>
> I am using localized scons anyway if not accepted will just use it on my
> own.
>
> On Fri, Feb 16, 2018 at 22:46 Bill Deegan <***@baddogconsulting.com>
> wrote:
>
>> Feel free to make a pull request, though I can't promise that it will be
>> accepted.
>>
>> Is it really that much of an inconvenience?
>> -Bill
>>
>>
>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com>
>> wrote:
>>
>>> Hi Bill,
>>> Do you think if it is useful to add a new keyword for
>>> env.SConscript(default_imports=[xyz,abc,...])?
>>> For return I think I can abuse some global variables. This can really
>>> make the SConscript clean/minimal.
>>>
>>> Best Regards,
>>> Yanghao
>>>
>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan <***@baddogconsulting.com>
>>> wrote:
>>> > No, there is no way without hacking the core code.
>>> >
>>> > It is the way it is by design.
>>> >
>>> > -Bill
>>> > SCons Project Co-Manager
>>> >
>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
>>> wrote:
>>> >>
>>> >> Does anyone know in scons there are ways to implicitly make a object
>>> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>>> >>
>>> >> Just want to eliminate the annoying repeated Import(xyz) in every
>>> >> single SConscript.
>>> >>
>>> >> And what about implicit Return()? e.g. xyz() returns a list of object,
>>> >> then in every SConscript if the top level SConstruct want to collect
>>> >> the complete list of object returned from every single SConscript.
>>> >>
>>> >> For example:
>>> >> SConscript-1:
>>> >> Import("xyz")
>>> >>
>>> >> ret = xyz(...)
>>> >>
>>> >> Return("ret")
>>> >>
>>> >> Would ideally become:
>>> >> SConscript-2:
>>> >> xyz(...)
>>> >>
>>> >> Thanks,
>>> >> Yanghao
>>> >> _______________________________________________
>>> >> Scons-users mailing list
>>> >> Scons-***@scons.org
>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > Scons-users mailing list
>>> > Scons-***@scons.org
>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
Hua Yanghao
2018-02-17 08:05:47 UTC
Permalink
Actually I have one and only one import for hundreds of SConscript :)

On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart <***@gmail.com>
wrote:

> Hua,
>
> If you are importing lots of variables into SConscripts, then you're using
> SCons wrong. Most of your variables should probably be construction
> variables (in the environment).
>
> I've written many, many SConscripts and I've never used more than 3 or 4
> Import() statements in a single SConscript. Before you critique a
> long-established framework, you might want to consider if you're using it
> inappropriately.
>
> Jonathon
>
>
>
> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com> wrote:
>
>> Will do. It is really not good if a particular framework force user to
>> create repeated code. In comparison kbuild can easily create a one line
>> make file for a module.
>>
>> I am using localized scons anyway if not accepted will just use it on my
>> own.
>>
>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan <***@baddogconsulting.com>
>> wrote:
>>
>>> Feel free to make a pull request, though I can't promise that it will be
>>> accepted.
>>>
>>> Is it really that much of an inconvenience?
>>> -Bill
>>>
>>>
>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com>
>>> wrote:
>>>
>>>> Hi Bill,
>>>> Do you think if it is useful to add a new keyword for
>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>>> For return I think I can abuse some global variables. This can really
>>>> make the SConscript clean/minimal.
>>>>
>>>> Best Regards,
>>>> Yanghao
>>>>
>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan <***@baddogconsulting.com>
>>>> wrote:
>>>> > No, there is no way without hacking the core code.
>>>> >
>>>> > It is the way it is by design.
>>>> >
>>>> > -Bill
>>>> > SCons Project Co-Manager
>>>> >
>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
>>>> wrote:
>>>> >>
>>>> >> Does anyone know in scons there are ways to implicitly make a object
>>>> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>>>> >>
>>>> >> Just want to eliminate the annoying repeated Import(xyz) in every
>>>> >> single SConscript.
>>>> >>
>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>>>> object,
>>>> >> then in every SConscript if the top level SConstruct want to collect
>>>> >> the complete list of object returned from every single SConscript.
>>>> >>
>>>> >> For example:
>>>> >> SConscript-1:
>>>> >> Import("xyz")
>>>> >>
>>>> >> ret = xyz(...)
>>>> >>
>>>> >> Return("ret")
>>>> >>
>>>> >> Would ideally become:
>>>> >> SConscript-2:
>>>> >> xyz(...)
>>>> >>
>>>> >> Thanks,
>>>> >> Yanghao
>>>> >> _______________________________________________
>>>> >> Scons-users mailing list
>>>> >> Scons-***@scons.org
>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > Scons-users mailing list
>>>> > Scons-***@scons.org
>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-***@scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Bill Deegan
2018-02-17 15:46:00 UTC
Permalink
How many source files per SConscript?
That's a lot of sconscripts.
Is this all one project?
Are all the SConscripts identical?

On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com> wrote:

> Actually I have one and only one import for hundreds of SConscript :)
>
> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart <
> ***@gmail.com> wrote:
>
>> Hua,
>>
>> If you are importing lots of variables into SConscripts, then you're
>> using SCons wrong. Most of your variables should probably be construction
>> variables (in the environment).
>>
>> I've written many, many SConscripts and I've never used more than 3 or 4
>> Import() statements in a single SConscript. Before you critique a
>> long-established framework, you might want to consider if you're using it
>> inappropriately.
>>
>> Jonathon
>>
>>
>>
>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
>> wrote:
>>
>>> Will do. It is really not good if a particular framework force user to
>>> create repeated code. In comparison kbuild can easily create a one line
>>> make file for a module.
>>>
>>> I am using localized scons anyway if not accepted will just use it on my
>>> own.
>>>
>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan <***@baddogconsulting.com>
>>> wrote:
>>>
>>>> Feel free to make a pull request, though I can't promise that it will
>>>> be accepted.
>>>>
>>>> Is it really that much of an inconvenience?
>>>> -Bill
>>>>
>>>>
>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Bill,
>>>>> Do you think if it is useful to add a new keyword for
>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>>>> For return I think I can abuse some global variables. This can really
>>>>> make the SConscript clean/minimal.
>>>>>
>>>>> Best Regards,
>>>>> Yanghao
>>>>>
>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan <
>>>>> ***@baddogconsulting.com> wrote:
>>>>> > No, there is no way without hacking the core code.
>>>>> >
>>>>> > It is the way it is by design.
>>>>> >
>>>>> > -Bill
>>>>> > SCons Project Co-Manager
>>>>> >
>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
>>>>> wrote:
>>>>> >>
>>>>> >> Does anyone know in scons there are ways to implicitly make a object
>>>>> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>>>>> >>
>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in every
>>>>> >> single SConscript.
>>>>> >>
>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>>>>> object,
>>>>> >> then in every SConscript if the top level SConstruct want to collect
>>>>> >> the complete list of object returned from every single SConscript.
>>>>> >>
>>>>> >> For example:
>>>>> >> SConscript-1:
>>>>> >> Import("xyz")
>>>>> >>
>>>>> >> ret = xyz(...)
>>>>> >>
>>>>> >> Return("ret")
>>>>> >>
>>>>> >> Would ideally become:
>>>>> >> SConscript-2:
>>>>> >> xyz(...)
>>>>> >>
>>>>> >> Thanks,
>>>>> >> Yanghao
>>>>> >> _______________________________________________
>>>>> >> Scons-users mailing list
>>>>> >> Scons-***@scons.org
>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>> >
>>>>> >
>>>>> >
>>>>> > _______________________________________________
>>>>> > Scons-users mailing list
>>>>> > Scons-***@scons.org
>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>> >
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-***@scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-***@scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
Hua Yanghao
2018-02-17 18:45:48 UTC
Permalink
It varies a lot, ranging from 0 (yes, no source files at all) to a few
dozen (didn't really count, see statistics below).

Here is an example Linux kernel driver sub-module Makefile:

linux/drivers/sn/Makefile:
1 #
2 # Makefile for the Altix device drivers.
3 #
4 #
5
6 obj-$(CONFIG_SGI_IOC3) += ioc3.o

I want to replicate this kind of simplicity in scons.

I actually have implemented almost the same thing in scons, but all
those SConscript files have to start with Import("my_func") ... which
is pretty annoying. I know I need it in every single SConscript, and I
have to repeat it ... and this is so anti-pattern.
I have get rid of the Return() part already, but getting rid of the
Import() part seems not that straightforward.

***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
121 121 5953

At the moment the project supports 4 different CPU architectures, a
little less than 1000 C files, 400K+ lines of code.

And this is no small problem (at least for me). If I start working
around it with too much python code, I might end up bypassing a
significant portion of core scons and eventually might find it easier
to just wrap around Makefiles.

Someone thought I was criticizing scons, I actually love scons, but
that doesn't stop me criticizing scons. ;-) Just don't see me as an
enemy I am a serious user of scons since 10 years ago when I was still
in college.

Best Regards,
Yanghao

On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan <***@baddogconsulting.com> wrote:
> How many source files per SConscript?
> That's a lot of sconscripts.
> Is this all one project?
> Are all the SConscripts identical?
>
> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com> wrote:
>>
>> Actually I have one and only one import for hundreds of SConscript :)
>>
>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>> <***@gmail.com> wrote:
>>>
>>> Hua,
>>>
>>> If you are importing lots of variables into SConscripts, then you're
>>> using SCons wrong. Most of your variables should probably be construction
>>> variables (in the environment).
>>>
>>> I've written many, many SConscripts and I've never used more than 3 or 4
>>> Import() statements in a single SConscript. Before you critique a
>>> long-established framework, you might want to consider if you're using it
>>> inappropriately.
>>>
>>> Jonathon
>>>
>>>
>>>
>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
>>> wrote:
>>>>
>>>> Will do. It is really not good if a particular framework force user to
>>>> create repeated code. In comparison kbuild can easily create a one line make
>>>> file for a module.
>>>>
>>>> I am using localized scons anyway if not accepted will just use it on my
>>>> own.
>>>>
>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan <***@baddogconsulting.com>
>>>> wrote:
>>>>>
>>>>> Feel free to make a pull request, though I can't promise that it will
>>>>> be accepted.
>>>>>
>>>>> Is it really that much of an inconvenience?
>>>>> -Bill
>>>>>
>>>>>
>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Hi Bill,
>>>>>> Do you think if it is useful to add a new keyword for
>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>>>>> For return I think I can abuse some global variables. This can really
>>>>>> make the SConscript clean/minimal.
>>>>>>
>>>>>> Best Regards,
>>>>>> Yanghao
>>>>>>
>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>>>>>> <***@baddogconsulting.com> wrote:
>>>>>> > No, there is no way without hacking the core code.
>>>>>> >
>>>>>> > It is the way it is by design.
>>>>>> >
>>>>>> > -Bill
>>>>>> > SCons Project Co-Manager
>>>>>> >
>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
>>>>>> > wrote:
>>>>>> >>
>>>>>> >> Does anyone know in scons there are ways to implicitly make a
>>>>>> >> object
>>>>>> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>>>>>> >>
>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in every
>>>>>> >> single SConscript.
>>>>>> >>
>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>>>>>> >> object,
>>>>>> >> then in every SConscript if the top level SConstruct want to
>>>>>> >> collect
>>>>>> >> the complete list of object returned from every single SConscript.
>>>>>> >>
>>>>>> >> For example:
>>>>>> >> SConscript-1:
>>>>>> >> Import("xyz")
>>>>>> >>
>>>>>> >> ret = xyz(...)
>>>>>> >>
>>>>>> >> Return("ret")
>>>>>> >>
>>>>>> >> Would ideally become:
>>>>>> >> SConscript-2:
>>>>>> >> xyz(...)
>>>>>> >>
>>>>>> >> Thanks,
>>>>>> >> Yanghao
>>>>>> >> _______________________________________________
>>>>>> >> Scons-users mailing list
>>>>>> >> Scons-***@scons.org
>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > _______________________________________________
>>>>>> > Scons-users mailing list
>>>>>> > Scons-***@scons.org
>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>> >
>>>>>> _______________________________________________
>>>>>> Scons-users mailing list
>>>>>> Scons-***@scons.org
>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-***@scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-***@scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Hua Yanghao
2018-02-17 18:53:10 UTC
Permalink
@Bill, I have managed to hack the Frame class and the
BuildDefaultGlobals() function to have some thing imported into
SConscript by default.
However I don't quite understand when the "default_import" keyword
argument passed down, somewhere somehow it end up as a set.

Any documentation to explain what is going on from Base class into
SConscript() calls regarding parameter handling?

Thanks,
Yanghao

On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com> wrote:
> It varies a lot, ranging from 0 (yes, no source files at all) to a few
> dozen (didn't really count, see statistics below).
>
> Here is an example Linux kernel driver sub-module Makefile:
>
> linux/drivers/sn/Makefile:
> 1 #
> 2 # Makefile for the Altix device drivers.
> 3 #
> 4 #
> 5
> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>
> I want to replicate this kind of simplicity in scons.
>
> I actually have implemented almost the same thing in scons, but all
> those SConscript files have to start with Import("my_func") ... which
> is pretty annoying. I know I need it in every single SConscript, and I
> have to repeat it ... and this is so anti-pattern.
> I have get rid of the Return() part already, but getting rid of the
> Import() part seems not that straightforward.
>
> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
> 121 121 5953
>
> At the moment the project supports 4 different CPU architectures, a
> little less than 1000 C files, 400K+ lines of code.
>
> And this is no small problem (at least for me). If I start working
> around it with too much python code, I might end up bypassing a
> significant portion of core scons and eventually might find it easier
> to just wrap around Makefiles.
>
> Someone thought I was criticizing scons, I actually love scons, but
> that doesn't stop me criticizing scons. ;-) Just don't see me as an
> enemy I am a serious user of scons since 10 years ago when I was still
> in college.
>
> Best Regards,
> Yanghao
>
> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan <***@baddogconsulting.com> wrote:
>> How many source files per SConscript?
>> That's a lot of sconscripts.
>> Is this all one project?
>> Are all the SConscripts identical?
>>
>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com> wrote:
>>>
>>> Actually I have one and only one import for hundreds of SConscript :)
>>>
>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>>> <***@gmail.com> wrote:
>>>>
>>>> Hua,
>>>>
>>>> If you are importing lots of variables into SConscripts, then you're
>>>> using SCons wrong. Most of your variables should probably be construction
>>>> variables (in the environment).
>>>>
>>>> I've written many, many SConscripts and I've never used more than 3 or 4
>>>> Import() statements in a single SConscript. Before you critique a
>>>> long-established framework, you might want to consider if you're using it
>>>> inappropriately.
>>>>
>>>> Jonathon
>>>>
>>>>
>>>>
>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
>>>> wrote:
>>>>>
>>>>> Will do. It is really not good if a particular framework force user to
>>>>> create repeated code. In comparison kbuild can easily create a one line make
>>>>> file for a module.
>>>>>
>>>>> I am using localized scons anyway if not accepted will just use it on my
>>>>> own.
>>>>>
>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan <***@baddogconsulting.com>
>>>>> wrote:
>>>>>>
>>>>>> Feel free to make a pull request, though I can't promise that it will
>>>>>> be accepted.
>>>>>>
>>>>>> Is it really that much of an inconvenience?
>>>>>> -Bill
>>>>>>
>>>>>>
>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hi Bill,
>>>>>>> Do you think if it is useful to add a new keyword for
>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>>>>>> For return I think I can abuse some global variables. This can really
>>>>>>> make the SConscript clean/minimal.
>>>>>>>
>>>>>>> Best Regards,
>>>>>>> Yanghao
>>>>>>>
>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>>>>>>> <***@baddogconsulting.com> wrote:
>>>>>>> > No, there is no way without hacking the core code.
>>>>>>> >
>>>>>>> > It is the way it is by design.
>>>>>>> >
>>>>>>> > -Bill
>>>>>>> > SCons Project Co-Manager
>>>>>>> >
>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
>>>>>>> > wrote:
>>>>>>> >>
>>>>>>> >> Does anyone know in scons there are ways to implicitly make a
>>>>>>> >> object
>>>>>>> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>>>>>>> >>
>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in every
>>>>>>> >> single SConscript.
>>>>>>> >>
>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>>>>>>> >> object,
>>>>>>> >> then in every SConscript if the top level SConstruct want to
>>>>>>> >> collect
>>>>>>> >> the complete list of object returned from every single SConscript.
>>>>>>> >>
>>>>>>> >> For example:
>>>>>>> >> SConscript-1:
>>>>>>> >> Import("xyz")
>>>>>>> >>
>>>>>>> >> ret = xyz(...)
>>>>>>> >>
>>>>>>> >> Return("ret")
>>>>>>> >>
>>>>>>> >> Would ideally become:
>>>>>>> >> SConscript-2:
>>>>>>> >> xyz(...)
>>>>>>> >>
>>>>>>> >> Thanks,
>>>>>>> >> Yanghao
>>>>>>> >> _______________________________________________
>>>>>>> >> Scons-users mailing list
>>>>>>> >> Scons-***@scons.org
>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > _______________________________________________
>>>>>>> > Scons-users mailing list
>>>>>>> > Scons-***@scons.org
>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>> >
>>>>>>> _______________________________________________
>>>>>>> Scons-users mailing list
>>>>>>> Scons-***@scons.org
>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Scons-users mailing list
>>>>>> Scons-***@scons.org
>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-***@scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-***@scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
Hua Yanghao
2018-02-17 20:30:59 UTC
Permalink
I see everything passed into env.SConscript(default_import=some_obj),
if some_obj is a string it can pass through but if some_obj is a
function object it end up as None in Script/SConscript.py/SConscript()
function.

I could have used a string and then import the right function however
my function to be passed is a dynamically generated partial function
...

Could anyone please give me some hint how could this be best implemented?

Best Regards,
Yanghao

On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com> wrote:
> @Bill, I have managed to hack the Frame class and the
> BuildDefaultGlobals() function to have some thing imported into
> SConscript by default.
> However I don't quite understand when the "default_import" keyword
> argument passed down, somewhere somehow it end up as a set.
>
> Any documentation to explain what is going on from Base class into
> SConscript() calls regarding parameter handling?
>
> Thanks,
> Yanghao
>
> On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com> wrote:
>> It varies a lot, ranging from 0 (yes, no source files at all) to a few
>> dozen (didn't really count, see statistics below).
>>
>> Here is an example Linux kernel driver sub-module Makefile:
>>
>> linux/drivers/sn/Makefile:
>> 1 #
>> 2 # Makefile for the Altix device drivers.
>> 3 #
>> 4 #
>> 5
>> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>>
>> I want to replicate this kind of simplicity in scons.
>>
>> I actually have implemented almost the same thing in scons, but all
>> those SConscript files have to start with Import("my_func") ... which
>> is pretty annoying. I know I need it in every single SConscript, and I
>> have to repeat it ... and this is so anti-pattern.
>> I have get rid of the Return() part already, but getting rid of the
>> Import() part seems not that straightforward.
>>
>> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>> 121 121 5953
>>
>> At the moment the project supports 4 different CPU architectures, a
>> little less than 1000 C files, 400K+ lines of code.
>>
>> And this is no small problem (at least for me). If I start working
>> around it with too much python code, I might end up bypassing a
>> significant portion of core scons and eventually might find it easier
>> to just wrap around Makefiles.
>>
>> Someone thought I was criticizing scons, I actually love scons, but
>> that doesn't stop me criticizing scons. ;-) Just don't see me as an
>> enemy I am a serious user of scons since 10 years ago when I was still
>> in college.
>>
>> Best Regards,
>> Yanghao
>>
>> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan <***@baddogconsulting.com> wrote:
>>> How many source files per SConscript?
>>> That's a lot of sconscripts.
>>> Is this all one project?
>>> Are all the SConscripts identical?
>>>
>>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com> wrote:
>>>>
>>>> Actually I have one and only one import for hundreds of SConscript :)
>>>>
>>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>>>> <***@gmail.com> wrote:
>>>>>
>>>>> Hua,
>>>>>
>>>>> If you are importing lots of variables into SConscripts, then you're
>>>>> using SCons wrong. Most of your variables should probably be construction
>>>>> variables (in the environment).
>>>>>
>>>>> I've written many, many SConscripts and I've never used more than 3 or 4
>>>>> Import() statements in a single SConscript. Before you critique a
>>>>> long-established framework, you might want to consider if you're using it
>>>>> inappropriately.
>>>>>
>>>>> Jonathon
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Will do. It is really not good if a particular framework force user to
>>>>>> create repeated code. In comparison kbuild can easily create a one line make
>>>>>> file for a module.
>>>>>>
>>>>>> I am using localized scons anyway if not accepted will just use it on my
>>>>>> own.
>>>>>>
>>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan <***@baddogconsulting.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Feel free to make a pull request, though I can't promise that it will
>>>>>>> be accepted.
>>>>>>>
>>>>>>> Is it really that much of an inconvenience?
>>>>>>> -Bill
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi Bill,
>>>>>>>> Do you think if it is useful to add a new keyword for
>>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>>>>>>> For return I think I can abuse some global variables. This can really
>>>>>>>> make the SConscript clean/minimal.
>>>>>>>>
>>>>>>>> Best Regards,
>>>>>>>> Yanghao
>>>>>>>>
>>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>>>>>>>> <***@baddogconsulting.com> wrote:
>>>>>>>> > No, there is no way without hacking the core code.
>>>>>>>> >
>>>>>>>> > It is the way it is by design.
>>>>>>>> >
>>>>>>>> > -Bill
>>>>>>>> > SCons Project Co-Manager
>>>>>>>> >
>>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <***@gmail.com>
>>>>>>>> > wrote:
>>>>>>>> >>
>>>>>>>> >> Does anyone know in scons there are ways to implicitly make a
>>>>>>>> >> object
>>>>>>>> >> (e.g. xyz) available for SConscript without explicity Import(xyz)?
>>>>>>>> >>
>>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in every
>>>>>>>> >> single SConscript.
>>>>>>>> >>
>>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>>>>>>>> >> object,
>>>>>>>> >> then in every SConscript if the top level SConstruct want to
>>>>>>>> >> collect
>>>>>>>> >> the complete list of object returned from every single SConscript.
>>>>>>>> >>
>>>>>>>> >> For example:
>>>>>>>> >> SConscript-1:
>>>>>>>> >> Import("xyz")
>>>>>>>> >>
>>>>>>>> >> ret = xyz(...)
>>>>>>>> >>
>>>>>>>> >> Return("ret")
>>>>>>>> >>
>>>>>>>> >> Would ideally become:
>>>>>>>> >> SConscript-2:
>>>>>>>> >> xyz(...)
>>>>>>>> >>
>>>>>>>> >> Thanks,
>>>>>>>> >> Yanghao
>>>>>>>> >> _______________________________________________
>>>>>>>> >> Scons-users mailing list
>>>>>>>> >> Scons-***@scons.org
>>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > _______________________________________________
>>>>>>>> > Scons-users mailing list
>>>>>>>> > Scons-***@scons.org
>>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>> >
>>>>>>>> _______________________________________________
>>>>>>>> Scons-users mailing list
>>>>>>>> Scons-***@scons.org
>>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Scons-users mailing list
>>>>>>> Scons-***@scons.org
>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Scons-users mailing list
>>>>>> Scons-***@scons.org
>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-***@scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-***@scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
Bill Deegan
2018-02-17 21:15:11 UTC
Permalink
Likely you don't need a SConscript for every directory in your case?
Are you wrapping a complete linux build tree?

Is this a build tree you can share for us to look at?

-Bill

On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com> wrote:

> I see everything passed into env.SConscript(default_import=some_obj),
> if some_obj is a string it can pass through but if some_obj is a
> function object it end up as None in Script/SConscript.py/SConscript()
> function.
>
> I could have used a string and then import the right function however
> my function to be passed is a dynamically generated partial function
> ...
>
> Could anyone please give me some hint how could this be best implemented?
>
> Best Regards,
> Yanghao
>
> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com> wrote:
> > @Bill, I have managed to hack the Frame class and the
> > BuildDefaultGlobals() function to have some thing imported into
> > SConscript by default.
> > However I don't quite understand when the "default_import" keyword
> > argument passed down, somewhere somehow it end up as a set.
> >
> > Any documentation to explain what is going on from Base class into
> > SConscript() calls regarding parameter handling?
> >
> > Thanks,
> > Yanghao
> >
> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >> It varies a lot, ranging from 0 (yes, no source files at all) to a few
> >> dozen (didn't really count, see statistics below).
> >>
> >> Here is an example Linux kernel driver sub-module Makefile:
> >>
> >> linux/drivers/sn/Makefile:
> >> 1 #
> >> 2 # Makefile for the Altix device drivers.
> >> 3 #
> >> 4 #
> >> 5
> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
> >>
> >> I want to replicate this kind of simplicity in scons.
> >>
> >> I actually have implemented almost the same thing in scons, but all
> >> those SConscript files have to start with Import("my_func") ... which
> >> is pretty annoying. I know I need it in every single SConscript, and I
> >> have to repeat it ... and this is so anti-pattern.
> >> I have get rid of the Return() part already, but getting rid of the
> >> Import() part seems not that straightforward.
> >>
> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
> >> 121 121 5953
> >>
> >> At the moment the project supports 4 different CPU architectures, a
> >> little less than 1000 C files, 400K+ lines of code.
> >>
> >> And this is no small problem (at least for me). If I start working
> >> around it with too much python code, I might end up bypassing a
> >> significant portion of core scons and eventually might find it easier
> >> to just wrap around Makefiles.
> >>
> >> Someone thought I was criticizing scons, I actually love scons, but
> >> that doesn't stop me criticizing scons. ;-) Just don't see me as an
> >> enemy I am a serious user of scons since 10 years ago when I was still
> >> in college.
> >>
> >> Best Regards,
> >> Yanghao
> >>
> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
> >>> How many source files per SConscript?
> >>> That's a lot of sconscripts.
> >>> Is this all one project?
> >>> Are all the SConscripts identical?
> >>>
> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com>
> wrote:
> >>>>
> >>>> Actually I have one and only one import for hundreds of SConscript :)
> >>>>
> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
> >>>> <***@gmail.com> wrote:
> >>>>>
> >>>>> Hua,
> >>>>>
> >>>>> If you are importing lots of variables into SConscripts, then you're
> >>>>> using SCons wrong. Most of your variables should probably be
> construction
> >>>>> variables (in the environment).
> >>>>>
> >>>>> I've written many, many SConscripts and I've never used more than 3
> or 4
> >>>>> Import() statements in a single SConscript. Before you critique a
> >>>>> long-established framework, you might want to consider if you're
> using it
> >>>>> inappropriately.
> >>>>>
> >>>>> Jonathon
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
> >>>>> wrote:
> >>>>>>
> >>>>>> Will do. It is really not good if a particular framework force user
> to
> >>>>>> create repeated code. In comparison kbuild can easily create a one
> line make
> >>>>>> file for a module.
> >>>>>>
> >>>>>> I am using localized scons anyway if not accepted will just use it
> on my
> >>>>>> own.
> >>>>>>
> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan <
> ***@baddogconsulting.com>
> >>>>>> wrote:
> >>>>>>>
> >>>>>>> Feel free to make a pull request, though I can't promise that it
> will
> >>>>>>> be accepted.
> >>>>>>>
> >>>>>>> Is it really that much of an inconvenience?
> >>>>>>> -Bill
> >>>>>>>
> >>>>>>>
> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao <***@gmail.com
> >
> >>>>>>> wrote:
> >>>>>>>>
> >>>>>>>> Hi Bill,
> >>>>>>>> Do you think if it is useful to add a new keyword for
> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
> >>>>>>>> For return I think I can abuse some global variables. This can
> really
> >>>>>>>> make the SConscript clean/minimal.
> >>>>>>>>
> >>>>>>>> Best Regards,
> >>>>>>>> Yanghao
> >>>>>>>>
> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
> >>>>>>>> <***@baddogconsulting.com> wrote:
> >>>>>>>> > No, there is no way without hacking the core code.
> >>>>>>>> >
> >>>>>>>> > It is the way it is by design.
> >>>>>>>> >
> >>>>>>>> > -Bill
> >>>>>>>> > SCons Project Co-Manager
> >>>>>>>> >
> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao <
> ***@gmail.com>
> >>>>>>>> > wrote:
> >>>>>>>> >>
> >>>>>>>> >> Does anyone know in scons there are ways to implicitly make a
> >>>>>>>> >> object
> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
> Import(xyz)?
> >>>>>>>> >>
> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in
> every
> >>>>>>>> >> single SConscript.
> >>>>>>>> >>
> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
> >>>>>>>> >> object,
> >>>>>>>> >> then in every SConscript if the top level SConstruct want to
> >>>>>>>> >> collect
> >>>>>>>> >> the complete list of object returned from every single
> SConscript.
> >>>>>>>> >>
> >>>>>>>> >> For example:
> >>>>>>>> >> SConscript-1:
> >>>>>>>> >> Import("xyz")
> >>>>>>>> >>
> >>>>>>>> >> ret = xyz(...)
> >>>>>>>> >>
> >>>>>>>> >> Return("ret")
> >>>>>>>> >>
> >>>>>>>> >> Would ideally become:
> >>>>>>>> >> SConscript-2:
> >>>>>>>> >> xyz(...)
> >>>>>>>> >>
> >>>>>>>> >> Thanks,
> >>>>>>>> >> Yanghao
> >>>>>>>> >> _______________________________________________
> >>>>>>>> >> Scons-users mailing list
> >>>>>>>> >> Scons-***@scons.org
> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> > _______________________________________________
> >>>>>>>> > Scons-users mailing list
> >>>>>>>> > Scons-***@scons.org
> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>>>>>> >
> >>>>>>>> _______________________________________________
> >>>>>>>> Scons-users mailing list
> >>>>>>>> Scons-***@scons.org
> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>>>>>
> >>>>>>>
> >>>>>>> _______________________________________________
> >>>>>>> Scons-users mailing list
> >>>>>>> Scons-***@scons.org
> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>>>>
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> Scons-users mailing list
> >>>>>> Scons-***@scons.org
> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> Scons-users mailing list
> >>>>> Scons-***@scons.org
> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Scons-users mailing list
> >>>> Scons-***@scons.org
> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>>
> >>>
> >>>
> >>> _______________________________________________
> >>> Scons-users mailing list
> >>> Scons-***@scons.org
> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Hua Yanghao
2018-02-17 22:31:02 UTC
Permalink
Hi Bill,
I do not create a SConscript for every directory, only for directly
which either provide a set of include file or having source code to
build.
I will try to create a minimal version of the build system to show the idea.

Not sure if the below tree will give you some idea what I am trying to
implement, at least you should be able to see where I am having a
SConscript file.
build/configs/riscv_example/riscv32-qemu-virt-main/
├── cmdlist.txt
├── config
│ └── config.h
├── firmware
│ ├── arch
│ │ ├── include
│ │ │ └── arch
│ │ │ ├── cache.h
│ │ │ ├── irq.h
│ │ │ ├── misc.h
│ │ │ ├── mmu.h
│ │ │ ├── smp.h
│ │ │ ├── spinlock.h
│ │ │ └── timer.h
│ │ ├── riscv
│ │ │ ├── helper.c
│ │ │ ├── helper.o
│ │ │ ├── libdefault.o
│ │ │ ├── main.c
│ │ │ ├── main.o
│ │ │ ├── SConscript
│ │ │ ├── start.o
│ │ │ └── start.S
│ │ ├── SConscript
│ │ ├── weak.c
│ │ └── weak.o
│ ├── boards
│ │ ├── include
│ │ │ └── board.h
│ │ ├── qemu-riscv32-virt
│ │ │ ├── board.c
│ │ │ ├── board.o
│ │ │ ├── SConscript
│ │ │ ├── uart16550_device.c
│ │ │ └── uart16550_device.o
│ │ └── SConscript
│ ├── common
│ │ ├── cpu.c
│ │ ├── cpu.o
│ │ ├── include
│ │ │ └── common
│ │ │ ├── common.h
│ │ │ ├── cpu.h
│ │ │ └── log.h
│ │ ├── libdefault.o
│ │ ├── log.c
│ │ ├── log.o
│ │ ├── main.c
│ │ ├── main.o
│ │ ├── SConscript
│ │ ├── weak.c
│ │ └── weak.o
│ ├── drivers
│ │ └── uart16550
│ │ ├── fd_ops.c
│ │ ├── fd_ops.o
│ │ ├── include
│ │ │ ├── uart16550_api.h
│ │ │ └── uart16550_device.h
│ │ ├── libdefault.o
│ │ ├── SConscript
│ │ ├── uart16550.c
│ │ └── uart16550.o
│ ├── include
│ │ ├── bootstage.h
│ │ ├── compiler.h
│ │ ├── debug.h
│ │ └── linux
│ │ └── typecheck.h
│ ├── lib
│ │ ├── cmd
│ │ │ ├── cmd.c
│ │ │ ├── cmd.o
│ │ │ ├── include
│ │ │ │ └── cmd
│ │ │ │ └── cmd.h
│ │ │ ├── SConscript
│ │ │ ├── test.c
│ │ │ └── test.o
│ │ ├── fio
│ │ │ ├── cmd.c
│ │ │ ├── cmd.o
│ │ │ ├── include
│ │ │ │ └── usw_device_public.h
│ │ │ ├── libdefault.o
│ │ │ ├── newlib.c
│ │ │ ├── newlib.o
│ │ │ ├── SConscript
│ │ │ ├── usw_device.c
│ │ │ ├── usw_device.o
│ │ │ └── usw_device_private.h
│ │ ├── pipe
│ │ │ ├── include
│ │ │ │ └── pipe
│ │ │ │ ├── pipe.h
│ │ │ │ └── status.h
│ │ │ ├── libdefault.o
│ │ │ ├── pipe.c
│ │ │ ├── pipe.o
│ │ │ └── SConscript
│ │ └── simple_console
│ │ ├── include
│ │ │ └── simple_console.h
│ │ ├── libdefault.o
│ │ ├── print_color.h
│ │ ├── SConscript
│ │ ├── simple_console.c
│ │ └── simple_console.o
│ ├── SConscript
│ └── test
│ ├── common
│ │ ├── SConscript
│ │ ├── test.c
│ │ └── test.o
│ ├── console
│ │ ├── hello.c
│ │ ├── hello.o
│ │ ├── SConscript
│ │ ├── test.c
│ │ └── test.o
│ ├── example
│ │ ├── SConscript
│ │ ├── test.c
│ │ └── test.o
│ ├── libc
│ │ ├── SConscript
│ │ ├── test.c
│ │ └── test.o
│ ├── linker
│ │ ├── SConscript
│ │ ├── test.c
│ │ └── test.o
│ ├── log
│ │ ├── SConscript
│ │ ├── test.c
│ │ └── test.o
│ └── setjmp
│ ├── SConscript
│ ├── test2.c
│ ├── test2.o
│ ├── test.c
│ └── test.o
├── libriscv_example.a
├── link.ld
├── riscv_example.bin
├── riscv_example.elf
├── riscv_example.ibi_bin
├── riscv_example.map
└── riscv_example.S

36 directories, 113 files




On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan <***@baddogconsulting.com> wrote:
> Likely you don't need a SConscript for every directory in your case?
> Are you wrapping a complete linux build tree?
>
> Is this a build tree you can share for us to look at?
>
> -Bill
>
> On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com> wrote:
>>
>> I see everything passed into env.SConscript(default_import=some_obj),
>> if some_obj is a string it can pass through but if some_obj is a
>> function object it end up as None in Script/SConscript.py/SConscript()
>> function.
>>
>> I could have used a string and then import the right function however
>> my function to be passed is a dynamically generated partial function
>> ...
>>
>> Could anyone please give me some hint how could this be best implemented?
>>
>> Best Regards,
>> Yanghao
>>
>> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com> wrote:
>> > @Bill, I have managed to hack the Frame class and the
>> > BuildDefaultGlobals() function to have some thing imported into
>> > SConscript by default.
>> > However I don't quite understand when the "default_import" keyword
>> > argument passed down, somewhere somehow it end up as a set.
>> >
>> > Any documentation to explain what is going on from Base class into
>> > SConscript() calls regarding parameter handling?
>> >
>> > Thanks,
>> > Yanghao
>> >
>> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
>> > wrote:
>> >> It varies a lot, ranging from 0 (yes, no source files at all) to a few
>> >> dozen (didn't really count, see statistics below).
>> >>
>> >> Here is an example Linux kernel driver sub-module Makefile:
>> >>
>> >> linux/drivers/sn/Makefile:
>> >> 1 #
>> >> 2 # Makefile for the Altix device drivers.
>> >> 3 #
>> >> 4 #
>> >> 5
>> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>> >>
>> >> I want to replicate this kind of simplicity in scons.
>> >>
>> >> I actually have implemented almost the same thing in scons, but all
>> >> those SConscript files have to start with Import("my_func") ... which
>> >> is pretty annoying. I know I need it in every single SConscript, and I
>> >> have to repeat it ... and this is so anti-pattern.
>> >> I have get rid of the Return() part already, but getting rid of the
>> >> Import() part seems not that straightforward.
>> >>
>> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>> >> 121 121 5953
>> >>
>> >> At the moment the project supports 4 different CPU architectures, a
>> >> little less than 1000 C files, 400K+ lines of code.
>> >>
>> >> And this is no small problem (at least for me). If I start working
>> >> around it with too much python code, I might end up bypassing a
>> >> significant portion of core scons and eventually might find it easier
>> >> to just wrap around Makefiles.
>> >>
>> >> Someone thought I was criticizing scons, I actually love scons, but
>> >> that doesn't stop me criticizing scons. ;-) Just don't see me as an
>> >> enemy I am a serious user of scons since 10 years ago when I was still
>> >> in college.
>> >>
>> >> Best Regards,
>> >> Yanghao
>> >>
>> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>> >> <***@baddogconsulting.com> wrote:
>> >>> How many source files per SConscript?
>> >>> That's a lot of sconscripts.
>> >>> Is this all one project?
>> >>> Are all the SConscripts identical?
>> >>>
>> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> Actually I have one and only one import for hundreds of SConscript :)
>> >>>>
>> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>> >>>> <***@gmail.com> wrote:
>> >>>>>
>> >>>>> Hua,
>> >>>>>
>> >>>>> If you are importing lots of variables into SConscripts, then you're
>> >>>>> using SCons wrong. Most of your variables should probably be
>> >>>>> construction
>> >>>>> variables (in the environment).
>> >>>>>
>> >>>>> I've written many, many SConscripts and I've never used more than 3
>> >>>>> or 4
>> >>>>> Import() statements in a single SConscript. Before you critique a
>> >>>>> long-established framework, you might want to consider if you're
>> >>>>> using it
>> >>>>> inappropriately.
>> >>>>>
>> >>>>> Jonathon
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
>> >>>>> wrote:
>> >>>>>>
>> >>>>>> Will do. It is really not good if a particular framework force user
>> >>>>>> to
>> >>>>>> create repeated code. In comparison kbuild can easily create a one
>> >>>>>> line make
>> >>>>>> file for a module.
>> >>>>>>
>> >>>>>> I am using localized scons anyway if not accepted will just use it
>> >>>>>> on my
>> >>>>>> own.
>> >>>>>>
>> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>> >>>>>> <***@baddogconsulting.com>
>> >>>>>> wrote:
>> >>>>>>>
>> >>>>>>> Feel free to make a pull request, though I can't promise that it
>> >>>>>>> will
>> >>>>>>> be accepted.
>> >>>>>>>
>> >>>>>>> Is it really that much of an inconvenience?
>> >>>>>>> -Bill
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>> >>>>>>> <***@gmail.com>
>> >>>>>>> wrote:
>> >>>>>>>>
>> >>>>>>>> Hi Bill,
>> >>>>>>>> Do you think if it is useful to add a new keyword for
>> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>> >>>>>>>> For return I think I can abuse some global variables. This can
>> >>>>>>>> really
>> >>>>>>>> make the SConscript clean/minimal.
>> >>>>>>>>
>> >>>>>>>> Best Regards,
>> >>>>>>>> Yanghao
>> >>>>>>>>
>> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>> >>>>>>>> <***@baddogconsulting.com> wrote:
>> >>>>>>>> > No, there is no way without hacking the core code.
>> >>>>>>>> >
>> >>>>>>>> > It is the way it is by design.
>> >>>>>>>> >
>> >>>>>>>> > -Bill
>> >>>>>>>> > SCons Project Co-Manager
>> >>>>>>>> >
>> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>> >>>>>>>> > <***@gmail.com>
>> >>>>>>>> > wrote:
>> >>>>>>>> >>
>> >>>>>>>> >> Does anyone know in scons there are ways to implicitly make a
>> >>>>>>>> >> object
>> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
>> >>>>>>>> >> Import(xyz)?
>> >>>>>>>> >>
>> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in
>> >>>>>>>> >> every
>> >>>>>>>> >> single SConscript.
>> >>>>>>>> >>
>> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>> >>>>>>>> >> object,
>> >>>>>>>> >> then in every SConscript if the top level SConstruct want to
>> >>>>>>>> >> collect
>> >>>>>>>> >> the complete list of object returned from every single
>> >>>>>>>> >> SConscript.
>> >>>>>>>> >>
>> >>>>>>>> >> For example:
>> >>>>>>>> >> SConscript-1:
>> >>>>>>>> >> Import("xyz")
>> >>>>>>>> >>
>> >>>>>>>> >> ret = xyz(...)
>> >>>>>>>> >>
>> >>>>>>>> >> Return("ret")
>> >>>>>>>> >>
>> >>>>>>>> >> Would ideally become:
>> >>>>>>>> >> SConscript-2:
>> >>>>>>>> >> xyz(...)
>> >>>>>>>> >>
>> >>>>>>>> >> Thanks,
>> >>>>>>>> >> Yanghao
>> >>>>>>>> >> _______________________________________________
>> >>>>>>>> >> Scons-users mailing list
>> >>>>>>>> >> Scons-***@scons.org
>> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>>>>>> >
>> >>>>>>>> >
>> >>>>>>>> >
>> >>>>>>>> > _______________________________________________
>> >>>>>>>> > Scons-users mailing list
>> >>>>>>>> > Scons-***@scons.org
>> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>>>>>> >
>> >>>>>>>> _______________________________________________
>> >>>>>>>> Scons-users mailing list
>> >>>>>>>> Scons-***@scons.org
>> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> _______________________________________________
>> >>>>>>> Scons-users mailing list
>> >>>>>>> Scons-***@scons.org
>> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>>>>
>> >>>>>>
>> >>>>>> _______________________________________________
>> >>>>>> Scons-users mailing list
>> >>>>>> Scons-***@scons.org
>> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>>>>
>> >>>>>
>> >>>>> _______________________________________________
>> >>>>> Scons-users mailing list
>> >>>>> Scons-***@scons.org
>> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> Scons-users mailing list
>> >>>> Scons-***@scons.org
>> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>>
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Scons-users mailing list
>> >>> Scons-***@scons.org
>> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Bill Deegan
2018-02-17 23:17:43 UTC
Permalink
Hua,

From the tree you've shared, I'm going to guess you have way more
SConscripts than you need.

For example, you're set of test directories could have a single SConscript
instead of one per.
Which no doubt are just a few lines each.

In some cases it looks like you have a SConscript in a directory which only
has a header file (or none) and then a directory (or more) of source code.
Skip the SConscript in the basically no-op directorie(s).

Another suggestion, use variant dirs so you're not creating build files in
your source directory.

If you find yourself with a ton of very small SConscripts, it's a sign that
you may be doing something non-scons'ian.

Of course it also depends on how working on each group of code is split up
between different developers.

There is some art in structuring your build system (and your code) such
that engineers rarely end up causing merge conflicts with each other.

I can see some value in default_import, but it would be something requiring
some debate on getting accepted.
As far as I can recall, your's is the first request for something like this
in the history of SCons (or at least as long as I've been involved).

Philosophically SCons is about being explicit in the build requirements and
also about being correct by design. Yielding reproducible builds
regardless of the individual developers shell and machine setup.


On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com> wrote:

> Hi Bill,
> I do not create a SConscript for every directory, only for directly
> which either provide a set of include file or having source code to
> build.
> I will try to create a minimal version of the build system to show the
> idea.
>
> Not sure if the below tree will give you some idea what I am trying to
> implement, at least you should be able to see where I am having a
> SConscript file.
> build/configs/riscv_example/riscv32-qemu-virt-main/
> ├── cmdlist.txt
> ├── config
> │ └── config.h
> ├── firmware
> │ ├── arch
> │ │ ├── include
> │ │ │ └── arch
> │ │ │ ├── cache.h
> │ │ │ ├── irq.h
> │ │ │ ├── misc.h
> │ │ │ ├── mmu.h
> │ │ │ ├── smp.h
> │ │ │ ├── spinlock.h
> │ │ │ └── timer.h
> │ │ ├── riscv
> │ │ │ ├── helper.c
> │ │ │ ├── helper.o
> │ │ │ ├── libdefault.o
> │ │ │ ├── main.c
> │ │ │ ├── main.o
> │ │ │ ├── SConscript
> │ │ │ ├── start.o
> │ │ │ └── start.S
> │ │ ├── SConscript
> │ │ ├── weak.c
> │ │ └── weak.o
> │ ├── boards
> │ │ ├── include
> │ │ │ └── board.h
> │ │ ├── qemu-riscv32-virt
> │ │ │ ├── board.c
> │ │ │ ├── board.o
> │ │ │ ├── SConscript
> │ │ │ ├── uart16550_device.c
> │ │ │ └── uart16550_device.o
> │ │ └── SConscript
> │ ├── common
> │ │ ├── cpu.c
> │ │ ├── cpu.o
> │ │ ├── include
> │ │ │ └── common
> │ │ │ ├── common.h
> │ │ │ ├── cpu.h
> │ │ │ └── log.h
> │ │ ├── libdefault.o
> │ │ ├── log.c
> │ │ ├── log.o
> │ │ ├── main.c
> │ │ ├── main.o
> │ │ ├── SConscript
> │ │ ├── weak.c
> │ │ └── weak.o
> │ ├── drivers
> │ │ └── uart16550
> │ │ ├── fd_ops.c
> │ │ ├── fd_ops.o
> │ │ ├── include
> │ │ │ ├── uart16550_api.h
> │ │ │ └── uart16550_device.h
> │ │ ├── libdefault.o
> │ │ ├── SConscript
> │ │ ├── uart16550.c
> │ │ └── uart16550.o
> │ ├── include
> │ │ ├── bootstage.h
> │ │ ├── compiler.h
> │ │ ├── debug.h
> │ │ └── linux
> │ │ └── typecheck.h
> │ ├── lib
> │ │ ├── cmd
> │ │ │ ├── cmd.c
> │ │ │ ├── cmd.o
> │ │ │ ├── include
> │ │ │ │ └── cmd
> │ │ │ │ └── cmd.h
> │ │ │ ├── SConscript
> │ │ │ ├── test.c
> │ │ │ └── test.o
> │ │ ├── fio
> │ │ │ ├── cmd.c
> │ │ │ ├── cmd.o
> │ │ │ ├── include
> │ │ │ │ └── usw_device_public.h
> │ │ │ ├── libdefault.o
> │ │ │ ├── newlib.c
> │ │ │ ├── newlib.o
> │ │ │ ├── SConscript
> │ │ │ ├── usw_device.c
> │ │ │ ├── usw_device.o
> │ │ │ └── usw_device_private.h
> │ │ ├── pipe
> │ │ │ ├── include
> │ │ │ │ └── pipe
> │ │ │ │ ├── pipe.h
> │ │ │ │ └── status.h
> │ │ │ ├── libdefault.o
> │ │ │ ├── pipe.c
> │ │ │ ├── pipe.o
> │ │ │ └── SConscript
> │ │ └── simple_console
> │ │ ├── include
> │ │ │ └── simple_console.h
> │ │ ├── libdefault.o
> │ │ ├── print_color.h
> │ │ ├── SConscript
> │ │ ├── simple_console.c
> │ │ └── simple_console.o
> │ ├── SConscript
> │ └── test
> │ ├── common
> │ │ ├── SConscript
> │ │ ├── test.c
> │ │ └── test.o
> │ ├── console
> │ │ ├── hello.c
> │ │ ├── hello.o
> │ │ ├── SConscript
> │ │ ├── test.c
> │ │ └── test.o
> │ ├── example
> │ │ ├── SConscript
> │ │ ├── test.c
> │ │ └── test.o
> │ ├── libc
> │ │ ├── SConscript
> │ │ ├── test.c
> │ │ └── test.o
> │ ├── linker
> │ │ ├── SConscript
> │ │ ├── test.c
> │ │ └── test.o
> │ ├── log
> │ │ ├── SConscript
> │ │ ├── test.c
> │ │ └── test.o
> │ └── setjmp
> │ ├── SConscript
> │ ├── test2.c
> │ ├── test2.o
> │ ├── test.c
> │ └── test.o
> ├── libriscv_example.a
> ├── link.ld
> ├── riscv_example.bin
> ├── riscv_example.elf
> ├── riscv_example.ibi_bin
> ├── riscv_example.map
> └── riscv_example.S
>
> 36 directories, 113 files
>
>
>
>
> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
> > Likely you don't need a SConscript for every directory in your case?
> > Are you wrapping a complete linux build tree?
> >
> > Is this a build tree you can share for us to look at?
> >
> > -Bill
> >
> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >>
> >> I see everything passed into env.SConscript(default_import=some_obj),
> >> if some_obj is a string it can pass through but if some_obj is a
> >> function object it end up as None in Script/SConscript.py/SConscript()
> >> function.
> >>
> >> I could have used a string and then import the right function however
> >> my function to be passed is a dynamically generated partial function
> >> ...
> >>
> >> Could anyone please give me some hint how could this be best
> implemented?
> >>
> >> Best Regards,
> >> Yanghao
> >>
> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >> > @Bill, I have managed to hack the Frame class and the
> >> > BuildDefaultGlobals() function to have some thing imported into
> >> > SConscript by default.
> >> > However I don't quite understand when the "default_import" keyword
> >> > argument passed down, somewhere somehow it end up as a set.
> >> >
> >> > Any documentation to explain what is going on from Base class into
> >> > SConscript() calls regarding parameter handling?
> >> >
> >> > Thanks,
> >> > Yanghao
> >> >
> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
> >> > wrote:
> >> >> It varies a lot, ranging from 0 (yes, no source files at all) to a
> few
> >> >> dozen (didn't really count, see statistics below).
> >> >>
> >> >> Here is an example Linux kernel driver sub-module Makefile:
> >> >>
> >> >> linux/drivers/sn/Makefile:
> >> >> 1 #
> >> >> 2 # Makefile for the Altix device drivers.
> >> >> 3 #
> >> >> 4 #
> >> >> 5
> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
> >> >>
> >> >> I want to replicate this kind of simplicity in scons.
> >> >>
> >> >> I actually have implemented almost the same thing in scons, but all
> >> >> those SConscript files have to start with Import("my_func") ... which
> >> >> is pretty annoying. I know I need it in every single SConscript, and
> I
> >> >> have to repeat it ... and this is so anti-pattern.
> >> >> I have get rid of the Return() part already, but getting rid of the
> >> >> Import() part seems not that straightforward.
> >> >>
> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
> >> >> 121 121 5953
> >> >>
> >> >> At the moment the project supports 4 different CPU architectures, a
> >> >> little less than 1000 C files, 400K+ lines of code.
> >> >>
> >> >> And this is no small problem (at least for me). If I start working
> >> >> around it with too much python code, I might end up bypassing a
> >> >> significant portion of core scons and eventually might find it easier
> >> >> to just wrap around Makefiles.
> >> >>
> >> >> Someone thought I was criticizing scons, I actually love scons, but
> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me as an
> >> >> enemy I am a serious user of scons since 10 years ago when I was
> still
> >> >> in college.
> >> >>
> >> >> Best Regards,
> >> >> Yanghao
> >> >>
> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
> >> >> <***@baddogconsulting.com> wrote:
> >> >>> How many source files per SConscript?
> >> >>> That's a lot of sconscripts.
> >> >>> Is this all one project?
> >> >>> Are all the SConscripts identical?
> >> >>>
> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com>
> >> >>> wrote:
> >> >>>>
> >> >>>> Actually I have one and only one import for hundreds of SConscript
> :)
> >> >>>>
> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
> >> >>>> <***@gmail.com> wrote:
> >> >>>>>
> >> >>>>> Hua,
> >> >>>>>
> >> >>>>> If you are importing lots of variables into SConscripts, then
> you're
> >> >>>>> using SCons wrong. Most of your variables should probably be
> >> >>>>> construction
> >> >>>>> variables (in the environment).
> >> >>>>>
> >> >>>>> I've written many, many SConscripts and I've never used more than
> 3
> >> >>>>> or 4
> >> >>>>> Import() statements in a single SConscript. Before you critique a
> >> >>>>> long-established framework, you might want to consider if you're
> >> >>>>> using it
> >> >>>>> inappropriately.
> >> >>>>>
> >> >>>>> Jonathon
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <
> ***@gmail.com>
> >> >>>>> wrote:
> >> >>>>>>
> >> >>>>>> Will do. It is really not good if a particular framework force
> user
> >> >>>>>> to
> >> >>>>>> create repeated code. In comparison kbuild can easily create a
> one
> >> >>>>>> line make
> >> >>>>>> file for a module.
> >> >>>>>>
> >> >>>>>> I am using localized scons anyway if not accepted will just use
> it
> >> >>>>>> on my
> >> >>>>>> own.
> >> >>>>>>
> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
> >> >>>>>> <***@baddogconsulting.com>
> >> >>>>>> wrote:
> >> >>>>>>>
> >> >>>>>>> Feel free to make a pull request, though I can't promise that it
> >> >>>>>>> will
> >> >>>>>>> be accepted.
> >> >>>>>>>
> >> >>>>>>> Is it really that much of an inconvenience?
> >> >>>>>>> -Bill
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
> >> >>>>>>> <***@gmail.com>
> >> >>>>>>> wrote:
> >> >>>>>>>>
> >> >>>>>>>> Hi Bill,
> >> >>>>>>>> Do you think if it is useful to add a new keyword for
> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
> >> >>>>>>>> For return I think I can abuse some global variables. This can
> >> >>>>>>>> really
> >> >>>>>>>> make the SConscript clean/minimal.
> >> >>>>>>>>
> >> >>>>>>>> Best Regards,
> >> >>>>>>>> Yanghao
> >> >>>>>>>>
> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
> >> >>>>>>>> <***@baddogconsulting.com> wrote:
> >> >>>>>>>> > No, there is no way without hacking the core code.
> >> >>>>>>>> >
> >> >>>>>>>> > It is the way it is by design.
> >> >>>>>>>> >
> >> >>>>>>>> > -Bill
> >> >>>>>>>> > SCons Project Co-Manager
> >> >>>>>>>> >
> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
> >> >>>>>>>> > <***@gmail.com>
> >> >>>>>>>> > wrote:
> >> >>>>>>>> >>
> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly make
> a
> >> >>>>>>>> >> object
> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
> >> >>>>>>>> >> Import(xyz)?
> >> >>>>>>>> >>
> >> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in
> >> >>>>>>>> >> every
> >> >>>>>>>> >> single SConscript.
> >> >>>>>>>> >>
> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list
> of
> >> >>>>>>>> >> object,
> >> >>>>>>>> >> then in every SConscript if the top level SConstruct want to
> >> >>>>>>>> >> collect
> >> >>>>>>>> >> the complete list of object returned from every single
> >> >>>>>>>> >> SConscript.
> >> >>>>>>>> >>
> >> >>>>>>>> >> For example:
> >> >>>>>>>> >> SConscript-1:
> >> >>>>>>>> >> Import("xyz")
> >> >>>>>>>> >>
> >> >>>>>>>> >> ret = xyz(...)
> >> >>>>>>>> >>
> >> >>>>>>>> >> Return("ret")
> >> >>>>>>>> >>
> >> >>>>>>>> >> Would ideally become:
> >> >>>>>>>> >> SConscript-2:
> >> >>>>>>>> >> xyz(...)
> >> >>>>>>>> >>
> >> >>>>>>>> >> Thanks,
> >> >>>>>>>> >> Yanghao
> >> >>>>>>>> >> _______________________________________________
> >> >>>>>>>> >> Scons-users mailing list
> >> >>>>>>>> >> Scons-***@scons.org
> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>>>>>> >
> >> >>>>>>>> >
> >> >>>>>>>> >
> >> >>>>>>>> > _______________________________________________
> >> >>>>>>>> > Scons-users mailing list
> >> >>>>>>>> > Scons-***@scons.org
> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>>>>>> >
> >> >>>>>>>> _______________________________________________
> >> >>>>>>>> Scons-users mailing list
> >> >>>>>>>> Scons-***@scons.org
> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>> _______________________________________________
> >> >>>>>>> Scons-users mailing list
> >> >>>>>>> Scons-***@scons.org
> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>>>>
> >> >>>>>>
> >> >>>>>> _______________________________________________
> >> >>>>>> Scons-users mailing list
> >> >>>>>> Scons-***@scons.org
> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>>>>
> >> >>>>>
> >> >>>>> _______________________________________________
> >> >>>>> Scons-users mailing list
> >> >>>>> Scons-***@scons.org
> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>>
> >> >>>>
> >> >>>> _______________________________________________
> >> >>>> Scons-users mailing list
> >> >>>> Scons-***@scons.org
> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>>
> >> >>>
> >> >>>
> >> >>> _______________________________________________
> >> >>> Scons-users mailing list
> >> >>> Scons-***@scons.org
> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>
> >> _______________________________________________
> >> Scons-users mailing list
> >> Scons-***@scons.org
> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Spencer Yost
2018-02-18 03:54:38 UTC
Permalink
Just as an offhand comment, that is sort of related to this. First, I don't have to import a lot.

We just converted our build system to SCons(~1600+ packages, ~15000 source files and tens of millions of lines of code). Because python expertise ranges from completely lacking to extremely poor :-) in our c/c++ staff; the powers that be indicated that developers will not maintain SConscript files. They will maintain the original build configuration files that we had(something that approximates a win.ini file). That means I have to rebuild SConscript files for every original configuration file we had. Trying to figure out a way to programmatically consolidate them to minimize the number of SConscript files was nearly impossible. So we have about 1600 SConscript files. Stuff like library dependencies vary between "packages" very frequently too. In addition the staff has to be able to build an individual "package" or the whole tree. I have a builder that creates the SConscript file whenever this original build configuration file changes. So it's not a big deal. But consolidating them was just way too big of a fish to fry in the time and budget allowed.

Sometimes you just have to have a bunch of them.

PS: SCons is working great for us. Dependencies are much more robust, speed is marginally better and the entire arc from source code change to Debian package creation is flawless. Being able to create command line options has been a godsend for us. Previously we would have to create build macros to emulate what command line options do.

Spencer Yost

> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com> wrote:
>
> Hua,
>
> From the tree you've shared, I'm going to guess you have way more SConscripts than you need.
>
> For example, you're set of test directories could have a single SConscript instead of one per.
> Which no doubt are just a few lines each.
>
> In some cases it looks like you have a SConscript in a directory which only has a header file (or none) and then a directory (or more) of source code. Skip the SConscript in the basically no-op directorie(s).
>
> Another suggestion, use variant dirs so you're not creating build files in your source directory.
>
> If you find yourself with a ton of very small SConscripts, it's a sign that you may be doing something non-scons'ian.
>
> Of course it also depends on how working on each group of code is split up between different developers.
>
> There is some art in structuring your build system (and your code) such that engineers rarely end up causing merge conflicts with each other.
>
> I can see some value in default_import, but it would be something requiring some debate on getting accepted.
> As far as I can recall, your's is the first request for something like this in the history of SCons (or at least as long as I've been involved).
>
> Philosophically SCons is about being explicit in the build requirements and also about being correct by design. Yielding reproducible builds regardless of the individual developers shell and machine setup.
>
>
>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com> wrote:
>> Hi Bill,
>> I do not create a SConscript for every directory, only for directly
>> which either provide a set of include file or having source code to
>> build.
>> I will try to create a minimal version of the build system to show the idea.
>>
>> Not sure if the below tree will give you some idea what I am trying to
>> implement, at least you should be able to see where I am having a
>> SConscript file.
>> build/configs/riscv_example/riscv32-qemu-virt-main/
>> ├── cmdlist.txt
>> ├── config
>> │ └── config.h
>> ├── firmware
>> │ ├── arch
>> │ │ ├── include
>> │ │ │ └── arch
>> │ │ │ ├── cache.h
>> │ │ │ ├── irq.h
>> │ │ │ ├── misc.h
>> │ │ │ ├── mmu.h
>> │ │ │ ├── smp.h
>> │ │ │ ├── spinlock.h
>> │ │ │ └── timer.h
>> │ │ ├── riscv
>> │ │ │ ├── helper.c
>> │ │ │ ├── helper.o
>> │ │ │ ├── libdefault.o
>> │ │ │ ├── main.c
>> │ │ │ ├── main.o
>> │ │ │ ├── SConscript
>> │ │ │ ├── start.o
>> │ │ │ └── start.S
>> │ │ ├── SConscript
>> │ │ ├── weak.c
>> │ │ └── weak.o
>> │ ├── boards
>> │ │ ├── include
>> │ │ │ └── board.h
>> │ │ ├── qemu-riscv32-virt
>> │ │ │ ├── board.c
>> │ │ │ ├── board.o
>> │ │ │ ├── SConscript
>> │ │ │ ├── uart16550_device.c
>> │ │ │ └── uart16550_device.o
>> │ │ └── SConscript
>> │ ├── common
>> │ │ ├── cpu.c
>> │ │ ├── cpu.o
>> │ │ ├── include
>> │ │ │ └── common
>> │ │ │ ├── common.h
>> │ │ │ ├── cpu.h
>> │ │ │ └── log.h
>> │ │ ├── libdefault.o
>> │ │ ├── log.c
>> │ │ ├── log.o
>> │ │ ├── main.c
>> │ │ ├── main.o
>> │ │ ├── SConscript
>> │ │ ├── weak.c
>> │ │ └── weak.o
>> │ ├── drivers
>> │ │ └── uart16550
>> │ │ ├── fd_ops.c
>> │ │ ├── fd_ops.o
>> │ │ ├── include
>> │ │ │ ├── uart16550_api.h
>> │ │ │ └── uart16550_device.h
>> │ │ ├── libdefault.o
>> │ │ ├── SConscript
>> │ │ ├── uart16550.c
>> │ │ └── uart16550.o
>> │ ├── include
>> │ │ ├── bootstage.h
>> │ │ ├── compiler.h
>> │ │ ├── debug.h
>> │ │ └── linux
>> │ │ └── typecheck.h
>> │ ├── lib
>> │ │ ├── cmd
>> │ │ │ ├── cmd.c
>> │ │ │ ├── cmd.o
>> │ │ │ ├── include
>> │ │ │ │ └── cmd
>> │ │ │ │ └── cmd.h
>> │ │ │ ├── SConscript
>> │ │ │ ├── test.c
>> │ │ │ └── test.o
>> │ │ ├── fio
>> │ │ │ ├── cmd.c
>> │ │ │ ├── cmd.o
>> │ │ │ ├── include
>> │ │ │ │ └── usw_device_public.h
>> │ │ │ ├── libdefault.o
>> │ │ │ ├── newlib.c
>> │ │ │ ├── newlib.o
>> │ │ │ ├── SConscript
>> │ │ │ ├── usw_device.c
>> │ │ │ ├── usw_device.o
>> │ │ │ └── usw_device_private.h
>> │ │ ├── pipe
>> │ │ │ ├── include
>> │ │ │ │ └── pipe
>> │ │ │ │ ├── pipe.h
>> │ │ │ │ └── status.h
>> │ │ │ ├── libdefault.o
>> │ │ │ ├── pipe.c
>> │ │ │ ├── pipe.o
>> │ │ │ └── SConscript
>> │ │ └── simple_console
>> │ │ ├── include
>> │ │ │ └── simple_console.h
>> │ │ ├── libdefault.o
>> │ │ ├── print_color.h
>> │ │ ├── SConscript
>> │ │ ├── simple_console.c
>> │ │ └── simple_console.o
>> │ ├── SConscript
>> │ └── test
>> │ ├── common
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── console
>> │ │ ├── hello.c
>> │ │ ├── hello.o
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── example
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── libc
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── linker
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── log
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ └── setjmp
>> │ ├── SConscript
>> │ ├── test2.c
>> │ ├── test2.o
>> │ ├── test.c
>> │ └── test.o
>> ├── libriscv_example.a
>> ├── link.ld
>> ├── riscv_example.bin
>> ├── riscv_example.elf
>> ├── riscv_example.ibi_bin
>> ├── riscv_example.map
>> └── riscv_example.S
>>
>> 36 directories, 113 files
>>
>>
>>
>>
>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan <***@baddogconsulting.com> wrote:
>> > Likely you don't need a SConscript for every directory in your case?
>> > Are you wrapping a complete linux build tree?
>> >
>> > Is this a build tree you can share for us to look at?
>> >
>> > -Bill
>> >
>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com> wrote:
>> >>
>> >> I see everything passed into env.SConscript(default_import=some_obj),
>> >> if some_obj is a string it can pass through but if some_obj is a
>> >> function object it end up as None in Script/SConscript.py/SConscript()
>> >> function.
>> >>
>> >> I could have used a string and then import the right function however
>> >> my function to be passed is a dynamically generated partial function
>> >> ...
>> >>
>> >> Could anyone please give me some hint how could this be best implemented?
>> >>
>> >> Best Regards,
>> >> Yanghao
>> >>
>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com> wrote:
>> >> > @Bill, I have managed to hack the Frame class and the
>> >> > BuildDefaultGlobals() function to have some thing imported into
>> >> > SConscript by default.
>> >> > However I don't quite understand when the "default_import" keyword
>> >> > argument passed down, somewhere somehow it end up as a set.
>> >> >
>> >> > Any documentation to explain what is going on from Base class into
>> >> > SConscript() calls regarding parameter handling?
>> >> >
>> >> > Thanks,
>> >> > Yanghao
>> >> >
>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
>> >> > wrote:
>> >> >> It varies a lot, ranging from 0 (yes, no source files at all) to a few
>> >> >> dozen (didn't really count, see statistics below).
>> >> >>
>> >> >> Here is an example Linux kernel driver sub-module Makefile:
>> >> >>
>> >> >> linux/drivers/sn/Makefile:
>> >> >> 1 #
>> >> >> 2 # Makefile for the Altix device drivers.
>> >> >> 3 #
>> >> >> 4 #
>> >> >> 5
>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>> >> >>
>> >> >> I want to replicate this kind of simplicity in scons.
>> >> >>
>> >> >> I actually have implemented almost the same thing in scons, but all
>> >> >> those SConscript files have to start with Import("my_func") ... which
>> >> >> is pretty annoying. I know I need it in every single SConscript, and I
>> >> >> have to repeat it ... and this is so anti-pattern.
>> >> >> I have get rid of the Return() part already, but getting rid of the
>> >> >> Import() part seems not that straightforward.
>> >> >>
>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>> >> >> 121 121 5953
>> >> >>
>> >> >> At the moment the project supports 4 different CPU architectures, a
>> >> >> little less than 1000 C files, 400K+ lines of code.
>> >> >>
>> >> >> And this is no small problem (at least for me). If I start working
>> >> >> around it with too much python code, I might end up bypassing a
>> >> >> significant portion of core scons and eventually might find it easier
>> >> >> to just wrap around Makefiles.
>> >> >>
>> >> >> Someone thought I was criticizing scons, I actually love scons, but
>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me as an
>> >> >> enemy I am a serious user of scons since 10 years ago when I was still
>> >> >> in college.
>> >> >>
>> >> >> Best Regards,
>> >> >> Yanghao
>> >> >>
>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>> >> >> <***@baddogconsulting.com> wrote:
>> >> >>> How many source files per SConscript?
>> >> >>> That's a lot of sconscripts.
>> >> >>> Is this all one project?
>> >> >>> Are all the SConscripts identical?
>> >> >>>
>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com>
>> >> >>> wrote:
>> >> >>>>
>> >> >>>> Actually I have one and only one import for hundreds of SConscript :)
>> >> >>>>
>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>> >> >>>> <***@gmail.com> wrote:
>> >> >>>>>
>> >> >>>>> Hua,
>> >> >>>>>
>> >> >>>>> If you are importing lots of variables into SConscripts, then you're
>> >> >>>>> using SCons wrong. Most of your variables should probably be
>> >> >>>>> construction
>> >> >>>>> variables (in the environment).
>> >> >>>>>
>> >> >>>>> I've written many, many SConscripts and I've never used more than 3
>> >> >>>>> or 4
>> >> >>>>> Import() statements in a single SConscript. Before you critique a
>> >> >>>>> long-established framework, you might want to consider if you're
>> >> >>>>> using it
>> >> >>>>> inappropriately.
>> >> >>>>>
>> >> >>>>> Jonathon
>> >> >>>>>
>> >> >>>>>
>> >> >>>>>
>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
>> >> >>>>> wrote:
>> >> >>>>>>
>> >> >>>>>> Will do. It is really not good if a particular framework force user
>> >> >>>>>> to
>> >> >>>>>> create repeated code. In comparison kbuild can easily create a one
>> >> >>>>>> line make
>> >> >>>>>> file for a module.
>> >> >>>>>>
>> >> >>>>>> I am using localized scons anyway if not accepted will just use it
>> >> >>>>>> on my
>> >> >>>>>> own.
>> >> >>>>>>
>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>> >> >>>>>> <***@baddogconsulting.com>
>> >> >>>>>> wrote:
>> >> >>>>>>>
>> >> >>>>>>> Feel free to make a pull request, though I can't promise that it
>> >> >>>>>>> will
>> >> >>>>>>> be accepted.
>> >> >>>>>>>
>> >> >>>>>>> Is it really that much of an inconvenience?
>> >> >>>>>>> -Bill
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>> >> >>>>>>> <***@gmail.com>
>> >> >>>>>>> wrote:
>> >> >>>>>>>>
>> >> >>>>>>>> Hi Bill,
>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>> >> >>>>>>>> For return I think I can abuse some global variables. This can
>> >> >>>>>>>> really
>> >> >>>>>>>> make the SConscript clean/minimal.
>> >> >>>>>>>>
>> >> >>>>>>>> Best Regards,
>> >> >>>>>>>> Yanghao
>> >> >>>>>>>>
>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
>> >> >>>>>>>> > No, there is no way without hacking the core code.
>> >> >>>>>>>> >
>> >> >>>>>>>> > It is the way it is by design.
>> >> >>>>>>>> >
>> >> >>>>>>>> > -Bill
>> >> >>>>>>>> > SCons Project Co-Manager
>> >> >>>>>>>> >
>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>> >> >>>>>>>> > <***@gmail.com>
>> >> >>>>>>>> > wrote:
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly make a
>> >> >>>>>>>> >> object
>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
>> >> >>>>>>>> >> Import(xyz)?
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in
>> >> >>>>>>>> >> every
>> >> >>>>>>>> >> single SConscript.
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>> >> >>>>>>>> >> object,
>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct want to
>> >> >>>>>>>> >> collect
>> >> >>>>>>>> >> the complete list of object returned from every single
>> >> >>>>>>>> >> SConscript.
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> For example:
>> >> >>>>>>>> >> SConscript-1:
>> >> >>>>>>>> >> Import("xyz")
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> ret = xyz(...)
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Return("ret")
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Would ideally become:
>> >> >>>>>>>> >> SConscript-2:
>> >> >>>>>>>> >> xyz(...)
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Thanks,
>> >> >>>>>>>> >> Yanghao
>> >> >>>>>>>> >> _______________________________________________
>> >> >>>>>>>> >> Scons-users mailing list
>> >> >>>>>>>> >> Scons-***@scons.org
>> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>>> >
>> >> >>>>>>>> >
>> >> >>>>>>>> >
>> >> >>>>>>>> > _______________________________________________
>> >> >>>>>>>> > Scons-users mailing list
>> >> >>>>>>>> > Scons-***@scons.org
>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>>> >
>> >> >>>>>>>> _______________________________________________
>> >> >>>>>>>> Scons-users mailing list
>> >> >>>>>>>> Scons-***@scons.org
>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>> _______________________________________________
>> >> >>>>>>> Scons-users mailing list
>> >> >>>>>>> Scons-***@scons.org
>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>
>> >> >>>>>>
>> >> >>>>>> _______________________________________________
>> >> >>>>>> Scons-users mailing list
>> >> >>>>>> Scons-***@scons.org
>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>
>> >> >>>>>
>> >> >>>>> _______________________________________________
>> >> >>>>> Scons-users mailing list
>> >> >>>>> Scons-***@scons.org
>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>
>> >> >>>>
>> >> >>>> _______________________________________________
>> >> >>>> Scons-users mailing list
>> >> >>>> Scons-***@scons.org
>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> Scons-users mailing list
>> >> >>> Scons-***@scons.org
>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>
>> >> _______________________________________________
>> >> Scons-users mailing list
>> >> Scons-***@scons.org
>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> >
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-***@scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
Hua Yanghao
2018-02-18 09:10:34 UTC
Permalink
On Sun, Feb 18, 2018 at 4:54 AM, Spencer Yost <***@triad.rr.com> wrote:
> Just as an offhand comment, that is sort of related to this. First, I don't
> have to import a lot.

Me too, just one Import() for me for each SConscript.

> We just converted our build system to SCons(~1600+ packages, ~15000 source
> files and tens of millions of lines of code). Because python expertise
> ranges from completely lacking to extremely poor :-) in our c/c++ staff; the
> powers that be indicated that developers will not maintain SConscript files.
> They will maintain the original build configuration files that we
> had(something that approximates a win.ini file). That means I have to
> rebuild SConscript files for every original configuration file we had.

This is really something for me as a last resort. First my project is
relatively new
and I actually want to promote scons instead of hiding scons for the rest of the
developers. I will take a look into scons internal if I cannot
implement the default
import thing I will use your approach.

> Trying to figure out a way to programmatically consolidate them to minimize
> the number of SConscript files was nearly impossible. So we have about 1600
> SConscript files. Stuff like library dependencies vary between "packages"
> very frequently too. In addition the staff has to be able to build an
> individual "package" or the whole tree. I have a builder that creates the
> SConscript file whenever this original build configuration file changes. So
> it's not a big deal. But consolidating them was just way too big of a fish
> to fry in the time and budget allowed.
>
> Sometimes you just have to have a bunch of them.
>
> PS: SCons is working great for us. Dependencies are much more robust, speed
> is marginally better and the entire arc from source code change to Debian
> package creation is flawless. Being able to create command line options has
> been a godsend for us. Previously we would have to create build macros to
> emulate what command line options do.
>
> Spencer Yost

Yes scons worked pretty well for me in the past years and I just want to see if
I can push it to achieve the same level of simplicity/readability of
kbuild system.

thanks a lot for your real world experience it helped a lot.

Best Regards,
Yanghao
Bill Deegan
2018-02-18 14:54:06 UTC
Permalink
Spencer,

So your build info source are these .ini files?
And your SConscript files just process them?

-Bill

On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com> wrote:

> Just as an offhand comment, that is sort of related to this. First, I
> don't have to import a lot.
>
> We just converted our build system to SCons(~1600+ packages, ~15000 source
> files and tens of millions of lines of code). Because python expertise
> ranges from completely lacking to extremely poor :-) in our c/c++ staff;
> the powers that be indicated that developers will not maintain SConscript
> files. They will maintain the original build configuration files that we
> had(something that approximates a win.ini file). That means I have to
> rebuild SConscript files for every original configuration file we had.
> Trying to figure out a way to programmatically consolidate them to minimize
> the number of SConscript files was nearly impossible. So we have about 1600
> SConscript files. Stuff like library dependencies vary between
> "packages" very frequently too. In addition the staff has to be able to
> build an individual "package" or the whole tree. I have a builder that
> creates the SConscript file whenever this original build configuration file
> changes. So it's not a big deal. But consolidating them was just way too
> big of a fish to fry in the time and budget allowed.
>
> Sometimes you just have to have a bunch of them.
>
> PS: SCons is working great for us. Dependencies are much more robust,
> speed is marginally better and the entire arc from source code change to
> Debian package creation is flawless. Being able to create command line
> options has been a godsend for us. Previously we would have to create
> build macros to emulate what command line options do.
>
> Spencer Yost
>
> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
>
> Hua,
>
> From the tree you've shared, I'm going to guess you have way more
> SConscripts than you need.
>
> For example, you're set of test directories could have a single SConscript
> instead of one per.
> Which no doubt are just a few lines each.
>
> In some cases it looks like you have a SConscript in a directory which
> only has a header file (or none) and then a directory (or more) of source
> code. Skip the SConscript in the basically no-op directorie(s).
>
> Another suggestion, use variant dirs so you're not creating build files in
> your source directory.
>
> If you find yourself with a ton of very small SConscripts, it's a sign
> that you may be doing something non-scons'ian.
>
> Of course it also depends on how working on each group of code is split up
> between different developers.
>
> There is some art in structuring your build system (and your code) such
> that engineers rarely end up causing merge conflicts with each other.
>
> I can see some value in default_import, but it would be something
> requiring some debate on getting accepted.
> As far as I can recall, your's is the first request for something like
> this in the history of SCons (or at least as long as I've been involved).
>
> Philosophically SCons is about being explicit in the build requirements
> and also about being correct by design. Yielding reproducible builds
> regardless of the individual developers shell and machine setup.
>
>
> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com> wrote:
>
>> Hi Bill,
>> I do not create a SConscript for every directory, only for directly
>> which either provide a set of include file or having source code to
>> build.
>> I will try to create a minimal version of the build system to show the
>> idea.
>>
>> Not sure if the below tree will give you some idea what I am trying to
>> implement, at least you should be able to see where I am having a
>> SConscript file.
>> build/configs/riscv_example/riscv32-qemu-virt-main/
>> ├── cmdlist.txt
>> ├── config
>> │ └── config.h
>> ├── firmware
>> │ ├── arch
>> │ │ ├── include
>> │ │ │ └── arch
>> │ │ │ ├── cache.h
>> │ │ │ ├── irq.h
>> │ │ │ ├── misc.h
>> │ │ │ ├── mmu.h
>> │ │ │ ├── smp.h
>> │ │ │ ├── spinlock.h
>> │ │ │ └── timer.h
>> │ │ ├── riscv
>> │ │ │ ├── helper.c
>> │ │ │ ├── helper.o
>> │ │ │ ├── libdefault.o
>> │ │ │ ├── main.c
>> │ │ │ ├── main.o
>> │ │ │ ├── SConscript
>> │ │ │ ├── start.o
>> │ │ │ └── start.S
>> │ │ ├── SConscript
>> │ │ ├── weak.c
>> │ │ └── weak.o
>> │ ├── boards
>> │ │ ├── include
>> │ │ │ └── board.h
>> │ │ ├── qemu-riscv32-virt
>> │ │ │ ├── board.c
>> │ │ │ ├── board.o
>> │ │ │ ├── SConscript
>> │ │ │ ├── uart16550_device.c
>> │ │ │ └── uart16550_device.o
>> │ │ └── SConscript
>> │ ├── common
>> │ │ ├── cpu.c
>> │ │ ├── cpu.o
>> │ │ ├── include
>> │ │ │ └── common
>> │ │ │ ├── common.h
>> │ │ │ ├── cpu.h
>> │ │ │ └── log.h
>> │ │ ├── libdefault.o
>> │ │ ├── log.c
>> │ │ ├── log.o
>> │ │ ├── main.c
>> │ │ ├── main.o
>> │ │ ├── SConscript
>> │ │ ├── weak.c
>> │ │ └── weak.o
>> │ ├── drivers
>> │ │ └── uart16550
>> │ │ ├── fd_ops.c
>> │ │ ├── fd_ops.o
>> │ │ ├── include
>> │ │ │ ├── uart16550_api.h
>> │ │ │ └── uart16550_device.h
>> │ │ ├── libdefault.o
>> │ │ ├── SConscript
>> │ │ ├── uart16550.c
>> │ │ └── uart16550.o
>> │ ├── include
>> │ │ ├── bootstage.h
>> │ │ ├── compiler.h
>> │ │ ├── debug.h
>> │ │ └── linux
>> │ │ └── typecheck.h
>> │ ├── lib
>> │ │ ├── cmd
>> │ │ │ ├── cmd.c
>> │ │ │ ├── cmd.o
>> │ │ │ ├── include
>> │ │ │ │ └── cmd
>> │ │ │ │ └── cmd.h
>> │ │ │ ├── SConscript
>> │ │ │ ├── test.c
>> │ │ │ └── test.o
>> │ │ ├── fio
>> │ │ │ ├── cmd.c
>> │ │ │ ├── cmd.o
>> │ │ │ ├── include
>> │ │ │ │ └── usw_device_public.h
>> │ │ │ ├── libdefault.o
>> │ │ │ ├── newlib.c
>> │ │ │ ├── newlib.o
>> │ │ │ ├── SConscript
>> │ │ │ ├── usw_device.c
>> │ │ │ ├── usw_device.o
>> │ │ │ └── usw_device_private.h
>> │ │ ├── pipe
>> │ │ │ ├── include
>> │ │ │ │ └── pipe
>> │ │ │ │ ├── pipe.h
>> │ │ │ │ └── status.h
>> │ │ │ ├── libdefault.o
>> │ │ │ ├── pipe.c
>> │ │ │ ├── pipe.o
>> │ │ │ └── SConscript
>> │ │ └── simple_console
>> │ │ ├── include
>> │ │ │ └── simple_console.h
>> │ │ ├── libdefault.o
>> │ │ ├── print_color.h
>> │ │ ├── SConscript
>> │ │ ├── simple_console.c
>> │ │ └── simple_console.o
>> │ ├── SConscript
>> │ └── test
>> │ ├── common
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── console
>> │ │ ├── hello.c
>> │ │ ├── hello.o
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── example
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── libc
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── linker
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ ├── log
>> │ │ ├── SConscript
>> │ │ ├── test.c
>> │ │ └── test.o
>> │ └── setjmp
>> │ ├── SConscript
>> │ ├── test2.c
>> │ ├── test2.o
>> │ ├── test.c
>> │ └── test.o
>> ├── libriscv_example.a
>> ├── link.ld
>> ├── riscv_example.bin
>> ├── riscv_example.elf
>> ├── riscv_example.ibi_bin
>> ├── riscv_example.map
>> └── riscv_example.S
>>
>> 36 directories, 113 files
>>
>>
>>
>>
>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan <***@baddogconsulting.com>
>> wrote:
>> > Likely you don't need a SConscript for every directory in your case?
>> > Are you wrapping a complete linux build tree?
>> >
>> > Is this a build tree you can share for us to look at?
>> >
>> > -Bill
>> >
>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com>
>> wrote:
>> >>
>> >> I see everything passed into env.SConscript(default_import=some_obj),
>> >> if some_obj is a string it can pass through but if some_obj is a
>> >> function object it end up as None in Script/SConscript.py/SConscript()
>> >> function.
>> >>
>> >> I could have used a string and then import the right function however
>> >> my function to be passed is a dynamically generated partial function
>> >> ...
>> >>
>> >> Could anyone please give me some hint how could this be best
>> implemented?
>> >>
>> >> Best Regards,
>> >> Yanghao
>> >>
>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com>
>> wrote:
>> >> > @Bill, I have managed to hack the Frame class and the
>> >> > BuildDefaultGlobals() function to have some thing imported into
>> >> > SConscript by default.
>> >> > However I don't quite understand when the "default_import" keyword
>> >> > argument passed down, somewhere somehow it end up as a set.
>> >> >
>> >> > Any documentation to explain what is going on from Base class into
>> >> > SConscript() calls regarding parameter handling?
>> >> >
>> >> > Thanks,
>> >> > Yanghao
>> >> >
>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
>> >> > wrote:
>> >> >> It varies a lot, ranging from 0 (yes, no source files at all) to a
>> few
>> >> >> dozen (didn't really count, see statistics below).
>> >> >>
>> >> >> Here is an example Linux kernel driver sub-module Makefile:
>> >> >>
>> >> >> linux/drivers/sn/Makefile:
>> >> >> 1 #
>> >> >> 2 # Makefile for the Altix device drivers.
>> >> >> 3 #
>> >> >> 4 #
>> >> >> 5
>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>> >> >>
>> >> >> I want to replicate this kind of simplicity in scons.
>> >> >>
>> >> >> I actually have implemented almost the same thing in scons, but all
>> >> >> those SConscript files have to start with Import("my_func") ...
>> which
>> >> >> is pretty annoying. I know I need it in every single SConscript,
>> and I
>> >> >> have to repeat it ... and this is so anti-pattern.
>> >> >> I have get rid of the Return() part already, but getting rid of the
>> >> >> Import() part seems not that straightforward.
>> >> >>
>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>> >> >> 121 121 5953
>> >> >>
>> >> >> At the moment the project supports 4 different CPU architectures, a
>> >> >> little less than 1000 C files, 400K+ lines of code.
>> >> >>
>> >> >> And this is no small problem (at least for me). If I start working
>> >> >> around it with too much python code, I might end up bypassing a
>> >> >> significant portion of core scons and eventually might find it
>> easier
>> >> >> to just wrap around Makefiles.
>> >> >>
>> >> >> Someone thought I was criticizing scons, I actually love scons, but
>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me as an
>> >> >> enemy I am a serious user of scons since 10 years ago when I was
>> still
>> >> >> in college.
>> >> >>
>> >> >> Best Regards,
>> >> >> Yanghao
>> >> >>
>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>> >> >> <***@baddogconsulting.com> wrote:
>> >> >>> How many source files per SConscript?
>> >> >>> That's a lot of sconscripts.
>> >> >>> Is this all one project?
>> >> >>> Are all the SConscripts identical?
>> >> >>>
>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com
>> >
>> >> >>> wrote:
>> >> >>>>
>> >> >>>> Actually I have one and only one import for hundreds of
>> SConscript :)
>> >> >>>>
>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>> >> >>>> <***@gmail.com> wrote:
>> >> >>>>>
>> >> >>>>> Hua,
>> >> >>>>>
>> >> >>>>> If you are importing lots of variables into SConscripts, then
>> you're
>> >> >>>>> using SCons wrong. Most of your variables should probably be
>> >> >>>>> construction
>> >> >>>>> variables (in the environment).
>> >> >>>>>
>> >> >>>>> I've written many, many SConscripts and I've never used more
>> than 3
>> >> >>>>> or 4
>> >> >>>>> Import() statements in a single SConscript. Before you critique a
>> >> >>>>> long-established framework, you might want to consider if you're
>> >> >>>>> using it
>> >> >>>>> inappropriately.
>> >> >>>>>
>> >> >>>>> Jonathon
>> >> >>>>>
>> >> >>>>>
>> >> >>>>>
>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <
>> ***@gmail.com>
>> >> >>>>> wrote:
>> >> >>>>>>
>> >> >>>>>> Will do. It is really not good if a particular framework force
>> user
>> >> >>>>>> to
>> >> >>>>>> create repeated code. In comparison kbuild can easily create a
>> one
>> >> >>>>>> line make
>> >> >>>>>> file for a module.
>> >> >>>>>>
>> >> >>>>>> I am using localized scons anyway if not accepted will just use
>> it
>> >> >>>>>> on my
>> >> >>>>>> own.
>> >> >>>>>>
>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>> >> >>>>>> <***@baddogconsulting.com>
>> >> >>>>>> wrote:
>> >> >>>>>>>
>> >> >>>>>>> Feel free to make a pull request, though I can't promise that
>> it
>> >> >>>>>>> will
>> >> >>>>>>> be accepted.
>> >> >>>>>>>
>> >> >>>>>>> Is it really that much of an inconvenience?
>> >> >>>>>>> -Bill
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>> >> >>>>>>> <***@gmail.com>
>> >> >>>>>>> wrote:
>> >> >>>>>>>>
>> >> >>>>>>>> Hi Bill,
>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>> >> >>>>>>>> For return I think I can abuse some global variables. This can
>> >> >>>>>>>> really
>> >> >>>>>>>> make the SConscript clean/minimal.
>> >> >>>>>>>>
>> >> >>>>>>>> Best Regards,
>> >> >>>>>>>> Yanghao
>> >> >>>>>>>>
>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
>> >> >>>>>>>> > No, there is no way without hacking the core code.
>> >> >>>>>>>> >
>> >> >>>>>>>> > It is the way it is by design.
>> >> >>>>>>>> >
>> >> >>>>>>>> > -Bill
>> >> >>>>>>>> > SCons Project Co-Manager
>> >> >>>>>>>> >
>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>> >> >>>>>>>> > <***@gmail.com>
>> >> >>>>>>>> > wrote:
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly
>> make a
>> >> >>>>>>>> >> object
>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
>> >> >>>>>>>> >> Import(xyz)?
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in
>> >> >>>>>>>> >> every
>> >> >>>>>>>> >> single SConscript.
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a
>> list of
>> >> >>>>>>>> >> object,
>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct want
>> to
>> >> >>>>>>>> >> collect
>> >> >>>>>>>> >> the complete list of object returned from every single
>> >> >>>>>>>> >> SConscript.
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> For example:
>> >> >>>>>>>> >> SConscript-1:
>> >> >>>>>>>> >> Import("xyz")
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> ret = xyz(...)
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Return("ret")
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Would ideally become:
>> >> >>>>>>>> >> SConscript-2:
>> >> >>>>>>>> >> xyz(...)
>> >> >>>>>>>> >>
>> >> >>>>>>>> >> Thanks,
>> >> >>>>>>>> >> Yanghao
>> >> >>>>>>>> >> _______________________________________________
>> >> >>>>>>>> >> Scons-users mailing list
>> >> >>>>>>>> >> Scons-***@scons.org
>> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>>> >
>> >> >>>>>>>> >
>> >> >>>>>>>> >
>> >> >>>>>>>> > _______________________________________________
>> >> >>>>>>>> > Scons-users mailing list
>> >> >>>>>>>> > Scons-***@scons.org
>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>>> >
>> >> >>>>>>>> _______________________________________________
>> >> >>>>>>>> Scons-users mailing list
>> >> >>>>>>>> Scons-***@scons.org
>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>> _______________________________________________
>> >> >>>>>>> Scons-users mailing list
>> >> >>>>>>> Scons-***@scons.org
>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>
>> >> >>>>>>
>> >> >>>>>> _______________________________________________
>> >> >>>>>> Scons-users mailing list
>> >> >>>>>> Scons-***@scons.org
>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>>>
>> >> >>>>>
>> >> >>>>> _______________________________________________
>> >> >>>>> Scons-users mailing list
>> >> >>>>> Scons-***@scons.org
>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>
>> >> >>>>
>> >> >>>> _______________________________________________
>> >> >>>> Scons-users mailing list
>> >> >>>> Scons-***@scons.org
>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> Scons-users mailing list
>> >> >>> Scons-***@scons.org
>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>
>> >> _______________________________________________
>> >> Scons-users mailing list
>> >> Scons-***@scons.org
>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> >
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-***@scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
Spencer Yost
2018-02-19 04:08:16 UTC
Permalink
Right, our SConstruct walks the target, looking for the ini files. If it finds one, it passes them to the SConscript builder. The builder obviously creates an SConscript if the the ini file has changed. We then pass this SConscript to the SConscript() call.

Again, our original build configuration files are sort of approximation an ini file - but not exact. The builder is actually several hundred lines of Python code. Because they are not exactly what the configparser module needs we have to create a temporary file that is the result of massaging and correcting the original and parse that temp file.

PS: Don't get me wrong, we don't have this nailed down exactly yet. There are some deliverables what we are still working on. For example our config files deliver individual files that are contained within tar files. This seems to be opposite of what the Scons tarfile builder does(builds tar files from a collection of files). We have not cracked nut not yet.

Spencer Yost

> On Feb 18, 2018, at 9:54 AM, Bill Deegan <***@baddogconsulting.com> wrote:
>
> Spencer,
>
> So your build info source are these .ini files?
> And your SConscript files just process them?
>
> -Bill
>
>> On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com> wrote:
>> Just as an offhand comment, that is sort of related to this. First, I don't have to import a lot.
>>
>> We just converted our build system to SCons(~1600+ packages, ~15000 source files and tens of millions of lines of code). Because python expertise ranges from completely lacking to extremely poor :-) in our c/c++ staff; the powers that be indicated that developers will not maintain SConscript files. They will maintain the original build configuration files that we had(something that approximates a win.ini file). That means I have to rebuild SConscript files for every original configuration file we had. Trying to figure out a way to programmatically consolidate them to minimize the number of SConscript files was nearly impossible. So we have about 1600 SConscript files. Stuff like library dependencies vary between "packages" very frequently too. In addition the staff has to be able to build an individual "package" or the whole tree. I have a builder that creates the SConscript file whenever this original build configuration file changes. So it's not a big deal. But consolidating them was just way too big of a fish to fry in the time and budget allowed.
>>
>> Sometimes you just have to have a bunch of them.
>>
>> PS: SCons is working great for us. Dependencies are much more robust, speed is marginally better and the entire arc from source code change to Debian package creation is flawless. Being able to create command line options has been a godsend for us. Previously we would have to create build macros to emulate what command line options do.
>>
>> Spencer Yost
>>
>>> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com> wrote:
>>>
>>> Hua,
>>>
>>> From the tree you've shared, I'm going to guess you have way more SConscripts than you need.
>>>
>>> For example, you're set of test directories could have a single SConscript instead of one per.
>>> Which no doubt are just a few lines each.
>>>
>>> In some cases it looks like you have a SConscript in a directory which only has a header file (or none) and then a directory (or more) of source code. Skip the SConscript in the basically no-op directorie(s).
>>>
>>> Another suggestion, use variant dirs so you're not creating build files in your source directory.
>>>
>>> If you find yourself with a ton of very small SConscripts, it's a sign that you may be doing something non-scons'ian.
>>>
>>> Of course it also depends on how working on each group of code is split up between different developers.
>>>
>>> There is some art in structuring your build system (and your code) such that engineers rarely end up causing merge conflicts with each other.
>>>
>>> I can see some value in default_import, but it would be something requiring some debate on getting accepted.
>>> As far as I can recall, your's is the first request for something like this in the history of SCons (or at least as long as I've been involved).
>>>
>>> Philosophically SCons is about being explicit in the build requirements and also about being correct by design. Yielding reproducible builds regardless of the individual developers shell and machine setup.
>>>
>>>
>>>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com> wrote:
>>>> Hi Bill,
>>>> I do not create a SConscript for every directory, only for directly
>>>> which either provide a set of include file or having source code to
>>>> build.
>>>> I will try to create a minimal version of the build system to show the idea.
>>>>
>>>> Not sure if the below tree will give you some idea what I am trying to
>>>> implement, at least you should be able to see where I am having a
>>>> SConscript file.
>>>> build/configs/riscv_example/riscv32-qemu-virt-main/
>>>> ├── cmdlist.txt
>>>> ├── config
>>>> │ └── config.h
>>>> ├── firmware
>>>> │ ├── arch
>>>> │ │ ├── include
>>>> │ │ │ └── arch
>>>> │ │ │ ├── cache.h
>>>> │ │ │ ├── irq.h
>>>> │ │ │ ├── misc.h
>>>> │ │ │ ├── mmu.h
>>>> │ │ │ ├── smp.h
>>>> │ │ │ ├── spinlock.h
>>>> │ │ │ └── timer.h
>>>> │ │ ├── riscv
>>>> │ │ │ ├── helper.c
>>>> │ │ │ ├── helper.o
>>>> │ │ │ ├── libdefault.o
>>>> │ │ │ ├── main.c
>>>> │ │ │ ├── main.o
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── start.o
>>>> │ │ │ └── start.S
>>>> │ │ ├── SConscript
>>>> │ │ ├── weak.c
>>>> │ │ └── weak.o
>>>> │ ├── boards
>>>> │ │ ├── include
>>>> │ │ │ └── board.h
>>>> │ │ ├── qemu-riscv32-virt
>>>> │ │ │ ├── board.c
>>>> │ │ │ ├── board.o
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── uart16550_device.c
>>>> │ │ │ └── uart16550_device.o
>>>> │ │ └── SConscript
>>>> │ ├── common
>>>> │ │ ├── cpu.c
>>>> │ │ ├── cpu.o
>>>> │ │ ├── include
>>>> │ │ │ └── common
>>>> │ │ │ ├── common.h
>>>> │ │ │ ├── cpu.h
>>>> │ │ │ └── log.h
>>>> │ │ ├── libdefault.o
>>>> │ │ ├── log.c
>>>> │ │ ├── log.o
>>>> │ │ ├── main.c
>>>> │ │ ├── main.o
>>>> │ │ ├── SConscript
>>>> │ │ ├── weak.c
>>>> │ │ └── weak.o
>>>> │ ├── drivers
>>>> │ │ └── uart16550
>>>> │ │ ├── fd_ops.c
>>>> │ │ ├── fd_ops.o
>>>> │ │ ├── include
>>>> │ │ │ ├── uart16550_api.h
>>>> │ │ │ └── uart16550_device.h
>>>> │ │ ├── libdefault.o
>>>> │ │ ├── SConscript
>>>> │ │ ├── uart16550.c
>>>> │ │ └── uart16550.o
>>>> │ ├── include
>>>> │ │ ├── bootstage.h
>>>> │ │ ├── compiler.h
>>>> │ │ ├── debug.h
>>>> │ │ └── linux
>>>> │ │ └── typecheck.h
>>>> │ ├── lib
>>>> │ │ ├── cmd
>>>> │ │ │ ├── cmd.c
>>>> │ │ │ ├── cmd.o
>>>> │ │ │ ├── include
>>>> │ │ │ │ └── cmd
>>>> │ │ │ │ └── cmd.h
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── test.c
>>>> │ │ │ └── test.o
>>>> │ │ ├── fio
>>>> │ │ │ ├── cmd.c
>>>> │ │ │ ├── cmd.o
>>>> │ │ │ ├── include
>>>> │ │ │ │ └── usw_device_public.h
>>>> │ │ │ ├── libdefault.o
>>>> │ │ │ ├── newlib.c
>>>> │ │ │ ├── newlib.o
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── usw_device.c
>>>> │ │ │ ├── usw_device.o
>>>> │ │ │ └── usw_device_private.h
>>>> │ │ ├── pipe
>>>> │ │ │ ├── include
>>>> │ │ │ │ └── pipe
>>>> │ │ │ │ ├── pipe.h
>>>> │ │ │ │ └── status.h
>>>> │ │ │ ├── libdefault.o
>>>> │ │ │ ├── pipe.c
>>>> │ │ │ ├── pipe.o
>>>> │ │ │ └── SConscript
>>>> │ │ └── simple_console
>>>> │ │ ├── include
>>>> │ │ │ └── simple_console.h
>>>> │ │ ├── libdefault.o
>>>> │ │ ├── print_color.h
>>>> │ │ ├── SConscript
>>>> │ │ ├── simple_console.c
>>>> │ │ └── simple_console.o
>>>> │ ├── SConscript
>>>> │ └── test
>>>> │ ├── common
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── console
>>>> │ │ ├── hello.c
>>>> │ │ ├── hello.o
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── example
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── libc
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── linker
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── log
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ └── setjmp
>>>> │ ├── SConscript
>>>> │ ├── test2.c
>>>> │ ├── test2.o
>>>> │ ├── test.c
>>>> │ └── test.o
>>>> ├── libriscv_example.a
>>>> ├── link.ld
>>>> ├── riscv_example.bin
>>>> ├── riscv_example.elf
>>>> ├── riscv_example.ibi_bin
>>>> ├── riscv_example.map
>>>> └── riscv_example.S
>>>>
>>>> 36 directories, 113 files
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan <***@baddogconsulting.com> wrote:
>>>> > Likely you don't need a SConscript for every directory in your case?
>>>> > Are you wrapping a complete linux build tree?
>>>> >
>>>> > Is this a build tree you can share for us to look at?
>>>> >
>>>> > -Bill
>>>> >
>>>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com> wrote:
>>>> >>
>>>> >> I see everything passed into env.SConscript(default_import=some_obj),
>>>> >> if some_obj is a string it can pass through but if some_obj is a
>>>> >> function object it end up as None in Script/SConscript.py/SConscript()
>>>> >> function.
>>>> >>
>>>> >> I could have used a string and then import the right function however
>>>> >> my function to be passed is a dynamically generated partial function
>>>> >> ...
>>>> >>
>>>> >> Could anyone please give me some hint how could this be best implemented?
>>>> >>
>>>> >> Best Regards,
>>>> >> Yanghao
>>>> >>
>>>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com> wrote:
>>>> >> > @Bill, I have managed to hack the Frame class and the
>>>> >> > BuildDefaultGlobals() function to have some thing imported into
>>>> >> > SConscript by default.
>>>> >> > However I don't quite understand when the "default_import" keyword
>>>> >> > argument passed down, somewhere somehow it end up as a set.
>>>> >> >
>>>> >> > Any documentation to explain what is going on from Base class into
>>>> >> > SConscript() calls regarding parameter handling?
>>>> >> >
>>>> >> > Thanks,
>>>> >> > Yanghao
>>>> >> >
>>>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
>>>> >> > wrote:
>>>> >> >> It varies a lot, ranging from 0 (yes, no source files at all) to a few
>>>> >> >> dozen (didn't really count, see statistics below).
>>>> >> >>
>>>> >> >> Here is an example Linux kernel driver sub-module Makefile:
>>>> >> >>
>>>> >> >> linux/drivers/sn/Makefile:
>>>> >> >> 1 #
>>>> >> >> 2 # Makefile for the Altix device drivers.
>>>> >> >> 3 #
>>>> >> >> 4 #
>>>> >> >> 5
>>>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>>>> >> >>
>>>> >> >> I want to replicate this kind of simplicity in scons.
>>>> >> >>
>>>> >> >> I actually have implemented almost the same thing in scons, but all
>>>> >> >> those SConscript files have to start with Import("my_func") ... which
>>>> >> >> is pretty annoying. I know I need it in every single SConscript, and I
>>>> >> >> have to repeat it ... and this is so anti-pattern.
>>>> >> >> I have get rid of the Return() part already, but getting rid of the
>>>> >> >> Import() part seems not that straightforward.
>>>> >> >>
>>>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>>>> >> >> 121 121 5953
>>>> >> >>
>>>> >> >> At the moment the project supports 4 different CPU architectures, a
>>>> >> >> little less than 1000 C files, 400K+ lines of code.
>>>> >> >>
>>>> >> >> And this is no small problem (at least for me). If I start working
>>>> >> >> around it with too much python code, I might end up bypassing a
>>>> >> >> significant portion of core scons and eventually might find it easier
>>>> >> >> to just wrap around Makefiles.
>>>> >> >>
>>>> >> >> Someone thought I was criticizing scons, I actually love scons, but
>>>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me as an
>>>> >> >> enemy I am a serious user of scons since 10 years ago when I was still
>>>> >> >> in college.
>>>> >> >>
>>>> >> >> Best Regards,
>>>> >> >> Yanghao
>>>> >> >>
>>>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>>>> >> >> <***@baddogconsulting.com> wrote:
>>>> >> >>> How many source files per SConscript?
>>>> >> >>> That's a lot of sconscripts.
>>>> >> >>> Is this all one project?
>>>> >> >>> Are all the SConscripts identical?
>>>> >> >>>
>>>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <***@gmail.com>
>>>> >> >>> wrote:
>>>> >> >>>>
>>>> >> >>>> Actually I have one and only one import for hundreds of SConscript :)
>>>> >> >>>>
>>>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>>>> >> >>>> <***@gmail.com> wrote:
>>>> >> >>>>>
>>>> >> >>>>> Hua,
>>>> >> >>>>>
>>>> >> >>>>> If you are importing lots of variables into SConscripts, then you're
>>>> >> >>>>> using SCons wrong. Most of your variables should probably be
>>>> >> >>>>> construction
>>>> >> >>>>> variables (in the environment).
>>>> >> >>>>>
>>>> >> >>>>> I've written many, many SConscripts and I've never used more than 3
>>>> >> >>>>> or 4
>>>> >> >>>>> Import() statements in a single SConscript. Before you critique a
>>>> >> >>>>> long-established framework, you might want to consider if you're
>>>> >> >>>>> using it
>>>> >> >>>>> inappropriately.
>>>> >> >>>>>
>>>> >> >>>>> Jonathon
>>>> >> >>>>>
>>>> >> >>>>>
>>>> >> >>>>>
>>>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <***@gmail.com>
>>>> >> >>>>> wrote:
>>>> >> >>>>>>
>>>> >> >>>>>> Will do. It is really not good if a particular framework force user
>>>> >> >>>>>> to
>>>> >> >>>>>> create repeated code. In comparison kbuild can easily create a one
>>>> >> >>>>>> line make
>>>> >> >>>>>> file for a module.
>>>> >> >>>>>>
>>>> >> >>>>>> I am using localized scons anyway if not accepted will just use it
>>>> >> >>>>>> on my
>>>> >> >>>>>> own.
>>>> >> >>>>>>
>>>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>>>> >> >>>>>> <***@baddogconsulting.com>
>>>> >> >>>>>> wrote:
>>>> >> >>>>>>>
>>>> >> >>>>>>> Feel free to make a pull request, though I can't promise that it
>>>> >> >>>>>>> will
>>>> >> >>>>>>> be accepted.
>>>> >> >>>>>>>
>>>> >> >>>>>>> Is it really that much of an inconvenience?
>>>> >> >>>>>>> -Bill
>>>> >> >>>>>>>
>>>> >> >>>>>>>
>>>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>>>> >> >>>>>>> <***@gmail.com>
>>>> >> >>>>>>> wrote:
>>>> >> >>>>>>>>
>>>> >> >>>>>>>> Hi Bill,
>>>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
>>>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>>> >> >>>>>>>> For return I think I can abuse some global variables. This can
>>>> >> >>>>>>>> really
>>>> >> >>>>>>>> make the SConscript clean/minimal.
>>>> >> >>>>>>>>
>>>> >> >>>>>>>> Best Regards,
>>>> >> >>>>>>>> Yanghao
>>>> >> >>>>>>>>
>>>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>>>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
>>>> >> >>>>>>>> > No, there is no way without hacking the core code.
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > It is the way it is by design.
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > -Bill
>>>> >> >>>>>>>> > SCons Project Co-Manager
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>>>> >> >>>>>>>> > <***@gmail.com>
>>>> >> >>>>>>>> > wrote:
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly make a
>>>> >> >>>>>>>> >> object
>>>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
>>>> >> >>>>>>>> >> Import(xyz)?
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz) in
>>>> >> >>>>>>>> >> every
>>>> >> >>>>>>>> >> single SConscript.
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a list of
>>>> >> >>>>>>>> >> object,
>>>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct want to
>>>> >> >>>>>>>> >> collect
>>>> >> >>>>>>>> >> the complete list of object returned from every single
>>>> >> >>>>>>>> >> SConscript.
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> For example:
>>>> >> >>>>>>>> >> SConscript-1:
>>>> >> >>>>>>>> >> Import("xyz")
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> ret = xyz(...)
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Return("ret")
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Would ideally become:
>>>> >> >>>>>>>> >> SConscript-2:
>>>> >> >>>>>>>> >> xyz(...)
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Thanks,
>>>> >> >>>>>>>> >> Yanghao
>>>> >> >>>>>>>> >> _______________________________________________
>>>> >> >>>>>>>> >> Scons-users mailing list
>>>> >> >>>>>>>> >> Scons-***@scons.org
>>>> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > _______________________________________________
>>>> >> >>>>>>>> > Scons-users mailing list
>>>> >> >>>>>>>> > Scons-***@scons.org
>>>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> _______________________________________________
>>>> >> >>>>>>>> Scons-users mailing list
>>>> >> >>>>>>>> Scons-***@scons.org
>>>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>>
>>>> >> >>>>>>>
>>>> >> >>>>>>> _______________________________________________
>>>> >> >>>>>>> Scons-users mailing list
>>>> >> >>>>>>> Scons-***@scons.org
>>>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>
>>>> >> >>>>>>
>>>> >> >>>>>> _______________________________________________
>>>> >> >>>>>> Scons-users mailing list
>>>> >> >>>>>> Scons-***@scons.org
>>>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>
>>>> >> >>>>>
>>>> >> >>>>> _______________________________________________
>>>> >> >>>>> Scons-users mailing list
>>>> >> >>>>> Scons-***@scons.org
>>>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>
>>>> >> >>>>
>>>> >> >>>> _______________________________________________
>>>> >> >>>> Scons-users mailing list
>>>> >> >>>> Scons-***@scons.org
>>>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>
>>>> >> >>>
>>>> >> >>>
>>>> >> >>> _______________________________________________
>>>> >> >>> Scons-users mailing list
>>>> >> >>> Scons-***@scons.org
>>>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>
>>>> >> _______________________________________________
>>>> >> Scons-users mailing list
>>>> >> Scons-***@scons.org
>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > Scons-users mailing list
>>>> > Scons-***@scons.org
>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-***@scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-02-19 15:42:03 UTC
Permalink
Spencer,

I worked on a similar build system a while back for a client.
My solution was SConstruct did the bulk of the work and no SConscripts were
ever created.
The source stayed the clients home made file because they weren't willing
to change.

The logic walked the files figured out which builders needed to be called
and which environment() variables needed to be set for each .ini file and
then called them. It was actually fairly simple to implement and maintain.

-Bill

On Sun, Feb 18, 2018 at 11:08 PM, Spencer Yost <***@triad.rr.com> wrote:

> Right, our SConstruct walks the target, looking for the ini files. If it
> finds one, it passes them to the SConscript builder. The builder obviously
> creates an SConscript if the the ini file has changed. We then pass this
> SConscript to the SConscript() call.
>
> Again, our original build configuration files are sort of approximation an
> ini file - but not exact. The builder is actually several hundred lines of
> Python code. Because they are not exactly what the configparser module
> needs we have to create a temporary file that is the result of massaging
> and correcting the original and parse that temp file.
>
> PS: Don't get me wrong, we don't have this nailed down exactly yet. There
> are some deliverables what we are still working on. For example our config
> files deliver individual files that are contained within tar files. This
> seems to be opposite of what the Scons tarfile builder does(builds tar
> files from a collection of files). We have not cracked nut not yet.
>
> Spencer Yost
>
> On Feb 18, 2018, at 9:54 AM, Bill Deegan <***@baddogconsulting.com>
> wrote:
>
> Spencer,
>
> So your build info source are these .ini files?
> And your SConscript files just process them?
>
> -Bill
>
> On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com> wrote:
>
>> Just as an offhand comment, that is sort of related to this. First, I
>> don't have to import a lot.
>>
>> We just converted our build system to SCons(~1600+ packages, ~15000
>> source files and tens of millions of lines of code). Because python
>> expertise ranges from completely lacking to extremely poor :-) in our c/c++
>> staff; the powers that be indicated that developers will not maintain
>> SConscript files. They will maintain the original build configuration files
>> that we had(something that approximates a win.ini file). That means I have
>> to rebuild SConscript files for every original configuration file we had.
>> Trying to figure out a way to programmatically consolidate them to minimize
>> the number of SConscript files was nearly impossible. So we have about 1600
>> SConscript files. Stuff like library dependencies vary between
>> "packages" very frequently too. In addition the staff has to be able to
>> build an individual "package" or the whole tree. I have a builder that
>> creates the SConscript file whenever this original build configuration file
>> changes. So it's not a big deal. But consolidating them was just way too
>> big of a fish to fry in the time and budget allowed.
>>
>> Sometimes you just have to have a bunch of them.
>>
>> PS: SCons is working great for us. Dependencies are much more robust,
>> speed is marginally better and the entire arc from source code change to
>> Debian package creation is flawless. Being able to create command line
>> options has been a godsend for us. Previously we would have to create
>> build macros to emulate what command line options do.
>>
>> Spencer Yost
>>
>> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com>
>> wrote:
>>
>> Hua,
>>
>> From the tree you've shared, I'm going to guess you have way more
>> SConscripts than you need.
>>
>> For example, you're set of test directories could have a single
>> SConscript instead of one per.
>> Which no doubt are just a few lines each.
>>
>> In some cases it looks like you have a SConscript in a directory which
>> only has a header file (or none) and then a directory (or more) of source
>> code. Skip the SConscript in the basically no-op directorie(s).
>>
>> Another suggestion, use variant dirs so you're not creating build files
>> in your source directory.
>>
>> If you find yourself with a ton of very small SConscripts, it's a sign
>> that you may be doing something non-scons'ian.
>>
>> Of course it also depends on how working on each group of code is split
>> up between different developers.
>>
>> There is some art in structuring your build system (and your code) such
>> that engineers rarely end up causing merge conflicts with each other.
>>
>> I can see some value in default_import, but it would be something
>> requiring some debate on getting accepted.
>> As far as I can recall, your's is the first request for something like
>> this in the history of SCons (or at least as long as I've been involved).
>>
>> Philosophically SCons is about being explicit in the build requirements
>> and also about being correct by design. Yielding reproducible builds
>> regardless of the individual developers shell and machine setup.
>>
>>
>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com>
>> wrote:
>>
>>> Hi Bill,
>>> I do not create a SConscript for every directory, only for directly
>>> which either provide a set of include file or having source code to
>>> build.
>>> I will try to create a minimal version of the build system to show the
>>> idea.
>>>
>>> Not sure if the below tree will give you some idea what I am trying to
>>> implement, at least you should be able to see where I am having a
>>> SConscript file.
>>> build/configs/riscv_example/riscv32-qemu-virt-main/
>>> ├── cmdlist.txt
>>> ├── config
>>> │ └── config.h
>>> ├── firmware
>>> │ ├── arch
>>> │ │ ├── include
>>> │ │ │ └── arch
>>> │ │ │ ├── cache.h
>>> │ │ │ ├── irq.h
>>> │ │ │ ├── misc.h
>>> │ │ │ ├── mmu.h
>>> │ │ │ ├── smp.h
>>> │ │ │ ├── spinlock.h
>>> │ │ │ └── timer.h
>>> │ │ ├── riscv
>>> │ │ │ ├── helper.c
>>> │ │ │ ├── helper.o
>>> │ │ │ ├── libdefault.o
>>> │ │ │ ├── main.c
>>> │ │ │ ├── main.o
>>> │ │ │ ├── SConscript
>>> │ │ │ ├── start.o
>>> │ │ │ └── start.S
>>> │ │ ├── SConscript
>>> │ │ ├── weak.c
>>> │ │ └── weak.o
>>> │ ├── boards
>>> │ │ ├── include
>>> │ │ │ └── board.h
>>> │ │ ├── qemu-riscv32-virt
>>> │ │ │ ├── board.c
>>> │ │ │ ├── board.o
>>> │ │ │ ├── SConscript
>>> │ │ │ ├── uart16550_device.c
>>> │ │ │ └── uart16550_device.o
>>> │ │ └── SConscript
>>> │ ├── common
>>> │ │ ├── cpu.c
>>> │ │ ├── cpu.o
>>> │ │ ├── include
>>> │ │ │ └── common
>>> │ │ │ ├── common.h
>>> │ │ │ ├── cpu.h
>>> │ │ │ └── log.h
>>> │ │ ├── libdefault.o
>>> │ │ ├── log.c
>>> │ │ ├── log.o
>>> │ │ ├── main.c
>>> │ │ ├── main.o
>>> │ │ ├── SConscript
>>> │ │ ├── weak.c
>>> │ │ └── weak.o
>>> │ ├── drivers
>>> │ │ └── uart16550
>>> │ │ ├── fd_ops.c
>>> │ │ ├── fd_ops.o
>>> │ │ ├── include
>>> │ │ │ ├── uart16550_api.h
>>> │ │ │ └── uart16550_device.h
>>> │ │ ├── libdefault.o
>>> │ │ ├── SConscript
>>> │ │ ├── uart16550.c
>>> │ │ └── uart16550.o
>>> │ ├── include
>>> │ │ ├── bootstage.h
>>> │ │ ├── compiler.h
>>> │ │ ├── debug.h
>>> │ │ └── linux
>>> │ │ └── typecheck.h
>>> │ ├── lib
>>> │ │ ├── cmd
>>> │ │ │ ├── cmd.c
>>> │ │ │ ├── cmd.o
>>> │ │ │ ├── include
>>> │ │ │ │ └── cmd
>>> │ │ │ │ └── cmd.h
>>> │ │ │ ├── SConscript
>>> │ │ │ ├── test.c
>>> │ │ │ └── test.o
>>> │ │ ├── fio
>>> │ │ │ ├── cmd.c
>>> │ │ │ ├── cmd.o
>>> │ │ │ ├── include
>>> │ │ │ │ └── usw_device_public.h
>>> │ │ │ ├── libdefault.o
>>> │ │ │ ├── newlib.c
>>> │ │ │ ├── newlib.o
>>> │ │ │ ├── SConscript
>>> │ │ │ ├── usw_device.c
>>> │ │ │ ├── usw_device.o
>>> │ │ │ └── usw_device_private.h
>>> │ │ ├── pipe
>>> │ │ │ ├── include
>>> │ │ │ │ └── pipe
>>> │ │ │ │ ├── pipe.h
>>> │ │ │ │ └── status.h
>>> │ │ │ ├── libdefault.o
>>> │ │ │ ├── pipe.c
>>> │ │ │ ├── pipe.o
>>> │ │ │ └── SConscript
>>> │ │ └── simple_console
>>> │ │ ├── include
>>> │ │ │ └── simple_console.h
>>> │ │ ├── libdefault.o
>>> │ │ ├── print_color.h
>>> │ │ ├── SConscript
>>> │ │ ├── simple_console.c
>>> │ │ └── simple_console.o
>>> │ ├── SConscript
>>> │ └── test
>>> │ ├── common
>>> │ │ ├── SConscript
>>> │ │ ├── test.c
>>> │ │ └── test.o
>>> │ ├── console
>>> │ │ ├── hello.c
>>> │ │ ├── hello.o
>>> │ │ ├── SConscript
>>> │ │ ├── test.c
>>> │ │ └── test.o
>>> │ ├── example
>>> │ │ ├── SConscript
>>> │ │ ├── test.c
>>> │ │ └── test.o
>>> │ ├── libc
>>> │ │ ├── SConscript
>>> │ │ ├── test.c
>>> │ │ └── test.o
>>> │ ├── linker
>>> │ │ ├── SConscript
>>> │ │ ├── test.c
>>> │ │ └── test.o
>>> │ ├── log
>>> │ │ ├── SConscript
>>> │ │ ├── test.c
>>> │ │ └── test.o
>>> │ └── setjmp
>>> │ ├── SConscript
>>> │ ├── test2.c
>>> │ ├── test2.o
>>> │ ├── test.c
>>> │ └── test.o
>>> ├── libriscv_example.a
>>> ├── link.ld
>>> ├── riscv_example.bin
>>> ├── riscv_example.elf
>>> ├── riscv_example.ibi_bin
>>> ├── riscv_example.map
>>> └── riscv_example.S
>>>
>>> 36 directories, 113 files
>>>
>>>
>>>
>>>
>>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan <***@baddogconsulting.com>
>>> wrote:
>>> > Likely you don't need a SConscript for every directory in your case?
>>> > Are you wrapping a complete linux build tree?
>>> >
>>> > Is this a build tree you can share for us to look at?
>>> >
>>> > -Bill
>>> >
>>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com>
>>> wrote:
>>> >>
>>> >> I see everything passed into env.SConscript(default_import=some_obj),
>>> >> if some_obj is a string it can pass through but if some_obj is a
>>> >> function object it end up as None in Script/SConscript.py/SConscrip
>>> t()
>>> >> function.
>>> >>
>>> >> I could have used a string and then import the right function however
>>> >> my function to be passed is a dynamically generated partial function
>>> >> ...
>>> >>
>>> >> Could anyone please give me some hint how could this be best
>>> implemented?
>>> >>
>>> >> Best Regards,
>>> >> Yanghao
>>> >>
>>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com>
>>> wrote:
>>> >> > @Bill, I have managed to hack the Frame class and the
>>> >> > BuildDefaultGlobals() function to have some thing imported into
>>> >> > SConscript by default.
>>> >> > However I don't quite understand when the "default_import" keyword
>>> >> > argument passed down, somewhere somehow it end up as a set.
>>> >> >
>>> >> > Any documentation to explain what is going on from Base class into
>>> >> > SConscript() calls regarding parameter handling?
>>> >> >
>>> >> > Thanks,
>>> >> > Yanghao
>>> >> >
>>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
>>> >> > wrote:
>>> >> >> It varies a lot, ranging from 0 (yes, no source files at all) to a
>>> few
>>> >> >> dozen (didn't really count, see statistics below).
>>> >> >>
>>> >> >> Here is an example Linux kernel driver sub-module Makefile:
>>> >> >>
>>> >> >> linux/drivers/sn/Makefile:
>>> >> >> 1 #
>>> >> >> 2 # Makefile for the Altix device drivers.
>>> >> >> 3 #
>>> >> >> 4 #
>>> >> >> 5
>>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>>> >> >>
>>> >> >> I want to replicate this kind of simplicity in scons.
>>> >> >>
>>> >> >> I actually have implemented almost the same thing in scons, but all
>>> >> >> those SConscript files have to start with Import("my_func") ...
>>> which
>>> >> >> is pretty annoying. I know I need it in every single SConscript,
>>> and I
>>> >> >> have to repeat it ... and this is so anti-pattern.
>>> >> >> I have get rid of the Return() part already, but getting rid of the
>>> >> >> Import() part seems not that straightforward.
>>> >> >>
>>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>>> >> >> 121 121 5953
>>> >> >>
>>> >> >> At the moment the project supports 4 different CPU architectures, a
>>> >> >> little less than 1000 C files, 400K+ lines of code.
>>> >> >>
>>> >> >> And this is no small problem (at least for me). If I start working
>>> >> >> around it with too much python code, I might end up bypassing a
>>> >> >> significant portion of core scons and eventually might find it
>>> easier
>>> >> >> to just wrap around Makefiles.
>>> >> >>
>>> >> >> Someone thought I was criticizing scons, I actually love scons, but
>>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me as an
>>> >> >> enemy I am a serious user of scons since 10 years ago when I was
>>> still
>>> >> >> in college.
>>> >> >>
>>> >> >> Best Regards,
>>> >> >> Yanghao
>>> >> >>
>>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>>> >> >> <***@baddogconsulting.com> wrote:
>>> >> >>> How many source files per SConscript?
>>> >> >>> That's a lot of sconscripts.
>>> >> >>> Is this all one project?
>>> >> >>> Are all the SConscripts identical?
>>> >> >>>
>>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao <
>>> ***@gmail.com>
>>> >> >>> wrote:
>>> >> >>>>
>>> >> >>>> Actually I have one and only one import for hundreds of
>>> SConscript :)
>>> >> >>>>
>>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>>> >> >>>> <***@gmail.com> wrote:
>>> >> >>>>>
>>> >> >>>>> Hua,
>>> >> >>>>>
>>> >> >>>>> If you are importing lots of variables into SConscripts, then
>>> you're
>>> >> >>>>> using SCons wrong. Most of your variables should probably be
>>> >> >>>>> construction
>>> >> >>>>> variables (in the environment).
>>> >> >>>>>
>>> >> >>>>> I've written many, many SConscripts and I've never used more
>>> than 3
>>> >> >>>>> or 4
>>> >> >>>>> Import() statements in a single SConscript. Before you critique
>>> a
>>> >> >>>>> long-established framework, you might want to consider if you're
>>> >> >>>>> using it
>>> >> >>>>> inappropriately.
>>> >> >>>>>
>>> >> >>>>> Jonathon
>>> >> >>>>>
>>> >> >>>>>
>>> >> >>>>>
>>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao <
>>> ***@gmail.com>
>>> >> >>>>> wrote:
>>> >> >>>>>>
>>> >> >>>>>> Will do. It is really not good if a particular framework force
>>> user
>>> >> >>>>>> to
>>> >> >>>>>> create repeated code. In comparison kbuild can easily create a
>>> one
>>> >> >>>>>> line make
>>> >> >>>>>> file for a module.
>>> >> >>>>>>
>>> >> >>>>>> I am using localized scons anyway if not accepted will just
>>> use it
>>> >> >>>>>> on my
>>> >> >>>>>> own.
>>> >> >>>>>>
>>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>>> >> >>>>>> <***@baddogconsulting.com>
>>> >> >>>>>> wrote:
>>> >> >>>>>>>
>>> >> >>>>>>> Feel free to make a pull request, though I can't promise that
>>> it
>>> >> >>>>>>> will
>>> >> >>>>>>> be accepted.
>>> >> >>>>>>>
>>> >> >>>>>>> Is it really that much of an inconvenience?
>>> >> >>>>>>> -Bill
>>> >> >>>>>>>
>>> >> >>>>>>>
>>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>>> >> >>>>>>> <***@gmail.com>
>>> >> >>>>>>> wrote:
>>> >> >>>>>>>>
>>> >> >>>>>>>> Hi Bill,
>>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
>>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>> >> >>>>>>>> For return I think I can abuse some global variables. This
>>> can
>>> >> >>>>>>>> really
>>> >> >>>>>>>> make the SConscript clean/minimal.
>>> >> >>>>>>>>
>>> >> >>>>>>>> Best Regards,
>>> >> >>>>>>>> Yanghao
>>> >> >>>>>>>>
>>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
>>> >> >>>>>>>> > No, there is no way without hacking the core code.
>>> >> >>>>>>>> >
>>> >> >>>>>>>> > It is the way it is by design.
>>> >> >>>>>>>> >
>>> >> >>>>>>>> > -Bill
>>> >> >>>>>>>> > SCons Project Co-Manager
>>> >> >>>>>>>> >
>>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>>> >> >>>>>>>> > <***@gmail.com>
>>> >> >>>>>>>> > wrote:
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly
>>> make a
>>> >> >>>>>>>> >> object
>>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
>>> >> >>>>>>>> >> Import(xyz)?
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz)
>>> in
>>> >> >>>>>>>> >> every
>>> >> >>>>>>>> >> single SConscript.
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a
>>> list of
>>> >> >>>>>>>> >> object,
>>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct want
>>> to
>>> >> >>>>>>>> >> collect
>>> >> >>>>>>>> >> the complete list of object returned from every single
>>> >> >>>>>>>> >> SConscript.
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> For example:
>>> >> >>>>>>>> >> SConscript-1:
>>> >> >>>>>>>> >> Import("xyz")
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> ret = xyz(...)
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> Return("ret")
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> Would ideally become:
>>> >> >>>>>>>> >> SConscript-2:
>>> >> >>>>>>>> >> xyz(...)
>>> >> >>>>>>>> >>
>>> >> >>>>>>>> >> Thanks,
>>> >> >>>>>>>> >> Yanghao
>>> >> >>>>>>>> >> _______________________________________________
>>> >> >>>>>>>> >> Scons-users mailing list
>>> >> >>>>>>>> >> Scons-***@scons.org
>>> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>>>>>> >
>>> >> >>>>>>>> >
>>> >> >>>>>>>> >
>>> >> >>>>>>>> > _______________________________________________
>>> >> >>>>>>>> > Scons-users mailing list
>>> >> >>>>>>>> > Scons-***@scons.org
>>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>>>>>> >
>>> >> >>>>>>>> _______________________________________________
>>> >> >>>>>>>> Scons-users mailing list
>>> >> >>>>>>>> Scons-***@scons.org
>>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>>>>>
>>> >> >>>>>>>
>>> >> >>>>>>> _______________________________________________
>>> >> >>>>>>> Scons-users mailing list
>>> >> >>>>>>> Scons-***@scons.org
>>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>>>>
>>> >> >>>>>>
>>> >> >>>>>> _______________________________________________
>>> >> >>>>>> Scons-users mailing list
>>> >> >>>>>> Scons-***@scons.org
>>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>>>>
>>> >> >>>>>
>>> >> >>>>> _______________________________________________
>>> >> >>>>> Scons-users mailing list
>>> >> >>>>> Scons-***@scons.org
>>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>>
>>> >> >>>>
>>> >> >>>> _______________________________________________
>>> >> >>>> Scons-users mailing list
>>> >> >>>> Scons-***@scons.org
>>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>>
>>> >> >>>
>>> >> >>>
>>> >> >>> _______________________________________________
>>> >> >>> Scons-users mailing list
>>> >> >>> Scons-***@scons.org
>>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >> >>>
>>> >> _______________________________________________
>>> >> Scons-users mailing list
>>> >> Scons-***@scons.org
>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > Scons-users mailing list
>>> > Scons-***@scons.org
>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
Hua Yanghao
2018-02-19 16:10:58 UTC
Permalink
Hi Bill,
How do you handle variant_dir in this case, do you need the module to
be built out of tree in a central place with other modules?
Or were you able to provide a variant_dir=... also to all the builder
that is used?

Best Regards,
Yanghao

On Mon, Feb 19, 2018 at 4:42 PM, Bill Deegan <***@baddogconsulting.com> wrote:
> Spencer,
>
> I worked on a similar build system a while back for a client.
> My solution was SConstruct did the bulk of the work and no SConscripts were
> ever created.
> The source stayed the clients home made file because they weren't willing to
> change.
>
> The logic walked the files figured out which builders needed to be called
> and which environment() variables needed to be set for each .ini file and
> then called them. It was actually fairly simple to implement and maintain.
>
> -Bill
>
> On Sun, Feb 18, 2018 at 11:08 PM, Spencer Yost <***@triad.rr.com> wrote:
>>
>> Right, our SConstruct walks the target, looking for the ini files. If it
>> finds one, it passes them to the SConscript builder. The builder obviously
>> creates an SConscript if the the ini file has changed. We then pass this
>> SConscript to the SConscript() call.
>>
>> Again, our original build configuration files are sort of approximation an
>> ini file - but not exact. The builder is actually several hundred lines of
>> Python code. Because they are not exactly what the configparser module needs
>> we have to create a temporary file that is the result of massaging and
>> correcting the original and parse that temp file.
>>
>> PS: Don't get me wrong, we don't have this nailed down exactly yet. There
>> are some deliverables what we are still working on. For example our config
>> files deliver individual files that are contained within tar files. This
>> seems to be opposite of what the Scons tarfile builder does(builds tar files
>> from a collection of files). We have not cracked nut not yet.
>>
>> Spencer Yost
>>
>> On Feb 18, 2018, at 9:54 AM, Bill Deegan <***@baddogconsulting.com>
>> wrote:
>>
>> Spencer,
>>
>> So your build info source are these .ini files?
>> And your SConscript files just process them?
>>
>> -Bill
>>
>> On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com> wrote:
>>>
>>> Just as an offhand comment, that is sort of related to this. First, I
>>> don't have to import a lot.
>>>
>>> We just converted our build system to SCons(~1600+ packages, ~15000
>>> source files and tens of millions of lines of code). Because python
>>> expertise ranges from completely lacking to extremely poor :-) in our c/c++
>>> staff; the powers that be indicated that developers will not maintain
>>> SConscript files. They will maintain the original build configuration files
>>> that we had(something that approximates a win.ini file). That means I have
>>> to rebuild SConscript files for every original configuration file we had.
>>> Trying to figure out a way to programmatically consolidate them to minimize
>>> the number of SConscript files was nearly impossible. So we have about 1600
>>> SConscript files. Stuff like library dependencies vary between "packages"
>>> very frequently too. In addition the staff has to be able to build an
>>> individual "package" or the whole tree. I have a builder that creates the
>>> SConscript file whenever this original build configuration file changes. So
>>> it's not a big deal. But consolidating them was just way too big of a fish
>>> to fry in the time and budget allowed.
>>>
>>> Sometimes you just have to have a bunch of them.
>>>
>>> PS: SCons is working great for us. Dependencies are much more robust,
>>> speed is marginally better and the entire arc from source code change to
>>> Debian package creation is flawless. Being able to create command line
>>> options has been a godsend for us. Previously we would have to create build
>>> macros to emulate what command line options do.
>>>
>>> Spencer Yost
>>>
>>> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com>
>>> wrote:
>>>
>>> Hua,
>>>
>>> From the tree you've shared, I'm going to guess you have way more
>>> SConscripts than you need.
>>>
>>> For example, you're set of test directories could have a single
>>> SConscript instead of one per.
>>> Which no doubt are just a few lines each.
>>>
>>> In some cases it looks like you have a SConscript in a directory which
>>> only has a header file (or none) and then a directory (or more) of source
>>> code. Skip the SConscript in the basically no-op directorie(s).
>>>
>>> Another suggestion, use variant dirs so you're not creating build files
>>> in your source directory.
>>>
>>> If you find yourself with a ton of very small SConscripts, it's a sign
>>> that you may be doing something non-scons'ian.
>>>
>>> Of course it also depends on how working on each group of code is split
>>> up between different developers.
>>>
>>> There is some art in structuring your build system (and your code) such
>>> that engineers rarely end up causing merge conflicts with each other.
>>>
>>> I can see some value in default_import, but it would be something
>>> requiring some debate on getting accepted.
>>> As far as I can recall, your's is the first request for something like
>>> this in the history of SCons (or at least as long as I've been involved).
>>>
>>> Philosophically SCons is about being explicit in the build requirements
>>> and also about being correct by design. Yielding reproducible builds
>>> regardless of the individual developers shell and machine setup.
>>>
>>>
>>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com>
>>> wrote:
>>>>
>>>> Hi Bill,
>>>> I do not create a SConscript for every directory, only for directly
>>>> which either provide a set of include file or having source code to
>>>> build.
>>>> I will try to create a minimal version of the build system to show the
>>>> idea.
>>>>
>>>> Not sure if the below tree will give you some idea what I am trying to
>>>> implement, at least you should be able to see where I am having a
>>>> SConscript file.
>>>> build/configs/riscv_example/riscv32-qemu-virt-main/
>>>> ├── cmdlist.txt
>>>> ├── config
>>>> │ └── config.h
>>>> ├── firmware
>>>> │ ├── arch
>>>> │ │ ├── include
>>>> │ │ │ └── arch
>>>> │ │ │ ├── cache.h
>>>> │ │ │ ├── irq.h
>>>> │ │ │ ├── misc.h
>>>> │ │ │ ├── mmu.h
>>>> │ │ │ ├── smp.h
>>>> │ │ │ ├── spinlock.h
>>>> │ │ │ └── timer.h
>>>> │ │ ├── riscv
>>>> │ │ │ ├── helper.c
>>>> │ │ │ ├── helper.o
>>>> │ │ │ ├── libdefault.o
>>>> │ │ │ ├── main.c
>>>> │ │ │ ├── main.o
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── start.o
>>>> │ │ │ └── start.S
>>>> │ │ ├── SConscript
>>>> │ │ ├── weak.c
>>>> │ │ └── weak.o
>>>> │ ├── boards
>>>> │ │ ├── include
>>>> │ │ │ └── board.h
>>>> │ │ ├── qemu-riscv32-virt
>>>> │ │ │ ├── board.c
>>>> │ │ │ ├── board.o
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── uart16550_device.c
>>>> │ │ │ └── uart16550_device.o
>>>> │ │ └── SConscript
>>>> │ ├── common
>>>> │ │ ├── cpu.c
>>>> │ │ ├── cpu.o
>>>> │ │ ├── include
>>>> │ │ │ └── common
>>>> │ │ │ ├── common.h
>>>> │ │ │ ├── cpu.h
>>>> │ │ │ └── log.h
>>>> │ │ ├── libdefault.o
>>>> │ │ ├── log.c
>>>> │ │ ├── log.o
>>>> │ │ ├── main.c
>>>> │ │ ├── main.o
>>>> │ │ ├── SConscript
>>>> │ │ ├── weak.c
>>>> │ │ └── weak.o
>>>> │ ├── drivers
>>>> │ │ └── uart16550
>>>> │ │ ├── fd_ops.c
>>>> │ │ ├── fd_ops.o
>>>> │ │ ├── include
>>>> │ │ │ ├── uart16550_api.h
>>>> │ │ │ └── uart16550_device.h
>>>> │ │ ├── libdefault.o
>>>> │ │ ├── SConscript
>>>> │ │ ├── uart16550.c
>>>> │ │ └── uart16550.o
>>>> │ ├── include
>>>> │ │ ├── bootstage.h
>>>> │ │ ├── compiler.h
>>>> │ │ ├── debug.h
>>>> │ │ └── linux
>>>> │ │ └── typecheck.h
>>>> │ ├── lib
>>>> │ │ ├── cmd
>>>> │ │ │ ├── cmd.c
>>>> │ │ │ ├── cmd.o
>>>> │ │ │ ├── include
>>>> │ │ │ │ └── cmd
>>>> │ │ │ │ └── cmd.h
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── test.c
>>>> │ │ │ └── test.o
>>>> │ │ ├── fio
>>>> │ │ │ ├── cmd.c
>>>> │ │ │ ├── cmd.o
>>>> │ │ │ ├── include
>>>> │ │ │ │ └── usw_device_public.h
>>>> │ │ │ ├── libdefault.o
>>>> │ │ │ ├── newlib.c
>>>> │ │ │ ├── newlib.o
>>>> │ │ │ ├── SConscript
>>>> │ │ │ ├── usw_device.c
>>>> │ │ │ ├── usw_device.o
>>>> │ │ │ └── usw_device_private.h
>>>> │ │ ├── pipe
>>>> │ │ │ ├── include
>>>> │ │ │ │ └── pipe
>>>> │ │ │ │ ├── pipe.h
>>>> │ │ │ │ └── status.h
>>>> │ │ │ ├── libdefault.o
>>>> │ │ │ ├── pipe.c
>>>> │ │ │ ├── pipe.o
>>>> │ │ │ └── SConscript
>>>> │ │ └── simple_console
>>>> │ │ ├── include
>>>> │ │ │ └── simple_console.h
>>>> │ │ ├── libdefault.o
>>>> │ │ ├── print_color.h
>>>> │ │ ├── SConscript
>>>> │ │ ├── simple_console.c
>>>> │ │ └── simple_console.o
>>>> │ ├── SConscript
>>>> │ └── test
>>>> │ ├── common
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── console
>>>> │ │ ├── hello.c
>>>> │ │ ├── hello.o
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── example
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── libc
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── linker
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ ├── log
>>>> │ │ ├── SConscript
>>>> │ │ ├── test.c
>>>> │ │ └── test.o
>>>> │ └── setjmp
>>>> │ ├── SConscript
>>>> │ ├── test2.c
>>>> │ ├── test2.o
>>>> │ ├── test.c
>>>> │ └── test.o
>>>> ├── libriscv_example.a
>>>> ├── link.ld
>>>> ├── riscv_example.bin
>>>> ├── riscv_example.elf
>>>> ├── riscv_example.ibi_bin
>>>> ├── riscv_example.map
>>>> └── riscv_example.S
>>>>
>>>> 36 directories, 113 files
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan
>>>> <***@baddogconsulting.com> wrote:
>>>> > Likely you don't need a SConscript for every directory in your case?
>>>> > Are you wrapping a complete linux build tree?
>>>> >
>>>> > Is this a build tree you can share for us to look at?
>>>> >
>>>> > -Bill
>>>> >
>>>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com>
>>>> > wrote:
>>>> >>
>>>> >> I see everything passed into env.SConscript(default_import=some_obj),
>>>> >> if some_obj is a string it can pass through but if some_obj is a
>>>> >> function object it end up as None in
>>>> >> Script/SConscript.py/SConscript()
>>>> >> function.
>>>> >>
>>>> >> I could have used a string and then import the right function however
>>>> >> my function to be passed is a dynamically generated partial function
>>>> >> ...
>>>> >>
>>>> >> Could anyone please give me some hint how could this be best
>>>> >> implemented?
>>>> >>
>>>> >> Best Regards,
>>>> >> Yanghao
>>>> >>
>>>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com>
>>>> >> wrote:
>>>> >> > @Bill, I have managed to hack the Frame class and the
>>>> >> > BuildDefaultGlobals() function to have some thing imported into
>>>> >> > SConscript by default.
>>>> >> > However I don't quite understand when the "default_import" keyword
>>>> >> > argument passed down, somewhere somehow it end up as a set.
>>>> >> >
>>>> >> > Any documentation to explain what is going on from Base class into
>>>> >> > SConscript() calls regarding parameter handling?
>>>> >> >
>>>> >> > Thanks,
>>>> >> > Yanghao
>>>> >> >
>>>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <***@gmail.com>
>>>> >> > wrote:
>>>> >> >> It varies a lot, ranging from 0 (yes, no source files at all) to a
>>>> >> >> few
>>>> >> >> dozen (didn't really count, see statistics below).
>>>> >> >>
>>>> >> >> Here is an example Linux kernel driver sub-module Makefile:
>>>> >> >>
>>>> >> >> linux/drivers/sn/Makefile:
>>>> >> >> 1 #
>>>> >> >> 2 # Makefile for the Altix device drivers.
>>>> >> >> 3 #
>>>> >> >> 4 #
>>>> >> >> 5
>>>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>>>> >> >>
>>>> >> >> I want to replicate this kind of simplicity in scons.
>>>> >> >>
>>>> >> >> I actually have implemented almost the same thing in scons, but
>>>> >> >> all
>>>> >> >> those SConscript files have to start with Import("my_func") ...
>>>> >> >> which
>>>> >> >> is pretty annoying. I know I need it in every single SConscript,
>>>> >> >> and I
>>>> >> >> have to repeat it ... and this is so anti-pattern.
>>>> >> >> I have get rid of the Return() part already, but getting rid of
>>>> >> >> the
>>>> >> >> Import() part seems not that straightforward.
>>>> >> >>
>>>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>>>> >> >> 121 121 5953
>>>> >> >>
>>>> >> >> At the moment the project supports 4 different CPU architectures,
>>>> >> >> a
>>>> >> >> little less than 1000 C files, 400K+ lines of code.
>>>> >> >>
>>>> >> >> And this is no small problem (at least for me). If I start working
>>>> >> >> around it with too much python code, I might end up bypassing a
>>>> >> >> significant portion of core scons and eventually might find it
>>>> >> >> easier
>>>> >> >> to just wrap around Makefiles.
>>>> >> >>
>>>> >> >> Someone thought I was criticizing scons, I actually love scons,
>>>> >> >> but
>>>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me as
>>>> >> >> an
>>>> >> >> enemy I am a serious user of scons since 10 years ago when I was
>>>> >> >> still
>>>> >> >> in college.
>>>> >> >>
>>>> >> >> Best Regards,
>>>> >> >> Yanghao
>>>> >> >>
>>>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>>>> >> >> <***@baddogconsulting.com> wrote:
>>>> >> >>> How many source files per SConscript?
>>>> >> >>> That's a lot of sconscripts.
>>>> >> >>> Is this all one project?
>>>> >> >>> Are all the SConscripts identical?
>>>> >> >>>
>>>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao
>>>> >> >>> <***@gmail.com>
>>>> >> >>> wrote:
>>>> >> >>>>
>>>> >> >>>> Actually I have one and only one import for hundreds of
>>>> >> >>>> SConscript :)
>>>> >> >>>>
>>>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>>>> >> >>>> <***@gmail.com> wrote:
>>>> >> >>>>>
>>>> >> >>>>> Hua,
>>>> >> >>>>>
>>>> >> >>>>> If you are importing lots of variables into SConscripts, then
>>>> >> >>>>> you're
>>>> >> >>>>> using SCons wrong. Most of your variables should probably be
>>>> >> >>>>> construction
>>>> >> >>>>> variables (in the environment).
>>>> >> >>>>>
>>>> >> >>>>> I've written many, many SConscripts and I've never used more
>>>> >> >>>>> than 3
>>>> >> >>>>> or 4
>>>> >> >>>>> Import() statements in a single SConscript. Before you critique
>>>> >> >>>>> a
>>>> >> >>>>> long-established framework, you might want to consider if
>>>> >> >>>>> you're
>>>> >> >>>>> using it
>>>> >> >>>>> inappropriately.
>>>> >> >>>>>
>>>> >> >>>>> Jonathon
>>>> >> >>>>>
>>>> >> >>>>>
>>>> >> >>>>>
>>>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao
>>>> >> >>>>> <***@gmail.com>
>>>> >> >>>>> wrote:
>>>> >> >>>>>>
>>>> >> >>>>>> Will do. It is really not good if a particular framework force
>>>> >> >>>>>> user
>>>> >> >>>>>> to
>>>> >> >>>>>> create repeated code. In comparison kbuild can easily create a
>>>> >> >>>>>> one
>>>> >> >>>>>> line make
>>>> >> >>>>>> file for a module.
>>>> >> >>>>>>
>>>> >> >>>>>> I am using localized scons anyway if not accepted will just
>>>> >> >>>>>> use it
>>>> >> >>>>>> on my
>>>> >> >>>>>> own.
>>>> >> >>>>>>
>>>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>>>> >> >>>>>> <***@baddogconsulting.com>
>>>> >> >>>>>> wrote:
>>>> >> >>>>>>>
>>>> >> >>>>>>> Feel free to make a pull request, though I can't promise that
>>>> >> >>>>>>> it
>>>> >> >>>>>>> will
>>>> >> >>>>>>> be accepted.
>>>> >> >>>>>>>
>>>> >> >>>>>>> Is it really that much of an inconvenience?
>>>> >> >>>>>>> -Bill
>>>> >> >>>>>>>
>>>> >> >>>>>>>
>>>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>>>> >> >>>>>>> <***@gmail.com>
>>>> >> >>>>>>> wrote:
>>>> >> >>>>>>>>
>>>> >> >>>>>>>> Hi Bill,
>>>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
>>>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>>>> >> >>>>>>>> For return I think I can abuse some global variables. This
>>>> >> >>>>>>>> can
>>>> >> >>>>>>>> really
>>>> >> >>>>>>>> make the SConscript clean/minimal.
>>>> >> >>>>>>>>
>>>> >> >>>>>>>> Best Regards,
>>>> >> >>>>>>>> Yanghao
>>>> >> >>>>>>>>
>>>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>>>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
>>>> >> >>>>>>>> > No, there is no way without hacking the core code.
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > It is the way it is by design.
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > -Bill
>>>> >> >>>>>>>> > SCons Project Co-Manager
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>>>> >> >>>>>>>> > <***@gmail.com>
>>>> >> >>>>>>>> > wrote:
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly
>>>> >> >>>>>>>> >> make a
>>>> >> >>>>>>>> >> object
>>>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
>>>> >> >>>>>>>> >> Import(xyz)?
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Just want to eliminate the annoying repeated Import(xyz)
>>>> >> >>>>>>>> >> in
>>>> >> >>>>>>>> >> every
>>>> >> >>>>>>>> >> single SConscript.
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a
>>>> >> >>>>>>>> >> list of
>>>> >> >>>>>>>> >> object,
>>>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct want
>>>> >> >>>>>>>> >> to
>>>> >> >>>>>>>> >> collect
>>>> >> >>>>>>>> >> the complete list of object returned from every single
>>>> >> >>>>>>>> >> SConscript.
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> For example:
>>>> >> >>>>>>>> >> SConscript-1:
>>>> >> >>>>>>>> >> Import("xyz")
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> ret = xyz(...)
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Return("ret")
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Would ideally become:
>>>> >> >>>>>>>> >> SConscript-2:
>>>> >> >>>>>>>> >> xyz(...)
>>>> >> >>>>>>>> >>
>>>> >> >>>>>>>> >> Thanks,
>>>> >> >>>>>>>> >> Yanghao
>>>> >> >>>>>>>> >> _______________________________________________
>>>> >> >>>>>>>> >> Scons-users mailing list
>>>> >> >>>>>>>> >> Scons-***@scons.org
>>>> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> > _______________________________________________
>>>> >> >>>>>>>> > Scons-users mailing list
>>>> >> >>>>>>>> > Scons-***@scons.org
>>>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>>> >
>>>> >> >>>>>>>> _______________________________________________
>>>> >> >>>>>>>> Scons-users mailing list
>>>> >> >>>>>>>> Scons-***@scons.org
>>>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>>
>>>> >> >>>>>>>
>>>> >> >>>>>>> _______________________________________________
>>>> >> >>>>>>> Scons-users mailing list
>>>> >> >>>>>>> Scons-***@scons.org
>>>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>
>>>> >> >>>>>>
>>>> >> >>>>>> _______________________________________________
>>>> >> >>>>>> Scons-users mailing list
>>>> >> >>>>>> Scons-***@scons.org
>>>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>>>
>>>> >> >>>>>
>>>> >> >>>>> _______________________________________________
>>>> >> >>>>> Scons-users mailing list
>>>> >> >>>>> Scons-***@scons.org
>>>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>
>>>> >> >>>>
>>>> >> >>>> _______________________________________________
>>>> >> >>>> Scons-users mailing list
>>>> >> >>>> Scons-***@scons.org
>>>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>>
>>>> >> >>>
>>>> >> >>>
>>>> >> >>> _______________________________________________
>>>> >> >>> Scons-users mailing list
>>>> >> >>> Scons-***@scons.org
>>>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >> >>>
>>>> >> _______________________________________________
>>>> >> Scons-users mailing list
>>>> >> Scons-***@scons.org
>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > Scons-users mailing list
>>>> > Scons-***@scons.org
>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>> >
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-***@scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-***@scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Bill Deegan
2018-02-19 17:20:51 UTC
Permalink
Here's two ways which are similar to using variant_dir in a SConscript call.

env.Program('some_build_dir/program', ['src/a.c','src/b.c'])
Assuming you have duplicate = 0

Or you can specify the

VariantDir('some_build_dir','src')
env.Program('some_build_dir/program', [os.path.join('some_build_dir',a)
for a in ['a.c','b.c'])


If you're doing a one time migration from some other build file to
sconscripts, then automate that and move forward from that.
If you're doing a "we'll always use the other build file" and then generate
sconscripts each time, I guess you can automate that like Spencer has.
Or you could create you own logic to read the other build file and make the
correct SCons calls to emulate the intent of the other build system.

Such logic could be run every time as plain python logic, just make sure it
get's run before your first SConscript call.

Manually converting and maintaining two build files next to each other for
two sets of developers just sounds like hell to me..

Either way Import('env') is not going to be a nuisance because you'll have
scripted the bulk of the conversion/migration.

-Bill




On Mon, Feb 19, 2018 at 11:10 AM, Hua Yanghao <***@gmail.com> wrote:

> Hi Bill,
> How do you handle variant_dir in this case, do you need the module to
> be built out of tree in a central place with other modules?
> Or were you able to provide a variant_dir=... also to all the builder
> that is used?
>
> Best Regards,
> Yanghao
>
> On Mon, Feb 19, 2018 at 4:42 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
> > Spencer,
> >
> > I worked on a similar build system a while back for a client.
> > My solution was SConstruct did the bulk of the work and no SConscripts
> were
> > ever created.
> > The source stayed the clients home made file because they weren't
> willing to
> > change.
> >
> > The logic walked the files figured out which builders needed to be called
> > and which environment() variables needed to be set for each .ini file and
> > then called them. It was actually fairly simple to implement and
> maintain.
> >
> > -Bill
> >
> > On Sun, Feb 18, 2018 at 11:08 PM, Spencer Yost <***@triad.rr.com>
> wrote:
> >>
> >> Right, our SConstruct walks the target, looking for the ini files. If
> it
> >> finds one, it passes them to the SConscript builder. The builder
> obviously
> >> creates an SConscript if the the ini file has changed. We then pass this
> >> SConscript to the SConscript() call.
> >>
> >> Again, our original build configuration files are sort of approximation
> an
> >> ini file - but not exact. The builder is actually several hundred lines
> of
> >> Python code. Because they are not exactly what the configparser module
> needs
> >> we have to create a temporary file that is the result of massaging and
> >> correcting the original and parse that temp file.
> >>
> >> PS: Don't get me wrong, we don't have this nailed down exactly yet.
> There
> >> are some deliverables what we are still working on. For example our
> config
> >> files deliver individual files that are contained within tar files. This
> >> seems to be opposite of what the Scons tarfile builder does(builds tar
> files
> >> from a collection of files). We have not cracked nut not yet.
> >>
> >> Spencer Yost
> >>
> >> On Feb 18, 2018, at 9:54 AM, Bill Deegan <***@baddogconsulting.com>
> >> wrote:
> >>
> >> Spencer,
> >>
> >> So your build info source are these .ini files?
> >> And your SConscript files just process them?
> >>
> >> -Bill
> >>
> >> On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com>
> wrote:
> >>>
> >>> Just as an offhand comment, that is sort of related to this. First, I
> >>> don't have to import a lot.
> >>>
> >>> We just converted our build system to SCons(~1600+ packages, ~15000
> >>> source files and tens of millions of lines of code). Because python
> >>> expertise ranges from completely lacking to extremely poor :-) in our
> c/c++
> >>> staff; the powers that be indicated that developers will not maintain
> >>> SConscript files. They will maintain the original build configuration
> files
> >>> that we had(something that approximates a win.ini file). That means I
> have
> >>> to rebuild SConscript files for every original configuration file we
> had.
> >>> Trying to figure out a way to programmatically consolidate them to
> minimize
> >>> the number of SConscript files was nearly impossible. So we have about
> 1600
> >>> SConscript files. Stuff like library dependencies vary between
> "packages"
> >>> very frequently too. In addition the staff has to be able to build an
> >>> individual "package" or the whole tree. I have a builder that
> creates the
> >>> SConscript file whenever this original build configuration file
> changes. So
> >>> it's not a big deal. But consolidating them was just way too big of a
> fish
> >>> to fry in the time and budget allowed.
> >>>
> >>> Sometimes you just have to have a bunch of them.
> >>>
> >>> PS: SCons is working great for us. Dependencies are much more robust,
> >>> speed is marginally better and the entire arc from source code change
> to
> >>> Debian package creation is flawless. Being able to create command line
> >>> options has been a godsend for us. Previously we would have to create
> build
> >>> macros to emulate what command line options do.
> >>>
> >>> Spencer Yost
> >>>
> >>> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com>
> >>> wrote:
> >>>
> >>> Hua,
> >>>
> >>> From the tree you've shared, I'm going to guess you have way more
> >>> SConscripts than you need.
> >>>
> >>> For example, you're set of test directories could have a single
> >>> SConscript instead of one per.
> >>> Which no doubt are just a few lines each.
> >>>
> >>> In some cases it looks like you have a SConscript in a directory which
> >>> only has a header file (or none) and then a directory (or more) of
> source
> >>> code. Skip the SConscript in the basically no-op directorie(s).
> >>>
> >>> Another suggestion, use variant dirs so you're not creating build files
> >>> in your source directory.
> >>>
> >>> If you find yourself with a ton of very small SConscripts, it's a sign
> >>> that you may be doing something non-scons'ian.
> >>>
> >>> Of course it also depends on how working on each group of code is split
> >>> up between different developers.
> >>>
> >>> There is some art in structuring your build system (and your code) such
> >>> that engineers rarely end up causing merge conflicts with each other.
> >>>
> >>> I can see some value in default_import, but it would be something
> >>> requiring some debate on getting accepted.
> >>> As far as I can recall, your's is the first request for something like
> >>> this in the history of SCons (or at least as long as I've been
> involved).
> >>>
> >>> Philosophically SCons is about being explicit in the build requirements
> >>> and also about being correct by design. Yielding reproducible builds
> >>> regardless of the individual developers shell and machine setup.
> >>>
> >>>
> >>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com>
> >>> wrote:
> >>>>
> >>>> Hi Bill,
> >>>> I do not create a SConscript for every directory, only for directly
> >>>> which either provide a set of include file or having source code to
> >>>> build.
> >>>> I will try to create a minimal version of the build system to show the
> >>>> idea.
> >>>>
> >>>> Not sure if the below tree will give you some idea what I am trying to
> >>>> implement, at least you should be able to see where I am having a
> >>>> SConscript file.
> >>>> build/configs/riscv_example/riscv32-qemu-virt-main/
> >>>> ├── cmdlist.txt
> >>>> ├── config
> >>>> │ └── config.h
> >>>> ├── firmware
> >>>> │ ├── arch
> >>>> │ │ ├── include
> >>>> │ │ │ └── arch
> >>>> │ │ │ ├── cache.h
> >>>> │ │ │ ├── irq.h
> >>>> │ │ │ ├── misc.h
> >>>> │ │ │ ├── mmu.h
> >>>> │ │ │ ├── smp.h
> >>>> │ │ │ ├── spinlock.h
> >>>> │ │ │ └── timer.h
> >>>> │ │ ├── riscv
> >>>> │ │ │ ├── helper.c
> >>>> │ │ │ ├── helper.o
> >>>> │ │ │ ├── libdefault.o
> >>>> │ │ │ ├── main.c
> >>>> │ │ │ ├── main.o
> >>>> │ │ │ ├── SConscript
> >>>> │ │ │ ├── start.o
> >>>> │ │ │ └── start.S
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── weak.c
> >>>> │ │ └── weak.o
> >>>> │ ├── boards
> >>>> │ │ ├── include
> >>>> │ │ │ └── board.h
> >>>> │ │ ├── qemu-riscv32-virt
> >>>> │ │ │ ├── board.c
> >>>> │ │ │ ├── board.o
> >>>> │ │ │ ├── SConscript
> >>>> │ │ │ ├── uart16550_device.c
> >>>> │ │ │ └── uart16550_device.o
> >>>> │ │ └── SConscript
> >>>> │ ├── common
> >>>> │ │ ├── cpu.c
> >>>> │ │ ├── cpu.o
> >>>> │ │ ├── include
> >>>> │ │ │ └── common
> >>>> │ │ │ ├── common.h
> >>>> │ │ │ ├── cpu.h
> >>>> │ │ │ └── log.h
> >>>> │ │ ├── libdefault.o
> >>>> │ │ ├── log.c
> >>>> │ │ ├── log.o
> >>>> │ │ ├── main.c
> >>>> │ │ ├── main.o
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── weak.c
> >>>> │ │ └── weak.o
> >>>> │ ├── drivers
> >>>> │ │ └── uart16550
> >>>> │ │ ├── fd_ops.c
> >>>> │ │ ├── fd_ops.o
> >>>> │ │ ├── include
> >>>> │ │ │ ├── uart16550_api.h
> >>>> │ │ │ └── uart16550_device.h
> >>>> │ │ ├── libdefault.o
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── uart16550.c
> >>>> │ │ └── uart16550.o
> >>>> │ ├── include
> >>>> │ │ ├── bootstage.h
> >>>> │ │ ├── compiler.h
> >>>> │ │ ├── debug.h
> >>>> │ │ └── linux
> >>>> │ │ └── typecheck.h
> >>>> │ ├── lib
> >>>> │ │ ├── cmd
> >>>> │ │ │ ├── cmd.c
> >>>> │ │ │ ├── cmd.o
> >>>> │ │ │ ├── include
> >>>> │ │ │ │ └── cmd
> >>>> │ │ │ │ └── cmd.h
> >>>> │ │ │ ├── SConscript
> >>>> │ │ │ ├── test.c
> >>>> │ │ │ └── test.o
> >>>> │ │ ├── fio
> >>>> │ │ │ ├── cmd.c
> >>>> │ │ │ ├── cmd.o
> >>>> │ │ │ ├── include
> >>>> │ │ │ │ └── usw_device_public.h
> >>>> │ │ │ ├── libdefault.o
> >>>> │ │ │ ├── newlib.c
> >>>> │ │ │ ├── newlib.o
> >>>> │ │ │ ├── SConscript
> >>>> │ │ │ ├── usw_device.c
> >>>> │ │ │ ├── usw_device.o
> >>>> │ │ │ └── usw_device_private.h
> >>>> │ │ ├── pipe
> >>>> │ │ │ ├── include
> >>>> │ │ │ │ └── pipe
> >>>> │ │ │ │ ├── pipe.h
> >>>> │ │ │ │ └── status.h
> >>>> │ │ │ ├── libdefault.o
> >>>> │ │ │ ├── pipe.c
> >>>> │ │ │ ├── pipe.o
> >>>> │ │ │ └── SConscript
> >>>> │ │ └── simple_console
> >>>> │ │ ├── include
> >>>> │ │ │ └── simple_console.h
> >>>> │ │ ├── libdefault.o
> >>>> │ │ ├── print_color.h
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── simple_console.c
> >>>> │ │ └── simple_console.o
> >>>> │ ├── SConscript
> >>>> │ └── test
> >>>> │ ├── common
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── test.c
> >>>> │ │ └── test.o
> >>>> │ ├── console
> >>>> │ │ ├── hello.c
> >>>> │ │ ├── hello.o
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── test.c
> >>>> │ │ └── test.o
> >>>> │ ├── example
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── test.c
> >>>> │ │ └── test.o
> >>>> │ ├── libc
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── test.c
> >>>> │ │ └── test.o
> >>>> │ ├── linker
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── test.c
> >>>> │ │ └── test.o
> >>>> │ ├── log
> >>>> │ │ ├── SConscript
> >>>> │ │ ├── test.c
> >>>> │ │ └── test.o
> >>>> │ └── setjmp
> >>>> │ ├── SConscript
> >>>> │ ├── test2.c
> >>>> │ ├── test2.o
> >>>> │ ├── test.c
> >>>> │ └── test.o
> >>>> ├── libriscv_example.a
> >>>> ├── link.ld
> >>>> ├── riscv_example.bin
> >>>> ├── riscv_example.elf
> >>>> ├── riscv_example.ibi_bin
> >>>> ├── riscv_example.map
> >>>> └── riscv_example.S
> >>>>
> >>>> 36 directories, 113 files
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan
> >>>> <***@baddogconsulting.com> wrote:
> >>>> > Likely you don't need a SConscript for every directory in your case?
> >>>> > Are you wrapping a complete linux build tree?
> >>>> >
> >>>> > Is this a build tree you can share for us to look at?
> >>>> >
> >>>> > -Bill
> >>>> >
> >>>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com>
> >>>> > wrote:
> >>>> >>
> >>>> >> I see everything passed into env.SConscript(default_import=
> some_obj),
> >>>> >> if some_obj is a string it can pass through but if some_obj is a
> >>>> >> function object it end up as None in
> >>>> >> Script/SConscript.py/SConscript()
> >>>> >> function.
> >>>> >>
> >>>> >> I could have used a string and then import the right function
> however
> >>>> >> my function to be passed is a dynamically generated partial
> function
> >>>> >> ...
> >>>> >>
> >>>> >> Could anyone please give me some hint how could this be best
> >>>> >> implemented?
> >>>> >>
> >>>> >> Best Regards,
> >>>> >> Yanghao
> >>>> >>
> >>>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao <***@gmail.com
> >
> >>>> >> wrote:
> >>>> >> > @Bill, I have managed to hack the Frame class and the
> >>>> >> > BuildDefaultGlobals() function to have some thing imported into
> >>>> >> > SConscript by default.
> >>>> >> > However I don't quite understand when the "default_import"
> keyword
> >>>> >> > argument passed down, somewhere somehow it end up as a set.
> >>>> >> >
> >>>> >> > Any documentation to explain what is going on from Base class
> into
> >>>> >> > SConscript() calls regarding parameter handling?
> >>>> >> >
> >>>> >> > Thanks,
> >>>> >> > Yanghao
> >>>> >> >
> >>>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao <
> ***@gmail.com>
> >>>> >> > wrote:
> >>>> >> >> It varies a lot, ranging from 0 (yes, no source files at all)
> to a
> >>>> >> >> few
> >>>> >> >> dozen (didn't really count, see statistics below).
> >>>> >> >>
> >>>> >> >> Here is an example Linux kernel driver sub-module Makefile:
> >>>> >> >>
> >>>> >> >> linux/drivers/sn/Makefile:
> >>>> >> >> 1 #
> >>>> >> >> 2 # Makefile for the Altix device drivers.
> >>>> >> >> 3 #
> >>>> >> >> 4 #
> >>>> >> >> 5
> >>>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
> >>>> >> >>
> >>>> >> >> I want to replicate this kind of simplicity in scons.
> >>>> >> >>
> >>>> >> >> I actually have implemented almost the same thing in scons, but
> >>>> >> >> all
> >>>> >> >> those SConscript files have to start with Import("my_func") ...
> >>>> >> >> which
> >>>> >> >> is pretty annoying. I know I need it in every single SConscript,
> >>>> >> >> and I
> >>>> >> >> have to repeat it ... and this is so anti-pattern.
> >>>> >> >> I have get rid of the Return() part already, but getting rid of
> >>>> >> >> the
> >>>> >> >> Import() part seems not that straightforward.
> >>>> >> >>
> >>>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
> >>>> >> >> 121 121 5953
> >>>> >> >>
> >>>> >> >> At the moment the project supports 4 different CPU
> architectures,
> >>>> >> >> a
> >>>> >> >> little less than 1000 C files, 400K+ lines of code.
> >>>> >> >>
> >>>> >> >> And this is no small problem (at least for me). If I start
> working
> >>>> >> >> around it with too much python code, I might end up bypassing a
> >>>> >> >> significant portion of core scons and eventually might find it
> >>>> >> >> easier
> >>>> >> >> to just wrap around Makefiles.
> >>>> >> >>
> >>>> >> >> Someone thought I was criticizing scons, I actually love scons,
> >>>> >> >> but
> >>>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me as
> >>>> >> >> an
> >>>> >> >> enemy I am a serious user of scons since 10 years ago when I was
> >>>> >> >> still
> >>>> >> >> in college.
> >>>> >> >>
> >>>> >> >> Best Regards,
> >>>> >> >> Yanghao
> >>>> >> >>
> >>>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
> >>>> >> >> <***@baddogconsulting.com> wrote:
> >>>> >> >>> How many source files per SConscript?
> >>>> >> >>> That's a lot of sconscripts.
> >>>> >> >>> Is this all one project?
> >>>> >> >>> Are all the SConscripts identical?
> >>>> >> >>>
> >>>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao
> >>>> >> >>> <***@gmail.com>
> >>>> >> >>> wrote:
> >>>> >> >>>>
> >>>> >> >>>> Actually I have one and only one import for hundreds of
> >>>> >> >>>> SConscript :)
> >>>> >> >>>>
> >>>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
> >>>> >> >>>> <***@gmail.com> wrote:
> >>>> >> >>>>>
> >>>> >> >>>>> Hua,
> >>>> >> >>>>>
> >>>> >> >>>>> If you are importing lots of variables into SConscripts, then
> >>>> >> >>>>> you're
> >>>> >> >>>>> using SCons wrong. Most of your variables should probably be
> >>>> >> >>>>> construction
> >>>> >> >>>>> variables (in the environment).
> >>>> >> >>>>>
> >>>> >> >>>>> I've written many, many SConscripts and I've never used more
> >>>> >> >>>>> than 3
> >>>> >> >>>>> or 4
> >>>> >> >>>>> Import() statements in a single SConscript. Before you
> critique
> >>>> >> >>>>> a
> >>>> >> >>>>> long-established framework, you might want to consider if
> >>>> >> >>>>> you're
> >>>> >> >>>>> using it
> >>>> >> >>>>> inappropriately.
> >>>> >> >>>>>
> >>>> >> >>>>> Jonathon
> >>>> >> >>>>>
> >>>> >> >>>>>
> >>>> >> >>>>>
> >>>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao
> >>>> >> >>>>> <***@gmail.com>
> >>>> >> >>>>> wrote:
> >>>> >> >>>>>>
> >>>> >> >>>>>> Will do. It is really not good if a particular framework
> force
> >>>> >> >>>>>> user
> >>>> >> >>>>>> to
> >>>> >> >>>>>> create repeated code. In comparison kbuild can easily
> create a
> >>>> >> >>>>>> one
> >>>> >> >>>>>> line make
> >>>> >> >>>>>> file for a module.
> >>>> >> >>>>>>
> >>>> >> >>>>>> I am using localized scons anyway if not accepted will just
> >>>> >> >>>>>> use it
> >>>> >> >>>>>> on my
> >>>> >> >>>>>> own.
> >>>> >> >>>>>>
> >>>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
> >>>> >> >>>>>> <***@baddogconsulting.com>
> >>>> >> >>>>>> wrote:
> >>>> >> >>>>>>>
> >>>> >> >>>>>>> Feel free to make a pull request, though I can't promise
> that
> >>>> >> >>>>>>> it
> >>>> >> >>>>>>> will
> >>>> >> >>>>>>> be accepted.
> >>>> >> >>>>>>>
> >>>> >> >>>>>>> Is it really that much of an inconvenience?
> >>>> >> >>>>>>> -Bill
> >>>> >> >>>>>>>
> >>>> >> >>>>>>>
> >>>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
> >>>> >> >>>>>>> <***@gmail.com>
> >>>> >> >>>>>>> wrote:
> >>>> >> >>>>>>>>
> >>>> >> >>>>>>>> Hi Bill,
> >>>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
> >>>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
> >>>> >> >>>>>>>> For return I think I can abuse some global variables. This
> >>>> >> >>>>>>>> can
> >>>> >> >>>>>>>> really
> >>>> >> >>>>>>>> make the SConscript clean/minimal.
> >>>> >> >>>>>>>>
> >>>> >> >>>>>>>> Best Regards,
> >>>> >> >>>>>>>> Yanghao
> >>>> >> >>>>>>>>
> >>>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
> >>>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
> >>>> >> >>>>>>>> > No, there is no way without hacking the core code.
> >>>> >> >>>>>>>> >
> >>>> >> >>>>>>>> > It is the way it is by design.
> >>>> >> >>>>>>>> >
> >>>> >> >>>>>>>> > -Bill
> >>>> >> >>>>>>>> > SCons Project Co-Manager
> >>>> >> >>>>>>>> >
> >>>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
> >>>> >> >>>>>>>> > <***@gmail.com>
> >>>> >> >>>>>>>> > wrote:
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly
> >>>> >> >>>>>>>> >> make a
> >>>> >> >>>>>>>> >> object
> >>>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
> >>>> >> >>>>>>>> >> Import(xyz)?
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> Just want to eliminate the annoying repeated
> Import(xyz)
> >>>> >> >>>>>>>> >> in
> >>>> >> >>>>>>>> >> every
> >>>> >> >>>>>>>> >> single SConscript.
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a
> >>>> >> >>>>>>>> >> list of
> >>>> >> >>>>>>>> >> object,
> >>>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct
> want
> >>>> >> >>>>>>>> >> to
> >>>> >> >>>>>>>> >> collect
> >>>> >> >>>>>>>> >> the complete list of object returned from every single
> >>>> >> >>>>>>>> >> SConscript.
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> For example:
> >>>> >> >>>>>>>> >> SConscript-1:
> >>>> >> >>>>>>>> >> Import("xyz")
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> ret = xyz(...)
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> Return("ret")
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> Would ideally become:
> >>>> >> >>>>>>>> >> SConscript-2:
> >>>> >> >>>>>>>> >> xyz(...)
> >>>> >> >>>>>>>> >>
> >>>> >> >>>>>>>> >> Thanks,
> >>>> >> >>>>>>>> >> Yanghao
> >>>> >> >>>>>>>> >> _______________________________________________
> >>>> >> >>>>>>>> >> Scons-users mailing list
> >>>> >> >>>>>>>> >> Scons-***@scons.org
> >>>> >> >>>>>>>> >> https://pairlist4.pair.net/
> mailman/listinfo/scons-users
> >>>> >> >>>>>>>> >
> >>>> >> >>>>>>>> >
> >>>> >> >>>>>>>> >
> >>>> >> >>>>>>>> > _______________________________________________
> >>>> >> >>>>>>>> > Scons-users mailing list
> >>>> >> >>>>>>>> > Scons-***@scons.org
> >>>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >> >>>>>>>> >
> >>>> >> >>>>>>>> _______________________________________________
> >>>> >> >>>>>>>> Scons-users mailing list
> >>>> >> >>>>>>>> Scons-***@scons.org
> >>>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >> >>>>>>>
> >>>> >> >>>>>>>
> >>>> >> >>>>>>> _______________________________________________
> >>>> >> >>>>>>> Scons-users mailing list
> >>>> >> >>>>>>> Scons-***@scons.org
> >>>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >> >>>>>>
> >>>> >> >>>>>>
> >>>> >> >>>>>> _______________________________________________
> >>>> >> >>>>>> Scons-users mailing list
> >>>> >> >>>>>> Scons-***@scons.org
> >>>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >> >>>>>>
> >>>> >> >>>>>
> >>>> >> >>>>> _______________________________________________
> >>>> >> >>>>> Scons-users mailing list
> >>>> >> >>>>> Scons-***@scons.org
> >>>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >> >>>>
> >>>> >> >>>>
> >>>> >> >>>> _______________________________________________
> >>>> >> >>>> Scons-users mailing list
> >>>> >> >>>> Scons-***@scons.org
> >>>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >> >>>>
> >>>> >> >>>
> >>>> >> >>>
> >>>> >> >>> _______________________________________________
> >>>> >> >>> Scons-users mailing list
> >>>> >> >>> Scons-***@scons.org
> >>>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >> >>>
> >>>> >> _______________________________________________
> >>>> >> Scons-users mailing list
> >>>> >> Scons-***@scons.org
> >>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >
> >>>> >
> >>>> >
> >>>> > _______________________________________________
> >>>> > Scons-users mailing list
> >>>> > Scons-***@scons.org
> >>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>> >
> >>>> _______________________________________________
> >>>> Scons-users mailing list
> >>>> Scons-***@scons.org
> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>
> >>>
> >>> _______________________________________________
> >>> Scons-users mailing list
> >>> Scons-***@scons.org
> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>
> >>>
> >>> _______________________________________________
> >>> Scons-users mailing list
> >>> Scons-***@scons.org
> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>>
> >>
> >> _______________________________________________
> >> Scons-users mailing list
> >> Scons-***@scons.org
> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>
> >>
> >> _______________________________________________
> >> Scons-users mailing list
> >> Scons-***@scons.org
> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >>
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Hua Yanghao
2018-02-19 18:16:00 UTC
Permalink
Thanks Bill. Will give it a try.

I see now after the VariantDir() call, in the script you can already
assume the target source files are in that variant dir.
I think I always got confused with this before and only actually made
variant_dir using SConscript working.

On Mon, Feb 19, 2018 at 6:20 PM, Bill Deegan <***@baddogconsulting.com> wrote:
> Here's two ways which are similar to using variant_dir in a SConscript call.
>
> env.Program('some_build_dir/program', ['src/a.c','src/b.c'])
> Assuming you have duplicate = 0
>
> Or you can specify the
>
> VariantDir('some_build_dir','src')
> env.Program('some_build_dir/program', [os.path.join('some_build_dir',a) for
> a in ['a.c','b.c'])
>
>
> If you're doing a one time migration from some other build file to
> sconscripts, then automate that and move forward from that.
> If you're doing a "we'll always use the other build file" and then generate
> sconscripts each time, I guess you can automate that like Spencer has.
> Or you could create you own logic to read the other build file and make the
> correct SCons calls to emulate the intent of the other build system.
>
> Such logic could be run every time as plain python logic, just make sure it
> get's run before your first SConscript call.
>
> Manually converting and maintaining two build files next to each other for
> two sets of developers just sounds like hell to me..
>
> Either way Import('env') is not going to be a nuisance because you'll have
> scripted the bulk of the conversion/migration.
>
> -Bill
>
>
>
>
> On Mon, Feb 19, 2018 at 11:10 AM, Hua Yanghao <***@gmail.com> wrote:
>>
>> Hi Bill,
>> How do you handle variant_dir in this case, do you need the module to
>> be built out of tree in a central place with other modules?
>> Or were you able to provide a variant_dir=... also to all the builder
>> that is used?
>>
>> Best Regards,
>> Yanghao
>>
>> On Mon, Feb 19, 2018 at 4:42 PM, Bill Deegan <***@baddogconsulting.com>
>> wrote:
>> > Spencer,
>> >
>> > I worked on a similar build system a while back for a client.
>> > My solution was SConstruct did the bulk of the work and no SConscripts
>> > were
>> > ever created.
>> > The source stayed the clients home made file because they weren't
>> > willing to
>> > change.
>> >
>> > The logic walked the files figured out which builders needed to be
>> > called
>> > and which environment() variables needed to be set for each .ini file
>> > and
>> > then called them. It was actually fairly simple to implement and
>> > maintain.
>> >
>> > -Bill
>> >
>> > On Sun, Feb 18, 2018 at 11:08 PM, Spencer Yost <***@triad.rr.com>
>> > wrote:
>> >>
>> >> Right, our SConstruct walks the target, looking for the ini files. If
>> >> it
>> >> finds one, it passes them to the SConscript builder. The builder
>> >> obviously
>> >> creates an SConscript if the the ini file has changed. We then pass
>> >> this
>> >> SConscript to the SConscript() call.
>> >>
>> >> Again, our original build configuration files are sort of approximation
>> >> an
>> >> ini file - but not exact. The builder is actually several hundred lines
>> >> of
>> >> Python code. Because they are not exactly what the configparser module
>> >> needs
>> >> we have to create a temporary file that is the result of massaging and
>> >> correcting the original and parse that temp file.
>> >>
>> >> PS: Don't get me wrong, we don't have this nailed down exactly yet.
>> >> There
>> >> are some deliverables what we are still working on. For example our
>> >> config
>> >> files deliver individual files that are contained within tar files.
>> >> This
>> >> seems to be opposite of what the Scons tarfile builder does(builds tar
>> >> files
>> >> from a collection of files). We have not cracked nut not yet.
>> >>
>> >> Spencer Yost
>> >>
>> >> On Feb 18, 2018, at 9:54 AM, Bill Deegan <***@baddogconsulting.com>
>> >> wrote:
>> >>
>> >> Spencer,
>> >>
>> >> So your build info source are these .ini files?
>> >> And your SConscript files just process them?
>> >>
>> >> -Bill
>> >>
>> >> On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com>
>> >> wrote:
>> >>>
>> >>> Just as an offhand comment, that is sort of related to this. First, I
>> >>> don't have to import a lot.
>> >>>
>> >>> We just converted our build system to SCons(~1600+ packages, ~15000
>> >>> source files and tens of millions of lines of code). Because python
>> >>> expertise ranges from completely lacking to extremely poor :-) in our
>> >>> c/c++
>> >>> staff; the powers that be indicated that developers will not maintain
>> >>> SConscript files. They will maintain the original build configuration
>> >>> files
>> >>> that we had(something that approximates a win.ini file). That means I
>> >>> have
>> >>> to rebuild SConscript files for every original configuration file we
>> >>> had.
>> >>> Trying to figure out a way to programmatically consolidate them to
>> >>> minimize
>> >>> the number of SConscript files was nearly impossible. So we have about
>> >>> 1600
>> >>> SConscript files. Stuff like library dependencies vary between
>> >>> "packages"
>> >>> very frequently too. In addition the staff has to be able to build an
>> >>> individual "package" or the whole tree. I have a builder that
>> >>> creates the
>> >>> SConscript file whenever this original build configuration file
>> >>> changes. So
>> >>> it's not a big deal. But consolidating them was just way too big of a
>> >>> fish
>> >>> to fry in the time and budget allowed.
>> >>>
>> >>> Sometimes you just have to have a bunch of them.
>> >>>
>> >>> PS: SCons is working great for us. Dependencies are much more robust,
>> >>> speed is marginally better and the entire arc from source code change
>> >>> to
>> >>> Debian package creation is flawless. Being able to create command line
>> >>> options has been a godsend for us. Previously we would have to create
>> >>> build
>> >>> macros to emulate what command line options do.
>> >>>
>> >>> Spencer Yost
>> >>>
>> >>> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com>
>> >>> wrote:
>> >>>
>> >>> Hua,
>> >>>
>> >>> From the tree you've shared, I'm going to guess you have way more
>> >>> SConscripts than you need.
>> >>>
>> >>> For example, you're set of test directories could have a single
>> >>> SConscript instead of one per.
>> >>> Which no doubt are just a few lines each.
>> >>>
>> >>> In some cases it looks like you have a SConscript in a directory which
>> >>> only has a header file (or none) and then a directory (or more) of
>> >>> source
>> >>> code. Skip the SConscript in the basically no-op directorie(s).
>> >>>
>> >>> Another suggestion, use variant dirs so you're not creating build
>> >>> files
>> >>> in your source directory.
>> >>>
>> >>> If you find yourself with a ton of very small SConscripts, it's a sign
>> >>> that you may be doing something non-scons'ian.
>> >>>
>> >>> Of course it also depends on how working on each group of code is
>> >>> split
>> >>> up between different developers.
>> >>>
>> >>> There is some art in structuring your build system (and your code)
>> >>> such
>> >>> that engineers rarely end up causing merge conflicts with each other.
>> >>>
>> >>> I can see some value in default_import, but it would be something
>> >>> requiring some debate on getting accepted.
>> >>> As far as I can recall, your's is the first request for something like
>> >>> this in the history of SCons (or at least as long as I've been
>> >>> involved).
>> >>>
>> >>> Philosophically SCons is about being explicit in the build
>> >>> requirements
>> >>> and also about being correct by design. Yielding reproducible builds
>> >>> regardless of the individual developers shell and machine setup.
>> >>>
>> >>>
>> >>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> Hi Bill,
>> >>>> I do not create a SConscript for every directory, only for directly
>> >>>> which either provide a set of include file or having source code to
>> >>>> build.
>> >>>> I will try to create a minimal version of the build system to show
>> >>>> the
>> >>>> idea.
>> >>>>
>> >>>> Not sure if the below tree will give you some idea what I am trying
>> >>>> to
>> >>>> implement, at least you should be able to see where I am having a
>> >>>> SConscript file.
>> >>>> build/configs/riscv_example/riscv32-qemu-virt-main/
>> >>>> ├── cmdlist.txt
>> >>>> ├── config
>> >>>> │ └── config.h
>> >>>> ├── firmware
>> >>>> │ ├── arch
>> >>>> │ │ ├── include
>> >>>> │ │ │ └── arch
>> >>>> │ │ │ ├── cache.h
>> >>>> │ │ │ ├── irq.h
>> >>>> │ │ │ ├── misc.h
>> >>>> │ │ │ ├── mmu.h
>> >>>> │ │ │ ├── smp.h
>> >>>> │ │ │ ├── spinlock.h
>> >>>> │ │ │ └── timer.h
>> >>>> │ │ ├── riscv
>> >>>> │ │ │ ├── helper.c
>> >>>> │ │ │ ├── helper.o
>> >>>> │ │ │ ├── libdefault.o
>> >>>> │ │ │ ├── main.c
>> >>>> │ │ │ ├── main.o
>> >>>> │ │ │ ├── SConscript
>> >>>> │ │ │ ├── start.o
>> >>>> │ │ │ └── start.S
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── weak.c
>> >>>> │ │ └── weak.o
>> >>>> │ ├── boards
>> >>>> │ │ ├── include
>> >>>> │ │ │ └── board.h
>> >>>> │ │ ├── qemu-riscv32-virt
>> >>>> │ │ │ ├── board.c
>> >>>> │ │ │ ├── board.o
>> >>>> │ │ │ ├── SConscript
>> >>>> │ │ │ ├── uart16550_device.c
>> >>>> │ │ │ └── uart16550_device.o
>> >>>> │ │ └── SConscript
>> >>>> │ ├── common
>> >>>> │ │ ├── cpu.c
>> >>>> │ │ ├── cpu.o
>> >>>> │ │ ├── include
>> >>>> │ │ │ └── common
>> >>>> │ │ │ ├── common.h
>> >>>> │ │ │ ├── cpu.h
>> >>>> │ │ │ └── log.h
>> >>>> │ │ ├── libdefault.o
>> >>>> │ │ ├── log.c
>> >>>> │ │ ├── log.o
>> >>>> │ │ ├── main.c
>> >>>> │ │ ├── main.o
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── weak.c
>> >>>> │ │ └── weak.o
>> >>>> │ ├── drivers
>> >>>> │ │ └── uart16550
>> >>>> │ │ ├── fd_ops.c
>> >>>> │ │ ├── fd_ops.o
>> >>>> │ │ ├── include
>> >>>> │ │ │ ├── uart16550_api.h
>> >>>> │ │ │ └── uart16550_device.h
>> >>>> │ │ ├── libdefault.o
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── uart16550.c
>> >>>> │ │ └── uart16550.o
>> >>>> │ ├── include
>> >>>> │ │ ├── bootstage.h
>> >>>> │ │ ├── compiler.h
>> >>>> │ │ ├── debug.h
>> >>>> │ │ └── linux
>> >>>> │ │ └── typecheck.h
>> >>>> │ ├── lib
>> >>>> │ │ ├── cmd
>> >>>> │ │ │ ├── cmd.c
>> >>>> │ │ │ ├── cmd.o
>> >>>> │ │ │ ├── include
>> >>>> │ │ │ │ └── cmd
>> >>>> │ │ │ │ └── cmd.h
>> >>>> │ │ │ ├── SConscript
>> >>>> │ │ │ ├── test.c
>> >>>> │ │ │ └── test.o
>> >>>> │ │ ├── fio
>> >>>> │ │ │ ├── cmd.c
>> >>>> │ │ │ ├── cmd.o
>> >>>> │ │ │ ├── include
>> >>>> │ │ │ │ └── usw_device_public.h
>> >>>> │ │ │ ├── libdefault.o
>> >>>> │ │ │ ├── newlib.c
>> >>>> │ │ │ ├── newlib.o
>> >>>> │ │ │ ├── SConscript
>> >>>> │ │ │ ├── usw_device.c
>> >>>> │ │ │ ├── usw_device.o
>> >>>> │ │ │ └── usw_device_private.h
>> >>>> │ │ ├── pipe
>> >>>> │ │ │ ├── include
>> >>>> │ │ │ │ └── pipe
>> >>>> │ │ │ │ ├── pipe.h
>> >>>> │ │ │ │ └── status.h
>> >>>> │ │ │ ├── libdefault.o
>> >>>> │ │ │ ├── pipe.c
>> >>>> │ │ │ ├── pipe.o
>> >>>> │ │ │ └── SConscript
>> >>>> │ │ └── simple_console
>> >>>> │ │ ├── include
>> >>>> │ │ │ └── simple_console.h
>> >>>> │ │ ├── libdefault.o
>> >>>> │ │ ├── print_color.h
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── simple_console.c
>> >>>> │ │ └── simple_console.o
>> >>>> │ ├── SConscript
>> >>>> │ └── test
>> >>>> │ ├── common
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── test.c
>> >>>> │ │ └── test.o
>> >>>> │ ├── console
>> >>>> │ │ ├── hello.c
>> >>>> │ │ ├── hello.o
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── test.c
>> >>>> │ │ └── test.o
>> >>>> │ ├── example
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── test.c
>> >>>> │ │ └── test.o
>> >>>> │ ├── libc
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── test.c
>> >>>> │ │ └── test.o
>> >>>> │ ├── linker
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── test.c
>> >>>> │ │ └── test.o
>> >>>> │ ├── log
>> >>>> │ │ ├── SConscript
>> >>>> │ │ ├── test.c
>> >>>> │ │ └── test.o
>> >>>> │ └── setjmp
>> >>>> │ ├── SConscript
>> >>>> │ ├── test2.c
>> >>>> │ ├── test2.o
>> >>>> │ ├── test.c
>> >>>> │ └── test.o
>> >>>> ├── libriscv_example.a
>> >>>> ├── link.ld
>> >>>> ├── riscv_example.bin
>> >>>> ├── riscv_example.elf
>> >>>> ├── riscv_example.ibi_bin
>> >>>> ├── riscv_example.map
>> >>>> └── riscv_example.S
>> >>>>
>> >>>> 36 directories, 113 files
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan
>> >>>> <***@baddogconsulting.com> wrote:
>> >>>> > Likely you don't need a SConscript for every directory in your
>> >>>> > case?
>> >>>> > Are you wrapping a complete linux build tree?
>> >>>> >
>> >>>> > Is this a build tree you can share for us to look at?
>> >>>> >
>> >>>> > -Bill
>> >>>> >
>> >>>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <***@gmail.com>
>> >>>> > wrote:
>> >>>> >>
>> >>>> >> I see everything passed into
>> >>>> >> env.SConscript(default_import=some_obj),
>> >>>> >> if some_obj is a string it can pass through but if some_obj is a
>> >>>> >> function object it end up as None in
>> >>>> >> Script/SConscript.py/SConscript()
>> >>>> >> function.
>> >>>> >>
>> >>>> >> I could have used a string and then import the right function
>> >>>> >> however
>> >>>> >> my function to be passed is a dynamically generated partial
>> >>>> >> function
>> >>>> >> ...
>> >>>> >>
>> >>>> >> Could anyone please give me some hint how could this be best
>> >>>> >> implemented?
>> >>>> >>
>> >>>> >> Best Regards,
>> >>>> >> Yanghao
>> >>>> >>
>> >>>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao
>> >>>> >> <***@gmail.com>
>> >>>> >> wrote:
>> >>>> >> > @Bill, I have managed to hack the Frame class and the
>> >>>> >> > BuildDefaultGlobals() function to have some thing imported into
>> >>>> >> > SConscript by default.
>> >>>> >> > However I don't quite understand when the "default_import"
>> >>>> >> > keyword
>> >>>> >> > argument passed down, somewhere somehow it end up as a set.
>> >>>> >> >
>> >>>> >> > Any documentation to explain what is going on from Base class
>> >>>> >> > into
>> >>>> >> > SConscript() calls regarding parameter handling?
>> >>>> >> >
>> >>>> >> > Thanks,
>> >>>> >> > Yanghao
>> >>>> >> >
>> >>>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao
>> >>>> >> > <***@gmail.com>
>> >>>> >> > wrote:
>> >>>> >> >> It varies a lot, ranging from 0 (yes, no source files at all)
>> >>>> >> >> to a
>> >>>> >> >> few
>> >>>> >> >> dozen (didn't really count, see statistics below).
>> >>>> >> >>
>> >>>> >> >> Here is an example Linux kernel driver sub-module Makefile:
>> >>>> >> >>
>> >>>> >> >> linux/drivers/sn/Makefile:
>> >>>> >> >> 1 #
>> >>>> >> >> 2 # Makefile for the Altix device drivers.
>> >>>> >> >> 3 #
>> >>>> >> >> 4 #
>> >>>> >> >> 5
>> >>>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>> >>>> >> >>
>> >>>> >> >> I want to replicate this kind of simplicity in scons.
>> >>>> >> >>
>> >>>> >> >> I actually have implemented almost the same thing in scons, but
>> >>>> >> >> all
>> >>>> >> >> those SConscript files have to start with Import("my_func") ...
>> >>>> >> >> which
>> >>>> >> >> is pretty annoying. I know I need it in every single
>> >>>> >> >> SConscript,
>> >>>> >> >> and I
>> >>>> >> >> have to repeat it ... and this is so anti-pattern.
>> >>>> >> >> I have get rid of the Return() part already, but getting rid of
>> >>>> >> >> the
>> >>>> >> >> Import() part seems not that straightforward.
>> >>>> >> >>
>> >>>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" | wc
>> >>>> >> >> 121 121 5953
>> >>>> >> >>
>> >>>> >> >> At the moment the project supports 4 different CPU
>> >>>> >> >> architectures,
>> >>>> >> >> a
>> >>>> >> >> little less than 1000 C files, 400K+ lines of code.
>> >>>> >> >>
>> >>>> >> >> And this is no small problem (at least for me). If I start
>> >>>> >> >> working
>> >>>> >> >> around it with too much python code, I might end up bypassing a
>> >>>> >> >> significant portion of core scons and eventually might find it
>> >>>> >> >> easier
>> >>>> >> >> to just wrap around Makefiles.
>> >>>> >> >>
>> >>>> >> >> Someone thought I was criticizing scons, I actually love scons,
>> >>>> >> >> but
>> >>>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me
>> >>>> >> >> as
>> >>>> >> >> an
>> >>>> >> >> enemy I am a serious user of scons since 10 years ago when I
>> >>>> >> >> was
>> >>>> >> >> still
>> >>>> >> >> in college.
>> >>>> >> >>
>> >>>> >> >> Best Regards,
>> >>>> >> >> Yanghao
>> >>>> >> >>
>> >>>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>> >>>> >> >> <***@baddogconsulting.com> wrote:
>> >>>> >> >>> How many source files per SConscript?
>> >>>> >> >>> That's a lot of sconscripts.
>> >>>> >> >>> Is this all one project?
>> >>>> >> >>> Are all the SConscripts identical?
>> >>>> >> >>>
>> >>>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao
>> >>>> >> >>> <***@gmail.com>
>> >>>> >> >>> wrote:
>> >>>> >> >>>>
>> >>>> >> >>>> Actually I have one and only one import for hundreds of
>> >>>> >> >>>> SConscript :)
>> >>>> >> >>>>
>> >>>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>> >>>> >> >>>> <***@gmail.com> wrote:
>> >>>> >> >>>>>
>> >>>> >> >>>>> Hua,
>> >>>> >> >>>>>
>> >>>> >> >>>>> If you are importing lots of variables into SConscripts,
>> >>>> >> >>>>> then
>> >>>> >> >>>>> you're
>> >>>> >> >>>>> using SCons wrong. Most of your variables should probably be
>> >>>> >> >>>>> construction
>> >>>> >> >>>>> variables (in the environment).
>> >>>> >> >>>>>
>> >>>> >> >>>>> I've written many, many SConscripts and I've never used more
>> >>>> >> >>>>> than 3
>> >>>> >> >>>>> or 4
>> >>>> >> >>>>> Import() statements in a single SConscript. Before you
>> >>>> >> >>>>> critique
>> >>>> >> >>>>> a
>> >>>> >> >>>>> long-established framework, you might want to consider if
>> >>>> >> >>>>> you're
>> >>>> >> >>>>> using it
>> >>>> >> >>>>> inappropriately.
>> >>>> >> >>>>>
>> >>>> >> >>>>> Jonathon
>> >>>> >> >>>>>
>> >>>> >> >>>>>
>> >>>> >> >>>>>
>> >>>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao
>> >>>> >> >>>>> <***@gmail.com>
>> >>>> >> >>>>> wrote:
>> >>>> >> >>>>>>
>> >>>> >> >>>>>> Will do. It is really not good if a particular framework
>> >>>> >> >>>>>> force
>> >>>> >> >>>>>> user
>> >>>> >> >>>>>> to
>> >>>> >> >>>>>> create repeated code. In comparison kbuild can easily
>> >>>> >> >>>>>> create a
>> >>>> >> >>>>>> one
>> >>>> >> >>>>>> line make
>> >>>> >> >>>>>> file for a module.
>> >>>> >> >>>>>>
>> >>>> >> >>>>>> I am using localized scons anyway if not accepted will just
>> >>>> >> >>>>>> use it
>> >>>> >> >>>>>> on my
>> >>>> >> >>>>>> own.
>> >>>> >> >>>>>>
>> >>>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>> >>>> >> >>>>>> <***@baddogconsulting.com>
>> >>>> >> >>>>>> wrote:
>> >>>> >> >>>>>>>
>> >>>> >> >>>>>>> Feel free to make a pull request, though I can't promise
>> >>>> >> >>>>>>> that
>> >>>> >> >>>>>>> it
>> >>>> >> >>>>>>> will
>> >>>> >> >>>>>>> be accepted.
>> >>>> >> >>>>>>>
>> >>>> >> >>>>>>> Is it really that much of an inconvenience?
>> >>>> >> >>>>>>> -Bill
>> >>>> >> >>>>>>>
>> >>>> >> >>>>>>>
>> >>>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>> >>>> >> >>>>>>> <***@gmail.com>
>> >>>> >> >>>>>>> wrote:
>> >>>> >> >>>>>>>>
>> >>>> >> >>>>>>>> Hi Bill,
>> >>>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
>> >>>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>> >>>> >> >>>>>>>> For return I think I can abuse some global variables.
>> >>>> >> >>>>>>>> This
>> >>>> >> >>>>>>>> can
>> >>>> >> >>>>>>>> really
>> >>>> >> >>>>>>>> make the SConscript clean/minimal.
>> >>>> >> >>>>>>>>
>> >>>> >> >>>>>>>> Best Regards,
>> >>>> >> >>>>>>>> Yanghao
>> >>>> >> >>>>>>>>
>> >>>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>> >>>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
>> >>>> >> >>>>>>>> > No, there is no way without hacking the core code.
>> >>>> >> >>>>>>>> >
>> >>>> >> >>>>>>>> > It is the way it is by design.
>> >>>> >> >>>>>>>> >
>> >>>> >> >>>>>>>> > -Bill
>> >>>> >> >>>>>>>> > SCons Project Co-Manager
>> >>>> >> >>>>>>>> >
>> >>>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>> >>>> >> >>>>>>>> > <***@gmail.com>
>> >>>> >> >>>>>>>> > wrote:
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> Does anyone know in scons there are ways to implicitly
>> >>>> >> >>>>>>>> >> make a
>> >>>> >> >>>>>>>> >> object
>> >>>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without explicity
>> >>>> >> >>>>>>>> >> Import(xyz)?
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> Just want to eliminate the annoying repeated
>> >>>> >> >>>>>>>> >> Import(xyz)
>> >>>> >> >>>>>>>> >> in
>> >>>> >> >>>>>>>> >> every
>> >>>> >> >>>>>>>> >> single SConscript.
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz() returns a
>> >>>> >> >>>>>>>> >> list of
>> >>>> >> >>>>>>>> >> object,
>> >>>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct
>> >>>> >> >>>>>>>> >> want
>> >>>> >> >>>>>>>> >> to
>> >>>> >> >>>>>>>> >> collect
>> >>>> >> >>>>>>>> >> the complete list of object returned from every single
>> >>>> >> >>>>>>>> >> SConscript.
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> For example:
>> >>>> >> >>>>>>>> >> SConscript-1:
>> >>>> >> >>>>>>>> >> Import("xyz")
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> ret = xyz(...)
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> Return("ret")
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> Would ideally become:
>> >>>> >> >>>>>>>> >> SConscript-2:
>> >>>> >> >>>>>>>> >> xyz(...)
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> Thanks,
>> >>>> >> >>>>>>>> >> Yanghao
>> >>>> >> >>>>>>>> >> _______________________________________________
>> >>>> >> >>>>>>>> >> Scons-users mailing list
>> >>>> >> >>>>>>>> >> Scons-***@scons.org
>> >>>> >> >>>>>>>> >>
>> >>>> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>>>>>> >
>> >>>> >> >>>>>>>> >
>> >>>> >> >>>>>>>> >
>> >>>> >> >>>>>>>> > _______________________________________________
>> >>>> >> >>>>>>>> > Scons-users mailing list
>> >>>> >> >>>>>>>> > Scons-***@scons.org
>> >>>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>>>>>> >
>> >>>> >> >>>>>>>> _______________________________________________
>> >>>> >> >>>>>>>> Scons-users mailing list
>> >>>> >> >>>>>>>> Scons-***@scons.org
>> >>>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>>>>>
>> >>>> >> >>>>>>>
>> >>>> >> >>>>>>> _______________________________________________
>> >>>> >> >>>>>>> Scons-users mailing list
>> >>>> >> >>>>>>> Scons-***@scons.org
>> >>>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>>>>
>> >>>> >> >>>>>>
>> >>>> >> >>>>>> _______________________________________________
>> >>>> >> >>>>>> Scons-users mailing list
>> >>>> >> >>>>>> Scons-***@scons.org
>> >>>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>>>>
>> >>>> >> >>>>>
>> >>>> >> >>>>> _______________________________________________
>> >>>> >> >>>>> Scons-users mailing list
>> >>>> >> >>>>> Scons-***@scons.org
>> >>>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>>
>> >>>> >> >>>>
>> >>>> >> >>>> _______________________________________________
>> >>>> >> >>>> Scons-users mailing list
>> >>>> >> >>>> Scons-***@scons.org
>> >>>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>>
>> >>>> >> >>>
>> >>>> >> >>>
>> >>>> >> >>> _______________________________________________
>> >>>> >> >>> Scons-users mailing list
>> >>>> >> >>> Scons-***@scons.org
>> >>>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >> >>>
>> >>>> >> _______________________________________________
>> >>>> >> Scons-users mailing list
>> >>>> >> Scons-***@scons.org
>> >>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >
>> >>>> >
>> >>>> >
>> >>>> > _______________________________________________
>> >>>> > Scons-users mailing list
>> >>>> > Scons-***@scons.org
>> >>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>> >
>> >>>> _______________________________________________
>> >>>> Scons-users mailing list
>> >>>> Scons-***@scons.org
>> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Scons-users mailing list
>> >>> Scons-***@scons.org
>> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Scons-users mailing list
>> >>> Scons-***@scons.org
>> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>>
>> >>
>> >> _______________________________________________
>> >> Scons-users mailing list
>> >> Scons-***@scons.org
>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>
>> >>
>> >> _______________________________________________
>> >> Scons-users mailing list
>> >> Scons-***@scons.org
>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >>
>> >
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-***@scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Bill Deegan
2018-02-19 19:22:37 UTC
Permalink
In general we recommend using variant_dir in the SConscript call because it
is simpler.

I think you still didn't answer if your source tree was visible publically
(github,etc)

You may also want to take a look at Repository(). It could be useful if you
wanted a parallel tree which had the SConscripts in them, but none in your
normal kernel build tree.

Regardless, please still make a pull request for your default_imports.

Since this says "decide what variables are available inside the SConscript
with no control thereof in the SConscript itself" it may take some thought
about what else might be needed. You might want NoImport('env') to block
importing your specified default_imports.
And of course the docs (probably both the User Guide and the manpage)
should be updated. And some test.

-Bill


On Mon, Feb 19, 2018 at 1:16 PM, Hua Yanghao <***@gmail.com> wrote:

> Thanks Bill. Will give it a try.
>
> I see now after the VariantDir() call, in the script you can already
> assume the target source files are in that variant dir.
> I think I always got confused with this before and only actually made
> variant_dir using SConscript working.
>
> On Mon, Feb 19, 2018 at 6:20 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
> > Here's two ways which are similar to using variant_dir in a SConscript
> call.
> >
> > env.Program('some_build_dir/program', ['src/a.c','src/b.c'])
> > Assuming you have duplicate = 0
> >
> > Or you can specify the
> >
> > VariantDir('some_build_dir','src')
> > env.Program('some_build_dir/program', [os.path.join('some_build_dir',a)
> for
> > a in ['a.c','b.c'])
> >
> >
> > If you're doing a one time migration from some other build file to
> > sconscripts, then automate that and move forward from that.
> > If you're doing a "we'll always use the other build file" and then
> generate
> > sconscripts each time, I guess you can automate that like Spencer has.
> > Or you could create you own logic to read the other build file and make
> the
> > correct SCons calls to emulate the intent of the other build system.
> >
> > Such logic could be run every time as plain python logic, just make sure
> it
> > get's run before your first SConscript call.
> >
> > Manually converting and maintaining two build files next to each other
> for
> > two sets of developers just sounds like hell to me..
> >
> > Either way Import('env') is not going to be a nuisance because you'll
> have
> > scripted the bulk of the conversion/migration.
> >
> > -Bill
> >
> >
> >
> >
> > On Mon, Feb 19, 2018 at 11:10 AM, Hua Yanghao <***@gmail.com>
> wrote:
> >>
> >> Hi Bill,
> >> How do you handle variant_dir in this case, do you need the module to
> >> be built out of tree in a central place with other modules?
> >> Or were you able to provide a variant_dir=... also to all the builder
> >> that is used?
> >>
> >> Best Regards,
> >> Yanghao
> >>
> >> On Mon, Feb 19, 2018 at 4:42 PM, Bill Deegan <***@baddogconsulting.com
> >
> >> wrote:
> >> > Spencer,
> >> >
> >> > I worked on a similar build system a while back for a client.
> >> > My solution was SConstruct did the bulk of the work and no SConscripts
> >> > were
> >> > ever created.
> >> > The source stayed the clients home made file because they weren't
> >> > willing to
> >> > change.
> >> >
> >> > The logic walked the files figured out which builders needed to be
> >> > called
> >> > and which environment() variables needed to be set for each .ini file
> >> > and
> >> > then called them. It was actually fairly simple to implement and
> >> > maintain.
> >> >
> >> > -Bill
> >> >
> >> > On Sun, Feb 18, 2018 at 11:08 PM, Spencer Yost <***@triad.rr.com>
> >> > wrote:
> >> >>
> >> >> Right, our SConstruct walks the target, looking for the ini files.
> If
> >> >> it
> >> >> finds one, it passes them to the SConscript builder. The builder
> >> >> obviously
> >> >> creates an SConscript if the the ini file has changed. We then pass
> >> >> this
> >> >> SConscript to the SConscript() call.
> >> >>
> >> >> Again, our original build configuration files are sort of
> approximation
> >> >> an
> >> >> ini file - but not exact. The builder is actually several hundred
> lines
> >> >> of
> >> >> Python code. Because they are not exactly what the configparser
> module
> >> >> needs
> >> >> we have to create a temporary file that is the result of massaging
> and
> >> >> correcting the original and parse that temp file.
> >> >>
> >> >> PS: Don't get me wrong, we don't have this nailed down exactly yet.
> >> >> There
> >> >> are some deliverables what we are still working on. For example our
> >> >> config
> >> >> files deliver individual files that are contained within tar files.
> >> >> This
> >> >> seems to be opposite of what the Scons tarfile builder does(builds
> tar
> >> >> files
> >> >> from a collection of files). We have not cracked nut not yet.
> >> >>
> >> >> Spencer Yost
> >> >>
> >> >> On Feb 18, 2018, at 9:54 AM, Bill Deegan <***@baddogconsulting.com>
> >> >> wrote:
> >> >>
> >> >> Spencer,
> >> >>
> >> >> So your build info source are these .ini files?
> >> >> And your SConscript files just process them?
> >> >>
> >> >> -Bill
> >> >>
> >> >> On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com>
> >> >> wrote:
> >> >>>
> >> >>> Just as an offhand comment, that is sort of related to this. First,
> I
> >> >>> don't have to import a lot.
> >> >>>
> >> >>> We just converted our build system to SCons(~1600+ packages, ~15000
> >> >>> source files and tens of millions of lines of code). Because python
> >> >>> expertise ranges from completely lacking to extremely poor :-) in
> our
> >> >>> c/c++
> >> >>> staff; the powers that be indicated that developers will not
> maintain
> >> >>> SConscript files. They will maintain the original build
> configuration
> >> >>> files
> >> >>> that we had(something that approximates a win.ini file). That
> means I
> >> >>> have
> >> >>> to rebuild SConscript files for every original configuration file we
> >> >>> had.
> >> >>> Trying to figure out a way to programmatically consolidate them to
> >> >>> minimize
> >> >>> the number of SConscript files was nearly impossible. So we have
> about
> >> >>> 1600
> >> >>> SConscript files. Stuff like library dependencies vary between
> >> >>> "packages"
> >> >>> very frequently too. In addition the staff has to be able to build
> an
> >> >>> individual "package" or the whole tree. I have a builder that
> >> >>> creates the
> >> >>> SConscript file whenever this original build configuration file
> >> >>> changes. So
> >> >>> it's not a big deal. But consolidating them was just way too big of
> a
> >> >>> fish
> >> >>> to fry in the time and budget allowed.
> >> >>>
> >> >>> Sometimes you just have to have a bunch of them.
> >> >>>
> >> >>> PS: SCons is working great for us. Dependencies are much more
> robust,
> >> >>> speed is marginally better and the entire arc from source code
> change
> >> >>> to
> >> >>> Debian package creation is flawless. Being able to create command
> line
> >> >>> options has been a godsend for us. Previously we would have to
> create
> >> >>> build
> >> >>> macros to emulate what command line options do.
> >> >>>
> >> >>> Spencer Yost
> >> >>>
> >> >>> On Feb 17, 2018, at 6:17 PM, Bill Deegan <***@baddogconsulting.com
> >
> >> >>> wrote:
> >> >>>
> >> >>> Hua,
> >> >>>
> >> >>> From the tree you've shared, I'm going to guess you have way more
> >> >>> SConscripts than you need.
> >> >>>
> >> >>> For example, you're set of test directories could have a single
> >> >>> SConscript instead of one per.
> >> >>> Which no doubt are just a few lines each.
> >> >>>
> >> >>> In some cases it looks like you have a SConscript in a directory
> which
> >> >>> only has a header file (or none) and then a directory (or more) of
> >> >>> source
> >> >>> code. Skip the SConscript in the basically no-op directorie(s).
> >> >>>
> >> >>> Another suggestion, use variant dirs so you're not creating build
> >> >>> files
> >> >>> in your source directory.
> >> >>>
> >> >>> If you find yourself with a ton of very small SConscripts, it's a
> sign
> >> >>> that you may be doing something non-scons'ian.
> >> >>>
> >> >>> Of course it also depends on how working on each group of code is
> >> >>> split
> >> >>> up between different developers.
> >> >>>
> >> >>> There is some art in structuring your build system (and your code)
> >> >>> such
> >> >>> that engineers rarely end up causing merge conflicts with each
> other.
> >> >>>
> >> >>> I can see some value in default_import, but it would be something
> >> >>> requiring some debate on getting accepted.
> >> >>> As far as I can recall, your's is the first request for something
> like
> >> >>> this in the history of SCons (or at least as long as I've been
> >> >>> involved).
> >> >>>
> >> >>> Philosophically SCons is about being explicit in the build
> >> >>> requirements
> >> >>> and also about being correct by design. Yielding reproducible
> builds
> >> >>> regardless of the individual developers shell and machine setup.
> >> >>>
> >> >>>
> >> >>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com>
> >> >>> wrote:
> >> >>>>
> >> >>>> Hi Bill,
> >> >>>> I do not create a SConscript for every directory, only for directly
> >> >>>> which either provide a set of include file or having source code to
> >> >>>> build.
> >> >>>> I will try to create a minimal version of the build system to show
> >> >>>> the
> >> >>>> idea.
> >> >>>>
> >> >>>> Not sure if the below tree will give you some idea what I am trying
> >> >>>> to
> >> >>>> implement, at least you should be able to see where I am having a
> >> >>>> SConscript file.
> >> >>>> build/configs/riscv_example/riscv32-qemu-virt-main/
> >> >>>> ├── cmdlist.txt
> >> >>>> ├── config
> >> >>>> │ └── config.h
> >> >>>> ├── firmware
> >> >>>> │ ├── arch
> >> >>>> │ │ ├── include
> >> >>>> │ │ │ └── arch
> >> >>>> │ │ │ ├── cache.h
> >> >>>> │ │ │ ├── irq.h
> >> >>>> │ │ │ ├── misc.h
> >> >>>> │ │ │ ├── mmu.h
> >> >>>> │ │ │ ├── smp.h
> >> >>>> │ │ │ ├── spinlock.h
> >> >>>> │ │ │ └── timer.h
> >> >>>> │ │ ├── riscv
> >> >>>> │ │ │ ├── helper.c
> >> >>>> │ │ │ ├── helper.o
> >> >>>> │ │ │ ├── libdefault.o
> >> >>>> │ │ │ ├── main.c
> >> >>>> │ │ │ ├── main.o
> >> >>>> │ │ │ ├── SConscript
> >> >>>> │ │ │ ├── start.o
> >> >>>> │ │ │ └── start.S
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── weak.c
> >> >>>> │ │ └── weak.o
> >> >>>> │ ├── boards
> >> >>>> │ │ ├── include
> >> >>>> │ │ │ └── board.h
> >> >>>> │ │ ├── qemu-riscv32-virt
> >> >>>> │ │ │ ├── board.c
> >> >>>> │ │ │ ├── board.o
> >> >>>> │ │ │ ├── SConscript
> >> >>>> │ │ │ ├── uart16550_device.c
> >> >>>> │ │ │ └── uart16550_device.o
> >> >>>> │ │ └── SConscript
> >> >>>> │ ├── common
> >> >>>> │ │ ├── cpu.c
> >> >>>> │ │ ├── cpu.o
> >> >>>> │ │ ├── include
> >> >>>> │ │ │ └── common
> >> >>>> │ │ │ ├── common.h
> >> >>>> │ │ │ ├── cpu.h
> >> >>>> │ │ │ └── log.h
> >> >>>> │ │ ├── libdefault.o
> >> >>>> │ │ ├── log.c
> >> >>>> │ │ ├── log.o
> >> >>>> │ │ ├── main.c
> >> >>>> │ │ ├── main.o
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── weak.c
> >> >>>> │ │ └── weak.o
> >> >>>> │ ├── drivers
> >> >>>> │ │ └── uart16550
> >> >>>> │ │ ├── fd_ops.c
> >> >>>> │ │ ├── fd_ops.o
> >> >>>> │ │ ├── include
> >> >>>> │ │ │ ├── uart16550_api.h
> >> >>>> │ │ │ └── uart16550_device.h
> >> >>>> │ │ ├── libdefault.o
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── uart16550.c
> >> >>>> │ │ └── uart16550.o
> >> >>>> │ ├── include
> >> >>>> │ │ ├── bootstage.h
> >> >>>> │ │ ├── compiler.h
> >> >>>> │ │ ├── debug.h
> >> >>>> │ │ └── linux
> >> >>>> │ │ └── typecheck.h
> >> >>>> │ ├── lib
> >> >>>> │ │ ├── cmd
> >> >>>> │ │ │ ├── cmd.c
> >> >>>> │ │ │ ├── cmd.o
> >> >>>> │ │ │ ├── include
> >> >>>> │ │ │ │ └── cmd
> >> >>>> │ │ │ │ └── cmd.h
> >> >>>> │ │ │ ├── SConscript
> >> >>>> │ │ │ ├── test.c
> >> >>>> │ │ │ └── test.o
> >> >>>> │ │ ├── fio
> >> >>>> │ │ │ ├── cmd.c
> >> >>>> │ │ │ ├── cmd.o
> >> >>>> │ │ │ ├── include
> >> >>>> │ │ │ │ └── usw_device_public.h
> >> >>>> │ │ │ ├── libdefault.o
> >> >>>> │ │ │ ├── newlib.c
> >> >>>> │ │ │ ├── newlib.o
> >> >>>> │ │ │ ├── SConscript
> >> >>>> │ │ │ ├── usw_device.c
> >> >>>> │ │ │ ├── usw_device.o
> >> >>>> │ │ │ └── usw_device_private.h
> >> >>>> │ │ ├── pipe
> >> >>>> │ │ │ ├── include
> >> >>>> │ │ │ │ └── pipe
> >> >>>> │ │ │ │ ├── pipe.h
> >> >>>> │ │ │ │ └── status.h
> >> >>>> │ │ │ ├── libdefault.o
> >> >>>> │ │ │ ├── pipe.c
> >> >>>> │ │ │ ├── pipe.o
> >> >>>> │ │ │ └── SConscript
> >> >>>> │ │ └── simple_console
> >> >>>> │ │ ├── include
> >> >>>> │ │ │ └── simple_console.h
> >> >>>> │ │ ├── libdefault.o
> >> >>>> │ │ ├── print_color.h
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── simple_console.c
> >> >>>> │ │ └── simple_console.o
> >> >>>> │ ├── SConscript
> >> >>>> │ └── test
> >> >>>> │ ├── common
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── test.c
> >> >>>> │ │ └── test.o
> >> >>>> │ ├── console
> >> >>>> │ │ ├── hello.c
> >> >>>> │ │ ├── hello.o
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── test.c
> >> >>>> │ │ └── test.o
> >> >>>> │ ├── example
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── test.c
> >> >>>> │ │ └── test.o
> >> >>>> │ ├── libc
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── test.c
> >> >>>> │ │ └── test.o
> >> >>>> │ ├── linker
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── test.c
> >> >>>> │ │ └── test.o
> >> >>>> │ ├── log
> >> >>>> │ │ ├── SConscript
> >> >>>> │ │ ├── test.c
> >> >>>> │ │ └── test.o
> >> >>>> │ └── setjmp
> >> >>>> │ ├── SConscript
> >> >>>> │ ├── test2.c
> >> >>>> │ ├── test2.o
> >> >>>> │ ├── test.c
> >> >>>> │ └── test.o
> >> >>>> ├── libriscv_example.a
> >> >>>> ├── link.ld
> >> >>>> ├── riscv_example.bin
> >> >>>> ├── riscv_example.elf
> >> >>>> ├── riscv_example.ibi_bin
> >> >>>> ├── riscv_example.map
> >> >>>> └── riscv_example.S
> >> >>>>
> >> >>>> 36 directories, 113 files
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan
> >> >>>> <***@baddogconsulting.com> wrote:
> >> >>>> > Likely you don't need a SConscript for every directory in your
> >> >>>> > case?
> >> >>>> > Are you wrapping a complete linux build tree?
> >> >>>> >
> >> >>>> > Is this a build tree you can share for us to look at?
> >> >>>> >
> >> >>>> > -Bill
> >> >>>> >
> >> >>>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao <
> ***@gmail.com>
> >> >>>> > wrote:
> >> >>>> >>
> >> >>>> >> I see everything passed into
> >> >>>> >> env.SConscript(default_import=some_obj),
> >> >>>> >> if some_obj is a string it can pass through but if some_obj is a
> >> >>>> >> function object it end up as None in
> >> >>>> >> Script/SConscript.py/SConscript()
> >> >>>> >> function.
> >> >>>> >>
> >> >>>> >> I could have used a string and then import the right function
> >> >>>> >> however
> >> >>>> >> my function to be passed is a dynamically generated partial
> >> >>>> >> function
> >> >>>> >> ...
> >> >>>> >>
> >> >>>> >> Could anyone please give me some hint how could this be best
> >> >>>> >> implemented?
> >> >>>> >>
> >> >>>> >> Best Regards,
> >> >>>> >> Yanghao
> >> >>>> >>
> >> >>>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao
> >> >>>> >> <***@gmail.com>
> >> >>>> >> wrote:
> >> >>>> >> > @Bill, I have managed to hack the Frame class and the
> >> >>>> >> > BuildDefaultGlobals() function to have some thing imported
> into
> >> >>>> >> > SConscript by default.
> >> >>>> >> > However I don't quite understand when the "default_import"
> >> >>>> >> > keyword
> >> >>>> >> > argument passed down, somewhere somehow it end up as a set.
> >> >>>> >> >
> >> >>>> >> > Any documentation to explain what is going on from Base class
> >> >>>> >> > into
> >> >>>> >> > SConscript() calls regarding parameter handling?
> >> >>>> >> >
> >> >>>> >> > Thanks,
> >> >>>> >> > Yanghao
> >> >>>> >> >
> >> >>>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao
> >> >>>> >> > <***@gmail.com>
> >> >>>> >> > wrote:
> >> >>>> >> >> It varies a lot, ranging from 0 (yes, no source files at all)
> >> >>>> >> >> to a
> >> >>>> >> >> few
> >> >>>> >> >> dozen (didn't really count, see statistics below).
> >> >>>> >> >>
> >> >>>> >> >> Here is an example Linux kernel driver sub-module Makefile:
> >> >>>> >> >>
> >> >>>> >> >> linux/drivers/sn/Makefile:
> >> >>>> >> >> 1 #
> >> >>>> >> >> 2 # Makefile for the Altix device drivers.
> >> >>>> >> >> 3 #
> >> >>>> >> >> 4 #
> >> >>>> >> >> 5
> >> >>>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
> >> >>>> >> >>
> >> >>>> >> >> I want to replicate this kind of simplicity in scons.
> >> >>>> >> >>
> >> >>>> >> >> I actually have implemented almost the same thing in scons,
> but
> >> >>>> >> >> all
> >> >>>> >> >> those SConscript files have to start with Import("my_func")
> ...
> >> >>>> >> >> which
> >> >>>> >> >> is pretty annoying. I know I need it in every single
> >> >>>> >> >> SConscript,
> >> >>>> >> >> and I
> >> >>>> >> >> have to repeat it ... and this is so anti-pattern.
> >> >>>> >> >> I have get rid of the Return() part already, but getting rid
> of
> >> >>>> >> >> the
> >> >>>> >> >> Import() part seems not that straightforward.
> >> >>>> >> >>
> >> >>>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" |
> wc
> >> >>>> >> >> 121 121 5953
> >> >>>> >> >>
> >> >>>> >> >> At the moment the project supports 4 different CPU
> >> >>>> >> >> architectures,
> >> >>>> >> >> a
> >> >>>> >> >> little less than 1000 C files, 400K+ lines of code.
> >> >>>> >> >>
> >> >>>> >> >> And this is no small problem (at least for me). If I start
> >> >>>> >> >> working
> >> >>>> >> >> around it with too much python code, I might end up
> bypassing a
> >> >>>> >> >> significant portion of core scons and eventually might find
> it
> >> >>>> >> >> easier
> >> >>>> >> >> to just wrap around Makefiles.
> >> >>>> >> >>
> >> >>>> >> >> Someone thought I was criticizing scons, I actually love
> scons,
> >> >>>> >> >> but
> >> >>>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see me
> >> >>>> >> >> as
> >> >>>> >> >> an
> >> >>>> >> >> enemy I am a serious user of scons since 10 years ago when I
> >> >>>> >> >> was
> >> >>>> >> >> still
> >> >>>> >> >> in college.
> >> >>>> >> >>
> >> >>>> >> >> Best Regards,
> >> >>>> >> >> Yanghao
> >> >>>> >> >>
> >> >>>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
> >> >>>> >> >> <***@baddogconsulting.com> wrote:
> >> >>>> >> >>> How many source files per SConscript?
> >> >>>> >> >>> That's a lot of sconscripts.
> >> >>>> >> >>> Is this all one project?
> >> >>>> >> >>> Are all the SConscripts identical?
> >> >>>> >> >>>
> >> >>>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao
> >> >>>> >> >>> <***@gmail.com>
> >> >>>> >> >>> wrote:
> >> >>>> >> >>>>
> >> >>>> >> >>>> Actually I have one and only one import for hundreds of
> >> >>>> >> >>>> SConscript :)
> >> >>>> >> >>>>
> >> >>>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
> >> >>>> >> >>>> <***@gmail.com> wrote:
> >> >>>> >> >>>>>
> >> >>>> >> >>>>> Hua,
> >> >>>> >> >>>>>
> >> >>>> >> >>>>> If you are importing lots of variables into SConscripts,
> >> >>>> >> >>>>> then
> >> >>>> >> >>>>> you're
> >> >>>> >> >>>>> using SCons wrong. Most of your variables should probably
> be
> >> >>>> >> >>>>> construction
> >> >>>> >> >>>>> variables (in the environment).
> >> >>>> >> >>>>>
> >> >>>> >> >>>>> I've written many, many SConscripts and I've never used
> more
> >> >>>> >> >>>>> than 3
> >> >>>> >> >>>>> or 4
> >> >>>> >> >>>>> Import() statements in a single SConscript. Before you
> >> >>>> >> >>>>> critique
> >> >>>> >> >>>>> a
> >> >>>> >> >>>>> long-established framework, you might want to consider if
> >> >>>> >> >>>>> you're
> >> >>>> >> >>>>> using it
> >> >>>> >> >>>>> inappropriately.
> >> >>>> >> >>>>>
> >> >>>> >> >>>>> Jonathon
> >> >>>> >> >>>>>
> >> >>>> >> >>>>>
> >> >>>> >> >>>>>
> >> >>>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao
> >> >>>> >> >>>>> <***@gmail.com>
> >> >>>> >> >>>>> wrote:
> >> >>>> >> >>>>>>
> >> >>>> >> >>>>>> Will do. It is really not good if a particular framework
> >> >>>> >> >>>>>> force
> >> >>>> >> >>>>>> user
> >> >>>> >> >>>>>> to
> >> >>>> >> >>>>>> create repeated code. In comparison kbuild can easily
> >> >>>> >> >>>>>> create a
> >> >>>> >> >>>>>> one
> >> >>>> >> >>>>>> line make
> >> >>>> >> >>>>>> file for a module.
> >> >>>> >> >>>>>>
> >> >>>> >> >>>>>> I am using localized scons anyway if not accepted will
> just
> >> >>>> >> >>>>>> use it
> >> >>>> >> >>>>>> on my
> >> >>>> >> >>>>>> own.
> >> >>>> >> >>>>>>
> >> >>>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
> >> >>>> >> >>>>>> <***@baddogconsulting.com>
> >> >>>> >> >>>>>> wrote:
> >> >>>> >> >>>>>>>
> >> >>>> >> >>>>>>> Feel free to make a pull request, though I can't promise
> >> >>>> >> >>>>>>> that
> >> >>>> >> >>>>>>> it
> >> >>>> >> >>>>>>> will
> >> >>>> >> >>>>>>> be accepted.
> >> >>>> >> >>>>>>>
> >> >>>> >> >>>>>>> Is it really that much of an inconvenience?
> >> >>>> >> >>>>>>> -Bill
> >> >>>> >> >>>>>>>
> >> >>>> >> >>>>>>>
> >> >>>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
> >> >>>> >> >>>>>>> <***@gmail.com>
> >> >>>> >> >>>>>>> wrote:
> >> >>>> >> >>>>>>>>
> >> >>>> >> >>>>>>>> Hi Bill,
> >> >>>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
> >> >>>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
> >> >>>> >> >>>>>>>> For return I think I can abuse some global variables.
> >> >>>> >> >>>>>>>> This
> >> >>>> >> >>>>>>>> can
> >> >>>> >> >>>>>>>> really
> >> >>>> >> >>>>>>>> make the SConscript clean/minimal.
> >> >>>> >> >>>>>>>>
> >> >>>> >> >>>>>>>> Best Regards,
> >> >>>> >> >>>>>>>> Yanghao
> >> >>>> >> >>>>>>>>
> >> >>>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
> >> >>>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
> >> >>>> >> >>>>>>>> > No, there is no way without hacking the core code.
> >> >>>> >> >>>>>>>> >
> >> >>>> >> >>>>>>>> > It is the way it is by design.
> >> >>>> >> >>>>>>>> >
> >> >>>> >> >>>>>>>> > -Bill
> >> >>>> >> >>>>>>>> > SCons Project Co-Manager
> >> >>>> >> >>>>>>>> >
> >> >>>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
> >> >>>> >> >>>>>>>> > <***@gmail.com>
> >> >>>> >> >>>>>>>> > wrote:
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> Does anyone know in scons there are ways to
> implicitly
> >> >>>> >> >>>>>>>> >> make a
> >> >>>> >> >>>>>>>> >> object
> >> >>>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without
> explicity
> >> >>>> >> >>>>>>>> >> Import(xyz)?
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> Just want to eliminate the annoying repeated
> >> >>>> >> >>>>>>>> >> Import(xyz)
> >> >>>> >> >>>>>>>> >> in
> >> >>>> >> >>>>>>>> >> every
> >> >>>> >> >>>>>>>> >> single SConscript.
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz()
> returns a
> >> >>>> >> >>>>>>>> >> list of
> >> >>>> >> >>>>>>>> >> object,
> >> >>>> >> >>>>>>>> >> then in every SConscript if the top level SConstruct
> >> >>>> >> >>>>>>>> >> want
> >> >>>> >> >>>>>>>> >> to
> >> >>>> >> >>>>>>>> >> collect
> >> >>>> >> >>>>>>>> >> the complete list of object returned from every
> single
> >> >>>> >> >>>>>>>> >> SConscript.
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> For example:
> >> >>>> >> >>>>>>>> >> SConscript-1:
> >> >>>> >> >>>>>>>> >> Import("xyz")
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> ret = xyz(...)
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> Return("ret")
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> Would ideally become:
> >> >>>> >> >>>>>>>> >> SConscript-2:
> >> >>>> >> >>>>>>>> >> xyz(...)
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> Thanks,
> >> >>>> >> >>>>>>>> >> Yanghao
> >> >>>> >> >>>>>>>> >> _______________________________________________
> >> >>>> >> >>>>>>>> >> Scons-users mailing list
> >> >>>> >> >>>>>>>> >> Scons-***@scons.org
> >> >>>> >> >>>>>>>> >>
> >> >>>> >> >>>>>>>> >> https://pairlist4.pair.net/
> mailman/listinfo/scons-users
> >> >>>> >> >>>>>>>> >
> >> >>>> >> >>>>>>>> >
> >> >>>> >> >>>>>>>> >
> >> >>>> >> >>>>>>>> > _______________________________________________
> >> >>>> >> >>>>>>>> > Scons-users mailing list
> >> >>>> >> >>>>>>>> > Scons-***@scons.org
> >> >>>> >> >>>>>>>> > https://pairlist4.pair.net/
> mailman/listinfo/scons-users
> >> >>>> >> >>>>>>>> >
> >> >>>> >> >>>>>>>> _______________________________________________
> >> >>>> >> >>>>>>>> Scons-users mailing list
> >> >>>> >> >>>>>>>> Scons-***@scons.org
> >> >>>> >> >>>>>>>> https://pairlist4.pair.net/
> mailman/listinfo/scons-users
> >> >>>> >> >>>>>>>
> >> >>>> >> >>>>>>>
> >> >>>> >> >>>>>>> _______________________________________________
> >> >>>> >> >>>>>>> Scons-users mailing list
> >> >>>> >> >>>>>>> Scons-***@scons.org
> >> >>>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>> >> >>>>>>
> >> >>>> >> >>>>>>
> >> >>>> >> >>>>>> _______________________________________________
> >> >>>> >> >>>>>> Scons-users mailing list
> >> >>>> >> >>>>>> Scons-***@scons.org
> >> >>>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>> >> >>>>>>
> >> >>>> >> >>>>>
> >> >>>> >> >>>>> _______________________________________________
> >> >>>> >> >>>>> Scons-users mailing list
> >> >>>> >> >>>>> Scons-***@scons.org
> >> >>>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>> >> >>>>
> >> >>>> >> >>>>
> >> >>>> >> >>>> _______________________________________________
> >> >>>> >> >>>> Scons-users mailing list
> >> >>>> >> >>>> Scons-***@scons.org
> >> >>>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>> >> >>>>
> >> >>>> >> >>>
> >> >>>> >> >>>
> >> >>>> >> >>> _______________________________________________
> >> >>>> >> >>> Scons-users mailing list
> >> >>>> >> >>> Scons-***@scons.org
> >> >>>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>> >> >>>
> >> >>>> >> _______________________________________________
> >> >>>> >> Scons-users mailing list
> >> >>>> >> Scons-***@scons.org
> >> >>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>> >
> >> >>>> >
> >> >>>> >
> >> >>>> > _______________________________________________
> >> >>>> > Scons-users mailing list
> >> >>>> > Scons-***@scons.org
> >> >>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>> >
> >> >>>> _______________________________________________
> >> >>>> Scons-users mailing list
> >> >>>> Scons-***@scons.org
> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>
> >> >>>
> >> >>> _______________________________________________
> >> >>> Scons-users mailing list
> >> >>> Scons-***@scons.org
> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>
> >> >>>
> >> >>> _______________________________________________
> >> >>> Scons-users mailing list
> >> >>> Scons-***@scons.org
> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>>
> >> >>
> >> >> _______________________________________________
> >> >> Scons-users mailing list
> >> >> Scons-***@scons.org
> >> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>
> >> >>
> >> >> _______________________________________________
> >> >> Scons-users mailing list
> >> >> Scons-***@scons.org
> >> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >>
> >> >
> >> >
> >> > _______________________________________________
> >> > Scons-users mailing list
> >> > Scons-***@scons.org
> >> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >> >
> >> _______________________________________________
> >> Scons-users mailing list
> >> Scons-***@scons.org
> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Hua Yanghao
2018-02-20 08:29:31 UTC
Permalink
Hi Bill,
Unfortunately my source tree cannot be made public for now. I am
trying to get the core of it public in several month from now ...

The thing is, in SConscript there are already quite a few object made
available by default: Import, Return, ...
The best way would be change that static list into a dynamic one. I
always believe a good design should provide mechanism, not policy. and
in this case the mechanism is "make some object available in
SConscript", and the policy is "which one should be there". The policy
part is better left for the user/application to decide. I will try to
see how far I can go and keep you posted and let's debate again once I
got some patch available.

Best Regards,
Yanghao

On Mon, Feb 19, 2018 at 8:22 PM, Bill Deegan <***@baddogconsulting.com> wrote:
> In general we recommend using variant_dir in the SConscript call because it
> is simpler.
>
> I think you still didn't answer if your source tree was visible publically
> (github,etc)
>
> You may also want to take a look at Repository(). It could be useful if you
> wanted a parallel tree which had the SConscripts in them, but none in your
> normal kernel build tree.
>
> Regardless, please still make a pull request for your default_imports.
>
> Since this says "decide what variables are available inside the SConscript
> with no control thereof in the SConscript itself" it may take some thought
> about what else might be needed. You might want NoImport('env') to block
> importing your specified default_imports.
> And of course the docs (probably both the User Guide and the manpage) should
> be updated. And some test.
>
> -Bill
>
>
> On Mon, Feb 19, 2018 at 1:16 PM, Hua Yanghao <***@gmail.com> wrote:
>>
>> Thanks Bill. Will give it a try.
>>
>> I see now after the VariantDir() call, in the script you can already
>> assume the target source files are in that variant dir.
>> I think I always got confused with this before and only actually made
>> variant_dir using SConscript working.
>>
>> On Mon, Feb 19, 2018 at 6:20 PM, Bill Deegan <***@baddogconsulting.com>
>> wrote:
>> > Here's two ways which are similar to using variant_dir in a SConscript
>> > call.
>> >
>> > env.Program('some_build_dir/program', ['src/a.c','src/b.c'])
>> > Assuming you have duplicate = 0
>> >
>> > Or you can specify the
>> >
>> > VariantDir('some_build_dir','src')
>> > env.Program('some_build_dir/program', [os.path.join('some_build_dir',a)
>> > for
>> > a in ['a.c','b.c'])
>> >
>> >
>> > If you're doing a one time migration from some other build file to
>> > sconscripts, then automate that and move forward from that.
>> > If you're doing a "we'll always use the other build file" and then
>> > generate
>> > sconscripts each time, I guess you can automate that like Spencer has.
>> > Or you could create you own logic to read the other build file and make
>> > the
>> > correct SCons calls to emulate the intent of the other build system.
>> >
>> > Such logic could be run every time as plain python logic, just make sure
>> > it
>> > get's run before your first SConscript call.
>> >
>> > Manually converting and maintaining two build files next to each other
>> > for
>> > two sets of developers just sounds like hell to me..
>> >
>> > Either way Import('env') is not going to be a nuisance because you'll
>> > have
>> > scripted the bulk of the conversion/migration.
>> >
>> > -Bill
>> >
>> >
>> >
>> >
>> > On Mon, Feb 19, 2018 at 11:10 AM, Hua Yanghao <***@gmail.com>
>> > wrote:
>> >>
>> >> Hi Bill,
>> >> How do you handle variant_dir in this case, do you need the module to
>> >> be built out of tree in a central place with other modules?
>> >> Or were you able to provide a variant_dir=... also to all the builder
>> >> that is used?
>> >>
>> >> Best Regards,
>> >> Yanghao
>> >>
>> >> On Mon, Feb 19, 2018 at 4:42 PM, Bill Deegan
>> >> <***@baddogconsulting.com>
>> >> wrote:
>> >> > Spencer,
>> >> >
>> >> > I worked on a similar build system a while back for a client.
>> >> > My solution was SConstruct did the bulk of the work and no
>> >> > SConscripts
>> >> > were
>> >> > ever created.
>> >> > The source stayed the clients home made file because they weren't
>> >> > willing to
>> >> > change.
>> >> >
>> >> > The logic walked the files figured out which builders needed to be
>> >> > called
>> >> > and which environment() variables needed to be set for each .ini file
>> >> > and
>> >> > then called them. It was actually fairly simple to implement and
>> >> > maintain.
>> >> >
>> >> > -Bill
>> >> >
>> >> > On Sun, Feb 18, 2018 at 11:08 PM, Spencer Yost <***@triad.rr.com>
>> >> > wrote:
>> >> >>
>> >> >> Right, our SConstruct walks the target, looking for the ini files.
>> >> >> If
>> >> >> it
>> >> >> finds one, it passes them to the SConscript builder. The builder
>> >> >> obviously
>> >> >> creates an SConscript if the the ini file has changed. We then pass
>> >> >> this
>> >> >> SConscript to the SConscript() call.
>> >> >>
>> >> >> Again, our original build configuration files are sort of
>> >> >> approximation
>> >> >> an
>> >> >> ini file - but not exact. The builder is actually several hundred
>> >> >> lines
>> >> >> of
>> >> >> Python code. Because they are not exactly what the configparser
>> >> >> module
>> >> >> needs
>> >> >> we have to create a temporary file that is the result of massaging
>> >> >> and
>> >> >> correcting the original and parse that temp file.
>> >> >>
>> >> >> PS: Don't get me wrong, we don't have this nailed down exactly yet.
>> >> >> There
>> >> >> are some deliverables what we are still working on. For example our
>> >> >> config
>> >> >> files deliver individual files that are contained within tar files.
>> >> >> This
>> >> >> seems to be opposite of what the Scons tarfile builder does(builds
>> >> >> tar
>> >> >> files
>> >> >> from a collection of files). We have not cracked nut not yet.
>> >> >>
>> >> >> Spencer Yost
>> >> >>
>> >> >> On Feb 18, 2018, at 9:54 AM, Bill Deegan <***@baddogconsulting.com>
>> >> >> wrote:
>> >> >>
>> >> >> Spencer,
>> >> >>
>> >> >> So your build info source are these .ini files?
>> >> >> And your SConscript files just process them?
>> >> >>
>> >> >> -Bill
>> >> >>
>> >> >> On Sat, Feb 17, 2018 at 10:54 PM, Spencer Yost <***@triad.rr.com>
>> >> >> wrote:
>> >> >>>
>> >> >>> Just as an offhand comment, that is sort of related to this. First,
>> >> >>> I
>> >> >>> don't have to import a lot.
>> >> >>>
>> >> >>> We just converted our build system to SCons(~1600+ packages, ~15000
>> >> >>> source files and tens of millions of lines of code). Because python
>> >> >>> expertise ranges from completely lacking to extremely poor :-) in
>> >> >>> our
>> >> >>> c/c++
>> >> >>> staff; the powers that be indicated that developers will not
>> >> >>> maintain
>> >> >>> SConscript files. They will maintain the original build
>> >> >>> configuration
>> >> >>> files
>> >> >>> that we had(something that approximates a win.ini file). That
>> >> >>> means I
>> >> >>> have
>> >> >>> to rebuild SConscript files for every original configuration file
>> >> >>> we
>> >> >>> had.
>> >> >>> Trying to figure out a way to programmatically consolidate them to
>> >> >>> minimize
>> >> >>> the number of SConscript files was nearly impossible. So we have
>> >> >>> about
>> >> >>> 1600
>> >> >>> SConscript files. Stuff like library dependencies vary between
>> >> >>> "packages"
>> >> >>> very frequently too. In addition the staff has to be able to build
>> >> >>> an
>> >> >>> individual "package" or the whole tree. I have a builder that
>> >> >>> creates the
>> >> >>> SConscript file whenever this original build configuration file
>> >> >>> changes. So
>> >> >>> it's not a big deal. But consolidating them was just way too big of
>> >> >>> a
>> >> >>> fish
>> >> >>> to fry in the time and budget allowed.
>> >> >>>
>> >> >>> Sometimes you just have to have a bunch of them.
>> >> >>>
>> >> >>> PS: SCons is working great for us. Dependencies are much more
>> >> >>> robust,
>> >> >>> speed is marginally better and the entire arc from source code
>> >> >>> change
>> >> >>> to
>> >> >>> Debian package creation is flawless. Being able to create command
>> >> >>> line
>> >> >>> options has been a godsend for us. Previously we would have to
>> >> >>> create
>> >> >>> build
>> >> >>> macros to emulate what command line options do.
>> >> >>>
>> >> >>> Spencer Yost
>> >> >>>
>> >> >>> On Feb 17, 2018, at 6:17 PM, Bill Deegan
>> >> >>> <***@baddogconsulting.com>
>> >> >>> wrote:
>> >> >>>
>> >> >>> Hua,
>> >> >>>
>> >> >>> From the tree you've shared, I'm going to guess you have way more
>> >> >>> SConscripts than you need.
>> >> >>>
>> >> >>> For example, you're set of test directories could have a single
>> >> >>> SConscript instead of one per.
>> >> >>> Which no doubt are just a few lines each.
>> >> >>>
>> >> >>> In some cases it looks like you have a SConscript in a directory
>> >> >>> which
>> >> >>> only has a header file (or none) and then a directory (or more) of
>> >> >>> source
>> >> >>> code. Skip the SConscript in the basically no-op directorie(s).
>> >> >>>
>> >> >>> Another suggestion, use variant dirs so you're not creating build
>> >> >>> files
>> >> >>> in your source directory.
>> >> >>>
>> >> >>> If you find yourself with a ton of very small SConscripts, it's a
>> >> >>> sign
>> >> >>> that you may be doing something non-scons'ian.
>> >> >>>
>> >> >>> Of course it also depends on how working on each group of code is
>> >> >>> split
>> >> >>> up between different developers.
>> >> >>>
>> >> >>> There is some art in structuring your build system (and your code)
>> >> >>> such
>> >> >>> that engineers rarely end up causing merge conflicts with each
>> >> >>> other.
>> >> >>>
>> >> >>> I can see some value in default_import, but it would be something
>> >> >>> requiring some debate on getting accepted.
>> >> >>> As far as I can recall, your's is the first request for something
>> >> >>> like
>> >> >>> this in the history of SCons (or at least as long as I've been
>> >> >>> involved).
>> >> >>>
>> >> >>> Philosophically SCons is about being explicit in the build
>> >> >>> requirements
>> >> >>> and also about being correct by design. Yielding reproducible
>> >> >>> builds
>> >> >>> regardless of the individual developers shell and machine setup.
>> >> >>>
>> >> >>>
>> >> >>> On Sat, Feb 17, 2018 at 5:31 PM, Hua Yanghao <***@gmail.com>
>> >> >>> wrote:
>> >> >>>>
>> >> >>>> Hi Bill,
>> >> >>>> I do not create a SConscript for every directory, only for
>> >> >>>> directly
>> >> >>>> which either provide a set of include file or having source code
>> >> >>>> to
>> >> >>>> build.
>> >> >>>> I will try to create a minimal version of the build system to show
>> >> >>>> the
>> >> >>>> idea.
>> >> >>>>
>> >> >>>> Not sure if the below tree will give you some idea what I am
>> >> >>>> trying
>> >> >>>> to
>> >> >>>> implement, at least you should be able to see where I am having a
>> >> >>>> SConscript file.
>> >> >>>> build/configs/riscv_example/riscv32-qemu-virt-main/
>> >> >>>> ├── cmdlist.txt
>> >> >>>> ├── config
>> >> >>>> │ └── config.h
>> >> >>>> ├── firmware
>> >> >>>> │ ├── arch
>> >> >>>> │ │ ├── include
>> >> >>>> │ │ │ └── arch
>> >> >>>> │ │ │ ├── cache.h
>> >> >>>> │ │ │ ├── irq.h
>> >> >>>> │ │ │ ├── misc.h
>> >> >>>> │ │ │ ├── mmu.h
>> >> >>>> │ │ │ ├── smp.h
>> >> >>>> │ │ │ ├── spinlock.h
>> >> >>>> │ │ │ └── timer.h
>> >> >>>> │ │ ├── riscv
>> >> >>>> │ │ │ ├── helper.c
>> >> >>>> │ │ │ ├── helper.o
>> >> >>>> │ │ │ ├── libdefault.o
>> >> >>>> │ │ │ ├── main.c
>> >> >>>> │ │ │ ├── main.o
>> >> >>>> │ │ │ ├── SConscript
>> >> >>>> │ │ │ ├── start.o
>> >> >>>> │ │ │ └── start.S
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── weak.c
>> >> >>>> │ │ └── weak.o
>> >> >>>> │ ├── boards
>> >> >>>> │ │ ├── include
>> >> >>>> │ │ │ └── board.h
>> >> >>>> │ │ ├── qemu-riscv32-virt
>> >> >>>> │ │ │ ├── board.c
>> >> >>>> │ │ │ ├── board.o
>> >> >>>> │ │ │ ├── SConscript
>> >> >>>> │ │ │ ├── uart16550_device.c
>> >> >>>> │ │ │ └── uart16550_device.o
>> >> >>>> │ │ └── SConscript
>> >> >>>> │ ├── common
>> >> >>>> │ │ ├── cpu.c
>> >> >>>> │ │ ├── cpu.o
>> >> >>>> │ │ ├── include
>> >> >>>> │ │ │ └── common
>> >> >>>> │ │ │ ├── common.h
>> >> >>>> │ │ │ ├── cpu.h
>> >> >>>> │ │ │ └── log.h
>> >> >>>> │ │ ├── libdefault.o
>> >> >>>> │ │ ├── log.c
>> >> >>>> │ │ ├── log.o
>> >> >>>> │ │ ├── main.c
>> >> >>>> │ │ ├── main.o
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── weak.c
>> >> >>>> │ │ └── weak.o
>> >> >>>> │ ├── drivers
>> >> >>>> │ │ └── uart16550
>> >> >>>> │ │ ├── fd_ops.c
>> >> >>>> │ │ ├── fd_ops.o
>> >> >>>> │ │ ├── include
>> >> >>>> │ │ │ ├── uart16550_api.h
>> >> >>>> │ │ │ └── uart16550_device.h
>> >> >>>> │ │ ├── libdefault.o
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── uart16550.c
>> >> >>>> │ │ └── uart16550.o
>> >> >>>> │ ├── include
>> >> >>>> │ │ ├── bootstage.h
>> >> >>>> │ │ ├── compiler.h
>> >> >>>> │ │ ├── debug.h
>> >> >>>> │ │ └── linux
>> >> >>>> │ │ └── typecheck.h
>> >> >>>> │ ├── lib
>> >> >>>> │ │ ├── cmd
>> >> >>>> │ │ │ ├── cmd.c
>> >> >>>> │ │ │ ├── cmd.o
>> >> >>>> │ │ │ ├── include
>> >> >>>> │ │ │ │ └── cmd
>> >> >>>> │ │ │ │ └── cmd.h
>> >> >>>> │ │ │ ├── SConscript
>> >> >>>> │ │ │ ├── test.c
>> >> >>>> │ │ │ └── test.o
>> >> >>>> │ │ ├── fio
>> >> >>>> │ │ │ ├── cmd.c
>> >> >>>> │ │ │ ├── cmd.o
>> >> >>>> │ │ │ ├── include
>> >> >>>> │ │ │ │ └── usw_device_public.h
>> >> >>>> │ │ │ ├── libdefault.o
>> >> >>>> │ │ │ ├── newlib.c
>> >> >>>> │ │ │ ├── newlib.o
>> >> >>>> │ │ │ ├── SConscript
>> >> >>>> │ │ │ ├── usw_device.c
>> >> >>>> │ │ │ ├── usw_device.o
>> >> >>>> │ │ │ └── usw_device_private.h
>> >> >>>> │ │ ├── pipe
>> >> >>>> │ │ │ ├── include
>> >> >>>> │ │ │ │ └── pipe
>> >> >>>> │ │ │ │ ├── pipe.h
>> >> >>>> │ │ │ │ └── status.h
>> >> >>>> │ │ │ ├── libdefault.o
>> >> >>>> │ │ │ ├── pipe.c
>> >> >>>> │ │ │ ├── pipe.o
>> >> >>>> │ │ │ └── SConscript
>> >> >>>> │ │ └── simple_console
>> >> >>>> │ │ ├── include
>> >> >>>> │ │ │ └── simple_console.h
>> >> >>>> │ │ ├── libdefault.o
>> >> >>>> │ │ ├── print_color.h
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── simple_console.c
>> >> >>>> │ │ └── simple_console.o
>> >> >>>> │ ├── SConscript
>> >> >>>> │ └── test
>> >> >>>> │ ├── common
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── test.c
>> >> >>>> │ │ └── test.o
>> >> >>>> │ ├── console
>> >> >>>> │ │ ├── hello.c
>> >> >>>> │ │ ├── hello.o
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── test.c
>> >> >>>> │ │ └── test.o
>> >> >>>> │ ├── example
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── test.c
>> >> >>>> │ │ └── test.o
>> >> >>>> │ ├── libc
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── test.c
>> >> >>>> │ │ └── test.o
>> >> >>>> │ ├── linker
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── test.c
>> >> >>>> │ │ └── test.o
>> >> >>>> │ ├── log
>> >> >>>> │ │ ├── SConscript
>> >> >>>> │ │ ├── test.c
>> >> >>>> │ │ └── test.o
>> >> >>>> │ └── setjmp
>> >> >>>> │ ├── SConscript
>> >> >>>> │ ├── test2.c
>> >> >>>> │ ├── test2.o
>> >> >>>> │ ├── test.c
>> >> >>>> │ └── test.o
>> >> >>>> ├── libriscv_example.a
>> >> >>>> ├── link.ld
>> >> >>>> ├── riscv_example.bin
>> >> >>>> ├── riscv_example.elf
>> >> >>>> ├── riscv_example.ibi_bin
>> >> >>>> ├── riscv_example.map
>> >> >>>> └── riscv_example.S
>> >> >>>>
>> >> >>>> 36 directories, 113 files
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> On Sat, Feb 17, 2018 at 10:15 PM, Bill Deegan
>> >> >>>> <***@baddogconsulting.com> wrote:
>> >> >>>> > Likely you don't need a SConscript for every directory in your
>> >> >>>> > case?
>> >> >>>> > Are you wrapping a complete linux build tree?
>> >> >>>> >
>> >> >>>> > Is this a build tree you can share for us to look at?
>> >> >>>> >
>> >> >>>> > -Bill
>> >> >>>> >
>> >> >>>> > On Sat, Feb 17, 2018 at 3:30 PM, Hua Yanghao
>> >> >>>> > <***@gmail.com>
>> >> >>>> > wrote:
>> >> >>>> >>
>> >> >>>> >> I see everything passed into
>> >> >>>> >> env.SConscript(default_import=some_obj),
>> >> >>>> >> if some_obj is a string it can pass through but if some_obj is
>> >> >>>> >> a
>> >> >>>> >> function object it end up as None in
>> >> >>>> >> Script/SConscript.py/SConscript()
>> >> >>>> >> function.
>> >> >>>> >>
>> >> >>>> >> I could have used a string and then import the right function
>> >> >>>> >> however
>> >> >>>> >> my function to be passed is a dynamically generated partial
>> >> >>>> >> function
>> >> >>>> >> ...
>> >> >>>> >>
>> >> >>>> >> Could anyone please give me some hint how could this be best
>> >> >>>> >> implemented?
>> >> >>>> >>
>> >> >>>> >> Best Regards,
>> >> >>>> >> Yanghao
>> >> >>>> >>
>> >> >>>> >> On Sat, Feb 17, 2018 at 7:53 PM, Hua Yanghao
>> >> >>>> >> <***@gmail.com>
>> >> >>>> >> wrote:
>> >> >>>> >> > @Bill, I have managed to hack the Frame class and the
>> >> >>>> >> > BuildDefaultGlobals() function to have some thing imported
>> >> >>>> >> > into
>> >> >>>> >> > SConscript by default.
>> >> >>>> >> > However I don't quite understand when the "default_import"
>> >> >>>> >> > keyword
>> >> >>>> >> > argument passed down, somewhere somehow it end up as a set.
>> >> >>>> >> >
>> >> >>>> >> > Any documentation to explain what is going on from Base class
>> >> >>>> >> > into
>> >> >>>> >> > SConscript() calls regarding parameter handling?
>> >> >>>> >> >
>> >> >>>> >> > Thanks,
>> >> >>>> >> > Yanghao
>> >> >>>> >> >
>> >> >>>> >> > On Sat, Feb 17, 2018 at 7:45 PM, Hua Yanghao
>> >> >>>> >> > <***@gmail.com>
>> >> >>>> >> > wrote:
>> >> >>>> >> >> It varies a lot, ranging from 0 (yes, no source files at
>> >> >>>> >> >> all)
>> >> >>>> >> >> to a
>> >> >>>> >> >> few
>> >> >>>> >> >> dozen (didn't really count, see statistics below).
>> >> >>>> >> >>
>> >> >>>> >> >> Here is an example Linux kernel driver sub-module Makefile:
>> >> >>>> >> >>
>> >> >>>> >> >> linux/drivers/sn/Makefile:
>> >> >>>> >> >> 1 #
>> >> >>>> >> >> 2 # Makefile for the Altix device drivers.
>> >> >>>> >> >> 3 #
>> >> >>>> >> >> 4 #
>> >> >>>> >> >> 5
>> >> >>>> >> >> 6 obj-$(CONFIG_SGI_IOC3) += ioc3.o
>> >> >>>> >> >>
>> >> >>>> >> >> I want to replicate this kind of simplicity in scons.
>> >> >>>> >> >>
>> >> >>>> >> >> I actually have implemented almost the same thing in scons,
>> >> >>>> >> >> but
>> >> >>>> >> >> all
>> >> >>>> >> >> those SConscript files have to start with Import("my_func")
>> >> >>>> >> >> ...
>> >> >>>> >> >> which
>> >> >>>> >> >> is pretty annoying. I know I need it in every single
>> >> >>>> >> >> SConscript,
>> >> >>>> >> >> and I
>> >> >>>> >> >> have to repeat it ... and this is so anti-pattern.
>> >> >>>> >> >> I have get rid of the Return() part already, but getting rid
>> >> >>>> >> >> of
>> >> >>>> >> >> the
>> >> >>>> >> >> Import() part seems not that straightforward.
>> >> >>>> >> >>
>> >> >>>> >> >> ***@huyangha-mobl:~/git/usw $ find . -iname "SConscript" |
>> >> >>>> >> >> wc
>> >> >>>> >> >> 121 121 5953
>> >> >>>> >> >>
>> >> >>>> >> >> At the moment the project supports 4 different CPU
>> >> >>>> >> >> architectures,
>> >> >>>> >> >> a
>> >> >>>> >> >> little less than 1000 C files, 400K+ lines of code.
>> >> >>>> >> >>
>> >> >>>> >> >> And this is no small problem (at least for me). If I start
>> >> >>>> >> >> working
>> >> >>>> >> >> around it with too much python code, I might end up
>> >> >>>> >> >> bypassing a
>> >> >>>> >> >> significant portion of core scons and eventually might find
>> >> >>>> >> >> it
>> >> >>>> >> >> easier
>> >> >>>> >> >> to just wrap around Makefiles.
>> >> >>>> >> >>
>> >> >>>> >> >> Someone thought I was criticizing scons, I actually love
>> >> >>>> >> >> scons,
>> >> >>>> >> >> but
>> >> >>>> >> >> that doesn't stop me criticizing scons. ;-) Just don't see
>> >> >>>> >> >> me
>> >> >>>> >> >> as
>> >> >>>> >> >> an
>> >> >>>> >> >> enemy I am a serious user of scons since 10 years ago when I
>> >> >>>> >> >> was
>> >> >>>> >> >> still
>> >> >>>> >> >> in college.
>> >> >>>> >> >>
>> >> >>>> >> >> Best Regards,
>> >> >>>> >> >> Yanghao
>> >> >>>> >> >>
>> >> >>>> >> >> On Sat, Feb 17, 2018 at 4:46 PM, Bill Deegan
>> >> >>>> >> >> <***@baddogconsulting.com> wrote:
>> >> >>>> >> >>> How many source files per SConscript?
>> >> >>>> >> >>> That's a lot of sconscripts.
>> >> >>>> >> >>> Is this all one project?
>> >> >>>> >> >>> Are all the SConscripts identical?
>> >> >>>> >> >>>
>> >> >>>> >> >>> On Sat, Feb 17, 2018 at 3:05 AM, Hua Yanghao
>> >> >>>> >> >>> <***@gmail.com>
>> >> >>>> >> >>> wrote:
>> >> >>>> >> >>>>
>> >> >>>> >> >>>> Actually I have one and only one import for hundreds of
>> >> >>>> >> >>>> SConscript :)
>> >> >>>> >> >>>>
>> >> >>>> >> >>>> On Sat, Feb 17, 2018 at 01:19 Jonathon Reinhart
>> >> >>>> >> >>>> <***@gmail.com> wrote:
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>> Hua,
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>> If you are importing lots of variables into SConscripts,
>> >> >>>> >> >>>>> then
>> >> >>>> >> >>>>> you're
>> >> >>>> >> >>>>> using SCons wrong. Most of your variables should probably
>> >> >>>> >> >>>>> be
>> >> >>>> >> >>>>> construction
>> >> >>>> >> >>>>> variables (in the environment).
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>> I've written many, many SConscripts and I've never used
>> >> >>>> >> >>>>> more
>> >> >>>> >> >>>>> than 3
>> >> >>>> >> >>>>> or 4
>> >> >>>> >> >>>>> Import() statements in a single SConscript. Before you
>> >> >>>> >> >>>>> critique
>> >> >>>> >> >>>>> a
>> >> >>>> >> >>>>> long-established framework, you might want to consider if
>> >> >>>> >> >>>>> you're
>> >> >>>> >> >>>>> using it
>> >> >>>> >> >>>>> inappropriately.
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>> Jonathon
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>> On Fri, Feb 16, 2018 at 6:02 PM, Hua Yanghao
>> >> >>>> >> >>>>> <***@gmail.com>
>> >> >>>> >> >>>>> wrote:
>> >> >>>> >> >>>>>>
>> >> >>>> >> >>>>>> Will do. It is really not good if a particular framework
>> >> >>>> >> >>>>>> force
>> >> >>>> >> >>>>>> user
>> >> >>>> >> >>>>>> to
>> >> >>>> >> >>>>>> create repeated code. In comparison kbuild can easily
>> >> >>>> >> >>>>>> create a
>> >> >>>> >> >>>>>> one
>> >> >>>> >> >>>>>> line make
>> >> >>>> >> >>>>>> file for a module.
>> >> >>>> >> >>>>>>
>> >> >>>> >> >>>>>> I am using localized scons anyway if not accepted will
>> >> >>>> >> >>>>>> just
>> >> >>>> >> >>>>>> use it
>> >> >>>> >> >>>>>> on my
>> >> >>>> >> >>>>>> own.
>> >> >>>> >> >>>>>>
>> >> >>>> >> >>>>>> On Fri, Feb 16, 2018 at 22:46 Bill Deegan
>> >> >>>> >> >>>>>> <***@baddogconsulting.com>
>> >> >>>> >> >>>>>> wrote:
>> >> >>>> >> >>>>>>>
>> >> >>>> >> >>>>>>> Feel free to make a pull request, though I can't
>> >> >>>> >> >>>>>>> promise
>> >> >>>> >> >>>>>>> that
>> >> >>>> >> >>>>>>> it
>> >> >>>> >> >>>>>>> will
>> >> >>>> >> >>>>>>> be accepted.
>> >> >>>> >> >>>>>>>
>> >> >>>> >> >>>>>>> Is it really that much of an inconvenience?
>> >> >>>> >> >>>>>>> -Bill
>> >> >>>> >> >>>>>>>
>> >> >>>> >> >>>>>>>
>> >> >>>> >> >>>>>>> On Fri, Feb 16, 2018 at 3:20 PM, Hua Yanghao
>> >> >>>> >> >>>>>>> <***@gmail.com>
>> >> >>>> >> >>>>>>> wrote:
>> >> >>>> >> >>>>>>>>
>> >> >>>> >> >>>>>>>> Hi Bill,
>> >> >>>> >> >>>>>>>> Do you think if it is useful to add a new keyword for
>> >> >>>> >> >>>>>>>> env.SConscript(default_imports=[xyz,abc,...])?
>> >> >>>> >> >>>>>>>> For return I think I can abuse some global variables.
>> >> >>>> >> >>>>>>>> This
>> >> >>>> >> >>>>>>>> can
>> >> >>>> >> >>>>>>>> really
>> >> >>>> >> >>>>>>>> make the SConscript clean/minimal.
>> >> >>>> >> >>>>>>>>
>> >> >>>> >> >>>>>>>> Best Regards,
>> >> >>>> >> >>>>>>>> Yanghao
>> >> >>>> >> >>>>>>>>
>> >> >>>> >> >>>>>>>> On Fri, Feb 16, 2018 at 9:09 PM, Bill Deegan
>> >> >>>> >> >>>>>>>> <***@baddogconsulting.com> wrote:
>> >> >>>> >> >>>>>>>> > No, there is no way without hacking the core code.
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> > It is the way it is by design.
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> > -Bill
>> >> >>>> >> >>>>>>>> > SCons Project Co-Manager
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> > On Fri, Feb 16, 2018 at 2:28 PM, Hua Yanghao
>> >> >>>> >> >>>>>>>> > <***@gmail.com>
>> >> >>>> >> >>>>>>>> > wrote:
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> Does anyone know in scons there are ways to
>> >> >>>> >> >>>>>>>> >> implicitly
>> >> >>>> >> >>>>>>>> >> make a
>> >> >>>> >> >>>>>>>> >> object
>> >> >>>> >> >>>>>>>> >> (e.g. xyz) available for SConscript without
>> >> >>>> >> >>>>>>>> >> explicity
>> >> >>>> >> >>>>>>>> >> Import(xyz)?
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> Just want to eliminate the annoying repeated
>> >> >>>> >> >>>>>>>> >> Import(xyz)
>> >> >>>> >> >>>>>>>> >> in
>> >> >>>> >> >>>>>>>> >> every
>> >> >>>> >> >>>>>>>> >> single SConscript.
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> And what about implicit Return()? e.g. xyz()
>> >> >>>> >> >>>>>>>> >> returns a
>> >> >>>> >> >>>>>>>> >> list of
>> >> >>>> >> >>>>>>>> >> object,
>> >> >>>> >> >>>>>>>> >> then in every SConscript if the top level
>> >> >>>> >> >>>>>>>> >> SConstruct
>> >> >>>> >> >>>>>>>> >> want
>> >> >>>> >> >>>>>>>> >> to
>> >> >>>> >> >>>>>>>> >> collect
>> >> >>>> >> >>>>>>>> >> the complete list of object returned from every
>> >> >>>> >> >>>>>>>> >> single
>> >> >>>> >> >>>>>>>> >> SConscript.
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> For example:
>> >> >>>> >> >>>>>>>> >> SConscript-1:
>> >> >>>> >> >>>>>>>> >> Import("xyz")
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> ret = xyz(...)
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> Return("ret")
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> Would ideally become:
>> >> >>>> >> >>>>>>>> >> SConscript-2:
>> >> >>>> >> >>>>>>>> >> xyz(...)
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> Thanks,
>> >> >>>> >> >>>>>>>> >> Yanghao
>> >> >>>> >> >>>>>>>> >> _______________________________________________
>> >> >>>> >> >>>>>>>> >> Scons-users mailing list
>> >> >>>> >> >>>>>>>> >> Scons-***@scons.org
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >>
>> >> >>>> >> >>>>>>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> > _______________________________________________
>> >> >>>> >> >>>>>>>> > Scons-users mailing list
>> >> >>>> >> >>>>>>>> > Scons-***@scons.org
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>>>>>> >
>> >> >>>> >> >>>>>>>> _______________________________________________
>> >> >>>> >> >>>>>>>> Scons-users mailing list
>> >> >>>> >> >>>>>>>> Scons-***@scons.org
>> >> >>>> >> >>>>>>>>
>> >> >>>> >> >>>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>>>>>
>> >> >>>> >> >>>>>>>
>> >> >>>> >> >>>>>>> _______________________________________________
>> >> >>>> >> >>>>>>> Scons-users mailing list
>> >> >>>> >> >>>>>>> Scons-***@scons.org
>> >> >>>> >> >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>>>>
>> >> >>>> >> >>>>>>
>> >> >>>> >> >>>>>> _______________________________________________
>> >> >>>> >> >>>>>> Scons-users mailing list
>> >> >>>> >> >>>>>> Scons-***@scons.org
>> >> >>>> >> >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>>>>
>> >> >>>> >> >>>>>
>> >> >>>> >> >>>>> _______________________________________________
>> >> >>>> >> >>>>> Scons-users mailing list
>> >> >>>> >> >>>>> Scons-***@scons.org
>> >> >>>> >> >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>>
>> >> >>>> >> >>>>
>> >> >>>> >> >>>> _______________________________________________
>> >> >>>> >> >>>> Scons-users mailing list
>> >> >>>> >> >>>> Scons-***@scons.org
>> >> >>>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>>
>> >> >>>> >> >>>
>> >> >>>> >> >>>
>> >> >>>> >> >>> _______________________________________________
>> >> >>>> >> >>> Scons-users mailing list
>> >> >>>> >> >>> Scons-***@scons.org
>> >> >>>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >> >>>
>> >> >>>> >> _______________________________________________
>> >> >>>> >> Scons-users mailing list
>> >> >>>> >> Scons-***@scons.org
>> >> >>>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >
>> >> >>>> >
>> >> >>>> >
>> >> >>>> > _______________________________________________
>> >> >>>> > Scons-users mailing list
>> >> >>>> > Scons-***@scons.org
>> >> >>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>> >
>> >> >>>> _______________________________________________
>> >> >>>> Scons-users mailing list
>> >> >>>> Scons-***@scons.org
>> >> >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> Scons-users mailing list
>> >> >>> Scons-***@scons.org
>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> Scons-users mailing list
>> >> >>> Scons-***@scons.org
>> >> >>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>>
>> >> >>
>> >> >> _______________________________________________
>> >> >> Scons-users mailing list
>> >> >> Scons-***@scons.org
>> >> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> Scons-users mailing list
>> >> >> Scons-***@scons.org
>> >> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >>
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > Scons-users mailing list
>> >> > Scons-***@scons.org
>> >> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >> >
>> >> _______________________________________________
>> >> Scons-users mailing list
>> >> Scons-***@scons.org
>> >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> >
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-***@scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> _______________________________________________
>> Scons-users mailing list
>> Scons-***@scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Gary Granger
2018-02-20 19:36:05 UTC
Permalink
Hello Yanghao,

I've been following this thread since I think it's an interesting idea. 
SCons allows so much extension and customization, but usually (by common
practice and by design) that extension happens by adding builders and
methods to an Environment.  However, it does make sense that maybe there
should be a way to extend the symbols available by default in the
SConscript scope.

The problem with that, though, is you might collide with what SCons
wants to put in the SConscript scope, and it's reasonable to give SCons
exclusive control of that with Import().  Instead, what if there were a
namespace for exported symbols that was always available in a
SConscript, without Import():

For example, one SConscript exports a symbol as usual:

Export('xyz')

Then in the other SConscripts the symbol can be accessed like so:

Exports.xyz()

Would that be convenient and non-repetitive enough?  This would mean no
Import() would be required to access exports, but the exports would be
qualified by a namespace which was always available at SConscript scope,
and the developer would have complete control over the namespace.  I
don't know how hard that would be to implement, but I assume with python
it must be possible.

Note that right now I think you can get similar functionality by
extending DefaultEnvironment(), since DefaultEnvironment is always in
SConscript scope, and it can be extended in the conventional ways:

DefaultEnvironment().AddMethod(xyz, "xyz")

And then everywhere else:

DefaultEnvironment().xyz()

Someone please correct me if that doesn't sound right.  Either way,
that's more wordy, and perhaps it's the wrong approach if the concept is
to extend the SConscript scope and not an actual Environment.

I also considered whether Export() is a better place to implement this
'default_import' functionality, since writing
SConscript(default_imports=[...], ...) could get repetitive for lots of
SConscripts.  For example, allow an Export'ed symbol to be added to a
"global imports" list:

Export('xyz', global=True)

I like that idea too, but I understand that people may want finer
control over the default imports of each particular SConscript as it's
loaded.

I've never thought of this before, but what if someone Import()s a
symbol which collides with a SCons symbol, like Library?  Is it possible
to replace SCons symbols in the SConscript scope?  That could be very
powerful, which could make it a bad idea. :)

Just some ideas I wanted to share.  Thanks,
gary

On 02/20/2018 01:29 AM, Hua Yanghao wrote:
> Hi Bill,
> Unfortunately my source tree cannot be made public for now. I am
> trying to get the core of it public in several month from now ...
>
> The thing is, in SConscript there are already quite a few object made
> available by default: Import, Return, ...
> The best way would be change that static list into a dynamic one. I
> always believe a good design should provide mechanism, not policy. and
> in this case the mechanism is "make some object available in
> SConscript", and the policy is "which one should be there". The policy
> part is better left for the user/application to decide. I will try to
> see how far I can go and keep you posted and let's debate again once I
> got some patch available.
>
> Best Regards,
> Yanghao
>
Hua Yanghao
2018-02-21 09:58:32 UTC
Permalink
Hi Gary,
I like your idea of making it into namespaces, which is more pythonic also.
Consider in SConscript, which should be considered as equally as any
python script, it will be good if we can do:

import scons
scons.Import()/Environment()/...

import mymodule
mymodule.xyz()...

And if we have this "default_import" capability then user can actually
decide not to import SCons method by default at all with
"default_import=None", so a pattern on SConscript can be enforced and
user still have the possibility to explicitly import them.

However here actually I really don't want to treat SConscript as any
other python file out there, and rather consider it is special and it
is even a domain-specific script (happens to be a python script too).
And you should define your domain's specific environment that is
available by default. Exactly like what SConscript() now is already
doing, to make a few method available by default, so in SConscript you
can cut the cheese and get to the point directly:

usw_files("elf", [a.c, b.c, c.c, x.S, ...])
usw_files("hdl", [a.v, b.v, c.v, ...])

And that's it, so you can build domain specific SConscript that meets
your needs to simplify how a module can be created, and building a
build framework that is way easier to use than default SCons. I still
remember when I first try to use scons there are many concept/details
to catch up and it is not actually as easy to use as kbuild system. I
actually believe scons should have build more than just the core and
tools, but rather to provide a build framework that end user can
directly use without any hurdles: write a one line SConscript for a
module, include that module in a top level module list SConstruct will
read, and you are done (just like kbuild system).

The other alternative is like Spencer suggested to wrap around another
file, say "Makefile", where it is read and a new SConscript file is
generated with the content in Makefile inserted after the explicity
imports. I try to avoid this indirect step as my project was pure 100%
scons-based and for old libraries I actually manually create a
SConscript for it (I even created a SConscript to build micropython
entirely.).

The reason I really love python is you really don't need to type that
much and can get things done, and I try to stay with that principle
whenever I can.

I don't find much introduction of the design concept of SCons internal
so it may take a while for me to fully understand its design and see
what is the best way to implement this. Or even better if more
experienced developer sees the value and jumps in to help out ;-)

Best Regards,
Yanghao

On Tue, Feb 20, 2018 at 8:36 PM, Gary Granger <***@ucar.edu> wrote:
> Hello Yanghao,
>
> I've been following this thread since I think it's an interesting idea.
> SCons allows so much extension and customization, but usually (by common
> practice and by design) that extension happens by adding builders and
> methods to an Environment. However, it does make sense that maybe there
> should be a way to extend the symbols available by default in the SConscript
> scope.
>
> The problem with that, though, is you might collide with what SCons wants to
> put in the SConscript scope, and it's reasonable to give SCons exclusive
> control of that with Import(). Instead, what if there were a namespace for
> exported symbols that was always available in a SConscript, without
> Import():
>
> For example, one SConscript exports a symbol as usual:
>
> Export('xyz')
>
> Then in the other SConscripts the symbol can be accessed like so:
>
> Exports.xyz()
>
> Would that be convenient and non-repetitive enough? This would mean no
> Import() would be required to access exports, but the exports would be
> qualified by a namespace which was always available at SConscript scope, and
> the developer would have complete control over the namespace. I don't know
> how hard that would be to implement, but I assume with python it must be
> possible.
>
> Note that right now I think you can get similar functionality by extending
> DefaultEnvironment(), since DefaultEnvironment is always in SConscript
> scope, and it can be extended in the conventional ways:
>
> DefaultEnvironment().AddMethod(xyz, "xyz")
>
> And then everywhere else:
>
> DefaultEnvironment().xyz()
>
> Someone please correct me if that doesn't sound right. Either way, that's
> more wordy, and perhaps it's the wrong approach if the concept is to extend
> the SConscript scope and not an actual Environment.
>
> I also considered whether Export() is a better place to implement this
> 'default_import' functionality, since writing
> SConscript(default_imports=[...], ...) could get repetitive for lots of
> SConscripts. For example, allow an Export'ed symbol to be added to a
> "global imports" list:
>
> Export('xyz', global=True)
>
> I like that idea too, but I understand that people may want finer control
> over the default imports of each particular SConscript as it's loaded.
>
> I've never thought of this before, but what if someone Import()s a symbol
> which collides with a SCons symbol, like Library? Is it possible to replace
> SCons symbols in the SConscript scope? That could be very powerful, which
> could make it a bad idea. :)
>
> Just some ideas I wanted to share. Thanks,
> gary
>
> On 02/20/2018 01:29 AM, Hua Yanghao wrote:
>
> Hi Bill,
> Unfortunately my source tree cannot be made public for now. I am
> trying to get the core of it public in several month from now ...
>
> The thing is, in SConscript there are already quite a few object made
> available by default: Import, Return, ...
> The best way would be change that static list into a dynamic one. I
> always believe a good design should provide mechanism, not policy. and
> in this case the mechanism is "make some object available in
> SConscript", and the policy is "which one should be there". The policy
> part is better left for the user/application to decide. I will try to
> see how far I can go and keep you posted and let's debate again once I
> got some patch available.
>
> Best Regards,
> Yanghao
>
>
Bill Deegan
2018-02-21 15:38:11 UTC
Permalink
Yanghao,

SCons is meant to be a python based make replacement.

What your suggesting is probably more along the lines of Parts? (Jason)
(Which is build on top of SCons).

So if I understand properly, you want to add an alternative version of
SConscript where the files would be presented and entirely different set of
globals to work with?

-Bill



On Wed, Feb 21, 2018 at 4:58 AM, Hua Yanghao <***@gmail.com> wrote:

> Hi Gary,
> I like your idea of making it into namespaces, which is more pythonic also.
> Consider in SConscript, which should be considered as equally as any
> python script, it will be good if we can do:
>
> import scons
> scons.Import()/Environment()/...
>
> import mymodule
> mymodule.xyz()...
>
> And if we have this "default_import" capability then user can actually
> decide not to import SCons method by default at all with
> "default_import=None", so a pattern on SConscript can be enforced and
> user still have the possibility to explicitly import them.
>
> However here actually I really don't want to treat SConscript as any
> other python file out there, and rather consider it is special and it
> is even a domain-specific script (happens to be a python script too).
> And you should define your domain's specific environment that is
> available by default. Exactly like what SConscript() now is already
> doing, to make a few method available by default, so in SConscript you
> can cut the cheese and get to the point directly:
>
> usw_files("elf", [a.c, b.c, c.c, x.S, ...])
> usw_files("hdl", [a.v, b.v, c.v, ...])
>
> And that's it, so you can build domain specific SConscript that meets
> your needs to simplify how a module can be created, and building a
> build framework that is way easier to use than default SCons. I still
> remember when I first try to use scons there are many concept/details
> to catch up and it is not actually as easy to use as kbuild system. I
> actually believe scons should have build more than just the core and
> tools, but rather to provide a build framework that end user can
> directly use without any hurdles: write a one line SConscript for a
> module, include that module in a top level module list SConstruct will
> read, and you are done (just like kbuild system).
>
> The other alternative is like Spencer suggested to wrap around another
> file, say "Makefile", where it is read and a new SConscript file is
> generated with the content in Makefile inserted after the explicity
> imports. I try to avoid this indirect step as my project was pure 100%
> scons-based and for old libraries I actually manually create a
> SConscript for it (I even created a SConscript to build micropython
> entirely.).
>
> The reason I really love python is you really don't need to type that
> much and can get things done, and I try to stay with that principle
> whenever I can.
>
> I don't find much introduction of the design concept of SCons internal
> so it may take a while for me to fully understand its design and see
> what is the best way to implement this. Or even better if more
> experienced developer sees the value and jumps in to help out ;-)
>
> Best Regards,
> Yanghao
>
> On Tue, Feb 20, 2018 at 8:36 PM, Gary Granger <***@ucar.edu> wrote:
> > Hello Yanghao,
> >
> > I've been following this thread since I think it's an interesting idea.
> > SCons allows so much extension and customization, but usually (by common
> > practice and by design) that extension happens by adding builders and
> > methods to an Environment. However, it does make sense that maybe there
> > should be a way to extend the symbols available by default in the
> SConscript
> > scope.
> >
> > The problem with that, though, is you might collide with what SCons
> wants to
> > put in the SConscript scope, and it's reasonable to give SCons exclusive
> > control of that with Import(). Instead, what if there were a namespace
> for
> > exported symbols that was always available in a SConscript, without
> > Import():
> >
> > For example, one SConscript exports a symbol as usual:
> >
> > Export('xyz')
> >
> > Then in the other SConscripts the symbol can be accessed like so:
> >
> > Exports.xyz()
> >
> > Would that be convenient and non-repetitive enough? This would mean no
> > Import() would be required to access exports, but the exports would be
> > qualified by a namespace which was always available at SConscript scope,
> and
> > the developer would have complete control over the namespace. I don't
> know
> > how hard that would be to implement, but I assume with python it must be
> > possible.
> >
> > Note that right now I think you can get similar functionality by
> extending
> > DefaultEnvironment(), since DefaultEnvironment is always in SConscript
> > scope, and it can be extended in the conventional ways:
> >
> > DefaultEnvironment().AddMethod(xyz, "xyz")
> >
> > And then everywhere else:
> >
> > DefaultEnvironment().xyz()
> >
> > Someone please correct me if that doesn't sound right. Either way,
> that's
> > more wordy, and perhaps it's the wrong approach if the concept is to
> extend
> > the SConscript scope and not an actual Environment.
> >
> > I also considered whether Export() is a better place to implement this
> > 'default_import' functionality, since writing
> > SConscript(default_imports=[...], ...) could get repetitive for lots of
> > SConscripts. For example, allow an Export'ed symbol to be added to a
> > "global imports" list:
> >
> > Export('xyz', global=True)
> >
> > I like that idea too, but I understand that people may want finer control
> > over the default imports of each particular SConscript as it's loaded.
> >
> > I've never thought of this before, but what if someone Import()s a symbol
> > which collides with a SCons symbol, like Library? Is it possible to
> replace
> > SCons symbols in the SConscript scope? That could be very powerful,
> which
> > could make it a bad idea. :)
> >
> > Just some ideas I wanted to share. Thanks,
> > gary
> >
> > On 02/20/2018 01:29 AM, Hua Yanghao wrote:
> >
> > Hi Bill,
> > Unfortunately my source tree cannot be made public for now. I am
> > trying to get the core of it public in several month from now ...
> >
> > The thing is, in SConscript there are already quite a few object made
> > available by default: Import, Return, ...
> > The best way would be change that static list into a dynamic one. I
> > always believe a good design should provide mechanism, not policy. and
> > in this case the mechanism is "make some object available in
> > SConscript", and the policy is "which one should be there". The policy
> > part is better left for the user/application to decide. I will try to
> > see how far I can go and keep you posted and let's debate again once I
> > got some patch available.
> >
> > Best Regards,
> > Yanghao
> >
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Jason Kenny
2018-02-21 16:27:30 UTC
Permalink
So I was going to suggest the idea of namespaces as well.

History wise Steve though namespaces are to complex. to have in SCons. As far as Parts I have code we could add to Scons. I think I want to tweak it a little more ( a fine tuning easier for usage)

In Parts I have some code https://bitbucket.org/sconsparts/parts/src/3258a0ff867c5c48faac46993837a05a13d5e474/parts/common.py?at=master&fileviewer=file-view-default#common.py-74

this namespace object allows one to add an object that will be seen in the environment under a different value. For example

env['myspace']=namespace(dict(one=1,hello="world"))
then you can say:
env['myspace'].one
or env['myspace']['one']
I think env.myspace.one will work as well

you can also do

env.subst("${myspace.hello}") -> "world"

This object also has some logic to help with Clone() calls to make sure stuff gets duplicated when it should.


I have logic for depends handling as well to allow exporting from one Part and importing them in another, with control if the custom values are added to the "public" space or not. By public, I mean adding it to top-level environment, vs it being imported in a namespace of the part. I should also state I want to but have not had time to do a refactor to make this better. The current code work via passing around string "mapper" objects that allow this data to be passed by the subst engine in SCons

ie Parts A:

env.ExportItem("mykey","myvalue")

in part B

DependsOn([
Component("A",requires=REQ.A(public=True)),
])

This would make the value in an environment so you can say:
env.subst('${mykey}')

this will return "myvalue" given Part A was loaded before B ( otherwise the value of A is not known yet)

in both the case of being public or not this value is mapped to
env['DEPENDS']['A']['myvalue']

which is a namespace so you can say
env.subst('${DEPENDS.A.myvalue}')

There is more you can so with the Depends system in Parts.. my goal is to get time to change the loading logic to allow me to pass objects straight and remove the mapping logic. I can try to answer that if you have questions

either way the namespace object I think is what you are looking for. I think it would be a good addition to SCons

Jason



________________________________
From: Scons-users <scons-users-***@scons.org> on behalf of Bill Deegan <***@baddogconsulting.com>
Sent: Wednesday, February 21, 2018 9:38 AM
To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Yanghao,

SCons is meant to be a python based make replacement.

What your suggesting is probably more along the lines of Parts? (Jason) (Which is build on top of SCons).

So if I understand properly, you want to add an alternative version of SConscript where the files would be presented and entirely different set of globals to work with?

-Bill



On Wed, Feb 21, 2018 at 4:58 AM, Hua Yanghao <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Gary,
I like your idea of making it into namespaces, which is more pythonic also.
Consider in SConscript, which should be considered as equally as any
python script, it will be good if we can do:

import scons
scons.Import()/Environment()/...

import mymodule
mymodule.xyz<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmymodule.xyz&data=02%7C01%7C%7C2e9037112b914243bbee08d5794122a2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548243006635246&sdata=dGhKXXyAeobqJSFW86hhUiFPCzXtvJFOMWCK%2BBbMWO4%3D&reserved=0>()...

And if we have this "default_import" capability then user can actually
decide not to import SCons method by default at all with
"default_import=None", so a pattern on SConscript can be enforced and
user still have the possibility to explicitly import them.

However here actually I really don't want to treat SConscript as any
other python file out there, and rather consider it is special and it
is even a domain-specific script (happens to be a python script too).
And you should define your domain's specific environment that is
available by default. Exactly like what SConscript() now is already
doing, to make a few method available by default, so in SConscript you
can cut the cheese and get to the point directly:

usw_files("elf", [a.c, b.c, c.c, x.S, ...])
usw_files("hdl", [a.v, b.v, c.v, ...])

And that's it, so you can build domain specific SConscript that meets
your needs to simplify how a module can be created, and building a
build framework that is way easier to use than default SCons. I still
remember when I first try to use scons there are many concept/details
to catch up and it is not actually as easy to use as kbuild system. I
actually believe scons should have build more than just the core and
tools, but rather to provide a build framework that end user can
directly use without any hurdles: write a one line SConscript for a
module, include that module in a top level module list SConstruct will
read, and you are done (just like kbuild system).

The other alternative is like Spencer suggested to wrap around another
file, say "Makefile", where it is read and a new SConscript file is
generated with the content in Makefile inserted after the explicity
imports. I try to avoid this indirect step as my project was pure 100%
scons-based and for old libraries I actually manually create a
SConscript for it (I even created a SConscript to build micropython
entirely.).

The reason I really love python is you really don't need to type that
much and can get things done, and I try to stay with that principle
whenever I can.

I don't find much introduction of the design concept of SCons internal
so it may take a while for me to fully understand its design and see
what is the best way to implement this. Or even better if more
experienced developer sees the value and jumps in to help out ;-)

Best Regards,
Yanghao

On Tue, Feb 20, 2018 at 8:36 PM, Gary Granger <***@ucar.edu<mailto:***@ucar.edu>> wrote:
> Hello Yanghao,
>
> I've been following this thread since I think it's an interesting idea.
> SCons allows so much extension and customization, but usually (by common
> practice and by design) that extension happens by adding builders and
> methods to an Environment. However, it does make sense that maybe there
> should be a way to extend the symbols available by default in the SConscript
> scope.
>
> The problem with that, though, is you might collide with what SCons wants to
> put in the SConscript scope, and it's reasonable to give SCons exclusive
> control of that with Import(). Instead, what if there were a namespace for
> exported symbols that was always available in a SConscript, without
> Import():
>
> For example, one SConscript exports a symbol as usual:
>
> Export('xyz')
>
> Then in the other SConscripts the symbol can be accessed like so:
>
> Exports.xyz()
>
> Would that be convenient and non-repetitive enough? This would mean no
> Import() would be required to access exports, but the exports would be
> qualified by a namespace which was always available at SConscript scope, and
> the developer would have complete control over the namespace. I don't know
> how hard that would be to implement, but I assume with python it must be
> possible.
>
> Note that right now I think you can get similar functionality by extending
> DefaultEnvironment(), since DefaultEnvironment is always in SConscript
> scope, and it can be extended in the conventional ways:
>
> DefaultEnvironment().AddMethod(xyz, "xyz")
>
> And then everywhere else:
>
> DefaultEnvironment().xyz()
>
> Someone please correct me if that doesn't sound right. Either way, that's
> more wordy, and perhaps it's the wrong approach if the concept is to extend
> the SConscript scope and not an actual Environment.
>
> I also considered whether Export() is a better place to implement this
> 'default_import' functionality, since writing
> SConscript(default_imports=[...], ...) could get repetitive for lots of
> SConscripts. For example, allow an Export'ed symbol to be added to a
> "global imports" list:
>
> Export('xyz', global=True)
>
> I like that idea too, but I understand that people may want finer control
> over the default imports of each particular SConscript as it's loaded.
>
> I've never thought of this before, but what if someone Import()s a symbol
> which collides with a SCons symbol, like Library? Is it possible to replace
> SCons symbols in the SConscript scope? That could be very powerful, which
> could make it a bad idea. :)
>
> Just some ideas I wanted to share. Thanks,
> gary
>
> On 02/20/2018 01:29 AM, Hua Yanghao wrote:
>
> Hi Bill,
> Unfortunately my source tree cannot be made public for now. I am
> trying to get the core of it public in several month from now ...
>
> The thing is, in SConscript there are already quite a few object made
> available by default: Import, Return, ...
> The best way would be change that static list into a dynamic one. I
> always believe a good design should provide mechanism, not policy. and
> in this case the mechanism is "make some object available in
> SConscript", and the policy is "which one should be there". The policy
> part is better left for the user/application to decide. I will try to
> see how far I can go and keep you posted and let's debate again once I
> got some patch available.
>
> Best Regards,
> Yanghao
>
>
Hua Yanghao
2018-02-21 19:59:10 UTC
Permalink
Hi Bill,

> SCons is meant to be a python based make replacement.

This is actually very much not true. Make is really just dispatching
commands/keeping track of dependencies and timestamps ... it does not
provide any Scons Tools libraries etc. In my view somehow scons is
stuck in the middle of "Make" and a comprehensive build framework like
"Kbuild", more accurate, yet more difficult compared to pure Make for
small things, and yet again more difficult compared to full-fledged
build system due to the lack of a common build framework.

> What your suggesting is probably more along the lines of Parts? (Jason)
> (Which is build on top of SCons).

I think I saw parts project quite some time ago on company intranet
... , but wasn't really what I wanted. I want a single super repo for
everything a project requires, as compared to be able to build
independent small things and then stitch them together. Kbuild is
really what I wanted, kbuild would be perfect if it is build on top of
python instead of those eye-hurting shell script ... so I setup and
build a extremely similar (even better in many ways such as
inter-configuration dependencies) thing in python/scons (only took a
few days for the very first working version).

> So if I understand properly, you want to add an alternative version of
> SConscript where the files would be presented and entirely different set of
> globals to work with?

Yes, exactly. to bring SConscript from stone-age to industrial-age,
and yet still allow you to use chisel if you insist ... :)

Best Regards,
Yangao
Jason Kenny
2018-02-21 20:21:12 UTC
Permalink
>> I want a single super repo for
>> everything a project requires, as compared to be able to build
>> independent small things and then stitch them together.


I think that is not Parts... Parts is about building everything you need in one place.. given that be using the a large repo with everything in it or having Part grab data from different areas. Parts is about making it easy to manage a build with lots of components. Projects I had at Intel had 1200+ component in it. it would build all of this as a massive unified build. I recall the output being over 50GB ( object files and debug info ) The point for Parts is that component A make some output file called joe.so and otehr components need it. Parts pass this around. So cross-building is easy and if joe becomes josh.so there is one change in one file and everything works. The current SCons/Make way is to have to change this value in every place that uses component A. I should also point out the idea of a Part is to help manage the large chaos of large projects, it also adds other stuff so one should be able to use standard SCons stuff and get improved toolchain logic etc. That is the intent, however everyone I talk to rather componentize/project the build to make it more flexible. Still, Parts might not be useful for you.
________________________________
From: Scons-users <scons-users-***@scons.org> on behalf of Hua Yanghao <***@gmail.com>
Sent: Wednesday, February 21, 2018 1:59 PM
To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Hi Bill,

> SCons is meant to be a python based make replacement.

This is actually very much not true. Make is really just dispatching
commands/keeping track of dependencies and timestamps ... it does not
provide any Scons Tools libraries etc. In my view somehow scons is
stuck in the middle of "Make" and a comprehensive build framework like
"Kbuild", more accurate, yet more difficult compared to pure Make for
small things, and yet again more difficult compared to full-fledged
build system due to the lack of a common build framework.

> What your suggesting is probably more along the lines of Parts? (Jason)
> (Which is build on top of SCons).

I think I saw parts project quite some time ago on company intranet
... , but wasn't really what I wanted. I want a single super repo for
everything a project requires, as compared to be able to build
independent small things and then stitch them together. Kbuild is
really what I wanted, kbuild would be perfect if it is build on top of
python instead of those eye-hurting shell script ... so I setup and
build a extremely similar (even better in many ways such as
inter-configuration dependencies) thing in python/scons (only took a
few days for the very first working version).

> So if I understand properly, you want to add an alternative version of
> SConscript where the files would be presented and entirely different set of
> globals to work with?

Yes, exactly. to bring SConscript from stone-age to industrial-age,
and yet still allow you to use chisel if you insist ... :)

Best Regards,
Yangao
Bill Deegan
2018-02-21 20:22:51 UTC
Permalink
On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com> wrote:

> Hi Bill,
>
> > SCons is meant to be a python based make replacement.
>
> This is actually very much not true.


From the scons.or website:
"SCons is an Open Source software construction tool—that is, a
next-generation build tool. Think of SCons as an improved, cross-platform
substitute for the classic Make utility with integrated functionality
similar to autoconf/automake and compiler caches such as ccache. In short,
SCons is an easier, more reliable and faster way to build software."


> Make is really just dispatching
> commands/keeping track of dependencies and timestamps ... it does not
> provide any Scons Tools libraries etc. In my view somehow scons is
> stuck in the middle of "Make" and a comprehensive build framework like
> "Kbuild", more accurate, yet more difficult compared to pure Make for
> small things, and yet again more difficult compared to full-fledged
> build system due to the lack of a common build framework.
>



How much time are you willing to commit to development and ongoing support
of your changes?


>
> > What your suggesting is probably more along the lines of Parts? (Jason)
> > (Which is build on top of SCons).
>
> I think I saw parts project quite some time ago on company intranet
> ... , but wasn't really what I wanted. I want a single super repo for
> everything a project requires, as compared to be able to build
> independent small things and then stitch them together. Kbuild is
> really what I wanted, kbuild would be perfect if it is build on top of
> python instead of those eye-hurting shell script ... so I setup and
> build a extremely similar (even better in many ways such as
> inter-configuration dependencies) thing in python/scons (only took a
> few days for the very first working version).
>
> > So if I understand properly, you want to add an alternative version of
> > SConscript where the files would be presented and entirely different set
> of
> > globals to work with?
>
> Yes, exactly. to bring SConscript from stone-age to industrial-age,
> and yet still allow you to use chisel if you insist ... :)
>

That's nice. Good luck with your efforts.
Bill Deegan
2018-02-21 20:35:18 UTC
Permalink
Yangao,

Please keep us up to date with your efforts.
Take a look at our developer guide, any such would need docs and tests to
be considered for inclusion to SCons, and any major changes would have to
have support of the community.

I don't have any time or energy to contribute, I'm working on some core
SCons logic that requires all the time I have available.

-Bill
SCons Project Co-Manager


On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
wrote:

>
>
> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com> wrote:
>
>> Hi Bill,
>>
>> > SCons is meant to be a python based make replacement.
>>
>> This is actually very much not true.
>
>
> From the scons.or website:
> "SCons is an Open Source software construction tool—that is, a
> next-generation build tool. Think of SCons as an improved, cross-platform
> substitute for the classic Make utility with integrated functionality
> similar to autoconf/automake and compiler caches such as ccache. In short,
> SCons is an easier, more reliable and faster way to build software."
>
>
>> Make is really just dispatching
>> commands/keeping track of dependencies and timestamps ... it does not
>> provide any Scons Tools libraries etc. In my view somehow scons is
>> stuck in the middle of "Make" and a comprehensive build framework like
>> "Kbuild", more accurate, yet more difficult compared to pure Make for
>> small things, and yet again more difficult compared to full-fledged
>> build system due to the lack of a common build framework.
>>
>
>
>
> How much time are you willing to commit to development and ongoing support
> of your changes?
>
>
>>
>> > What your suggesting is probably more along the lines of Parts? (Jason)
>> > (Which is build on top of SCons).
>>
>> I think I saw parts project quite some time ago on company intranet
>> ... , but wasn't really what I wanted. I want a single super repo for
>> everything a project requires, as compared to be able to build
>> independent small things and then stitch them together. Kbuild is
>> really what I wanted, kbuild would be perfect if it is build on top of
>> python instead of those eye-hurting shell script ... so I setup and
>> build a extremely similar (even better in many ways such as
>> inter-configuration dependencies) thing in python/scons (only took a
>> few days for the very first working version).
>>
>> > So if I understand properly, you want to add an alternative version of
>> > SConscript where the files would be presented and entirely different
>> set of
>> > globals to work with?
>>
>> Yes, exactly. to bring SConscript from stone-age to industrial-age,
>> and yet still allow you to use chisel if you insist ... :)
>>
>
> That's nice. Good luck with your efforts.
>
>
>
Jason Kenny
2018-02-21 20:53:37 UTC
Permalink
If the namespace object in parts helps you with the import export fixes you would like to make. Please feel free you use it/tweak it make this happen

Jason
________________________________
From: Scons-users <scons-users-***@scons.org> on behalf of Bill Deegan <***@baddogconsulting.com>
Sent: Wednesday, February 21, 2018 2:35 PM
To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Yangao,

Please keep us up to date with your efforts.
Take a look at our developer guide, any such would need docs and tests to be considered for inclusion to SCons, and any major changes would have to have support of the community.

I don't have any time or energy to contribute, I'm working on some core SCons logic that requires all the time I have available.

-Bill
SCons Project Co-Manager


On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>> wrote:


On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Bill,

> SCons is meant to be a python based make replacement.

This is actually very much not true.

From the scons.or website:
"SCons is an Open Source software construction tool—that is, a next-generation build tool. Think of SCons as an improved, cross-platform substitute for the classic Make utility with integrated functionality similar to autoconf/automake and compiler caches such as ccache. In short, SCons is an easier, more reliable and faster way to build software."

Make is really just dispatching
commands/keeping track of dependencies and timestamps ... it does not
provide any Scons Tools libraries etc. In my view somehow scons is
stuck in the middle of "Make" and a comprehensive build framework like
"Kbuild", more accurate, yet more difficult compared to pure Make for
small things, and yet again more difficult compared to full-fledged
build system due to the lack of a common build framework.



How much time are you willing to commit to development and ongoing support of your changes?


> What your suggesting is probably more along the lines of Parts? (Jason)
> (Which is build on top of SCons).

I think I saw parts project quite some time ago on company intranet
... , but wasn't really what I wanted. I want a single super repo for
everything a project requires, as compared to be able to build
independent small things and then stitch them together. Kbuild is
really what I wanted, kbuild would be perfect if it is build on top of
python instead of those eye-hurting shell script ... so I setup and
build a extremely similar (even better in many ways such as
inter-configuration dependencies) thing in python/scons (only took a
few days for the very first working version).

> So if I understand properly, you want to add an alternative version of
> SConscript where the files would be presented and entirely different set of
> globals to work with?

Yes, exactly. to bring SConscript from stone-age to industrial-age,
and yet still allow you to use chisel if you insist ... :)

That's nice. Good luck with your efforts.
Hua Yanghao
2018-02-21 21:29:40 UTC
Permalink
Hi Jason,
Indeed it was not Parts, sorry it is my bad.

I will give parts a close look.

Best Regards,
Yanghao

On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com> wrote:
> If the namespace object in parts helps you with the import export fixes you
> would like to make. Please feel free you use it/tweak it make this happen
>
> Jason
> ________________________________
> From: Scons-users <scons-users-***@scons.org> on behalf of Bill Deegan
> <***@baddogconsulting.com>
> Sent: Wednesday, February 21, 2018 2:35 PM
> To: SCons users mailing list
> Subject: Re: [Scons-users] Provide default Import to SConscript
>
> Yangao,
>
> Please keep us up to date with your efforts.
> Take a look at our developer guide, any such would need docs and tests to be
> considered for inclusion to SCons, and any major changes would have to have
> support of the community.
>
> I don't have any time or energy to contribute, I'm working on some core
> SCons logic that requires all the time I have available.
>
> -Bill
> SCons Project Co-Manager
>
>
> On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
>
>
>
> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com> wrote:
>
> Hi Bill,
>
>> SCons is meant to be a python based make replacement.
>
> This is actually very much not true.
>
>
> From the scons.or website:
> "SCons is an Open Source software construction tool—that is, a
> next-generation build tool. Think of SCons as an improved, cross-platform
> substitute for the classic Make utility with integrated functionality
> similar to autoconf/automake and compiler caches such as ccache. In short,
> SCons is an easier, more reliable and faster way to build software."
>
>
> Make is really just dispatching
> commands/keeping track of dependencies and timestamps ... it does not
> provide any Scons Tools libraries etc. In my view somehow scons is
> stuck in the middle of "Make" and a comprehensive build framework like
> "Kbuild", more accurate, yet more difficult compared to pure Make for
> small things, and yet again more difficult compared to full-fledged
> build system due to the lack of a common build framework.
>
>
>
>
> How much time are you willing to commit to development and ongoing support
> of your changes?
>
>
>
>> What your suggesting is probably more along the lines of Parts? (Jason)
>> (Which is build on top of SCons).
>
> I think I saw parts project quite some time ago on company intranet
> ... , but wasn't really what I wanted. I want a single super repo for
> everything a project requires, as compared to be able to build
> independent small things and then stitch them together. Kbuild is
> really what I wanted, kbuild would be perfect if it is build on top of
> python instead of those eye-hurting shell script ... so I setup and
> build a extremely similar (even better in many ways such as
> inter-configuration dependencies) thing in python/scons (only took a
> few days for the very first working version).
>
>> So if I understand properly, you want to add an alternative version of
>> SConscript where the files would be presented and entirely different set
>> of
>> globals to work with?
>
> Yes, exactly. to bring SConscript from stone-age to industrial-age,
> and yet still allow you to use chisel if you insist ... :)
>
>
> That's nice. Good luck with your efforts.
>
>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Jason Kenny
2018-02-21 21:47:41 UTC
Permalink
No problem,

If you have any question.. want updated links to it etc.. just let me know. Also as Bill said.. feel free to "steal" any code in Parts to help you with your improvement to SCons.

Best of luck!
Jason
________________________________
From: Scons-users <scons-users-***@scons.org> on behalf of Hua Yanghao <***@gmail.com>
Sent: Wednesday, February 21, 2018 3:29 PM
To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Hi Jason,
Indeed it was not Parts, sorry it is my bad.

I will give parts a close look.

Best Regards,
Yanghao

On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com> wrote:
> If the namespace object in parts helps you with the import export fixes you
> would like to make. Please feel free you use it/tweak it make this happen
>
> Jason
> ________________________________
> From: Scons-users <scons-users-***@scons.org> on behalf of Bill Deegan
> <***@baddogconsulting.com>
> Sent: Wednesday, February 21, 2018 2:35 PM
> To: SCons users mailing list
> Subject: Re: [Scons-users] Provide default Import to SConscript
>
> Yangao,
>
> Please keep us up to date with your efforts.
> Take a look at our developer guide, any such would need docs and tests to be
> considered for inclusion to SCons, and any major changes would have to have
> support of the community.
>
> I don't have any time or energy to contribute, I'm working on some core
> SCons logic that requires all the time I have available.
>
> -Bill
> SCons Project Co-Manager
>
>
> On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
>
>
>
> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com> wrote:
>
> Hi Bill,
>
>> SCons is meant to be a python based make replacement.
>
> This is actually very much not true.
>
>
> From the scons.or website:
> "SCons is an Open Source software construction tool—that is, a
> next-generation build tool. Think of SCons as an improved, cross-platform
> substitute for the classic Make utility with integrated functionality
> similar to autoconf/automake and compiler caches such as ccache. In short,
> SCons is an easier, more reliable and faster way to build software."
>
>
> Make is really just dispatching
> commands/keeping track of dependencies and timestamps ... it does not
> provide any Scons Tools libraries etc. In my view somehow scons is
> stuck in the middle of "Make" and a comprehensive build framework like
> "Kbuild", more accurate, yet more difficult compared to pure Make for
> small things, and yet again more difficult compared to full-fledged
> build system due to the lack of a common build framework.
>
>
>
>
> How much time are you willing to commit to development and ongoing support
> of your changes?
>
>
>
>> What your suggesting is probably more along the lines of Parts? (Jason)
>> (Which is build on top of SCons).
>
> I think I saw parts project quite some time ago on company intranet
> ... , but wasn't really what I wanted. I want a single super repo for
> everything a project requires, as compared to be able to build
> independent small things and then stitch them together. Kbuild is
> really what I wanted, kbuild would be perfect if it is build on top of
> python instead of those eye-hurting shell script ... so I setup and
> build a extremely similar (even better in many ways such as
> inter-configuration dependencies) thing in python/scons (only took a
> few days for the very first working version).
>
>> So if I understand properly, you want to add an alternative version of
>> SConscript where the files would be presented and entirely different set
>> of
>> globals to work with?
>
> Yes, exactly. to bring SConscript from stone-age to industrial-age,
> and yet still allow you to use chisel if you insist ... :)
>
>
> That's nice. Good luck with your efforts.
>
>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
Gary Oberbrunner
2018-02-23 14:42:38 UTC
Permalink
In case folks don't know this, here are two ways to get symbols into the
namespace that SConscripts start with:
1. Add them to SCons.Script (which is automatically imported into all
SConscripts)
2. Put them in site_init/site_scons.py

The site init file logic (in src/engine/SCons/Script/Main.py) prepends
site_scons to sys.path, imports site_init.py into the SCons.Script
namespace, as well as prepending site_scons/site_tools to the default tool
path.

Also note that in any Python file you can do 'import SCons.Script' and use
standard SCons functions like File, Dir, Program, etc.

On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com> wrote:

> No problem,
>
> If you have any question.. want updated links to it etc.. just let me
> know. Also as Bill said.. feel free to "steal" any code in Parts to help
> you with your improvement to SCons.
>
> Best of luck!
> Jason
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Hua
> Yanghao <***@gmail.com>
> *Sent:* Wednesday, February 21, 2018 3:29 PM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> Hi Jason,
> Indeed it was not Parts, sorry it is my bad.
>
> I will give parts a close look.
>
> Best Regards,
> Yanghao
>
> On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com> wrote:
> > If the namespace object in parts helps you with the import export fixes
> you
> > would like to make. Please feel free you use it/tweak it make this happen
> >
> > Jason
> > ________________________________
> > From: Scons-users <scons-users-***@scons.org> on behalf of Bill
> Deegan
> > <***@baddogconsulting.com>
> > Sent: Wednesday, February 21, 2018 2:35 PM
> > To: SCons users mailing list
> > Subject: Re: [Scons-users] Provide default Import to SConscript
> >
> > Yangao,
> >
> > Please keep us up to date with your efforts.
> > Take a look at our developer guide, any such would need docs and tests
> to be
> > considered for inclusion to SCons, and any major changes would have to
> have
> > support of the community.
> >
> > I don't have any time or energy to contribute, I'm working on some core
> > SCons logic that requires all the time I have available.
> >
> > -Bill
> > SCons Project Co-Manager
> >
> >
> > On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
> > wrote:
> >
> >
> >
> > On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >
> > Hi Bill,
> >
> >> SCons is meant to be a python based make replacement.
> >
> > This is actually very much not true.
> >
> >
> > From the scons.or website:
> > "SCons is an Open Source software construction tool—that is, a
> > next-generation build tool. Think of SCons as an improved, cross-platform
> > substitute for the classic Make utility with integrated functionality
> > similar to autoconf/automake and compiler caches such as ccache. In
> short,
> > SCons is an easier, more reliable and faster way to build software."
> >
> >
> > Make is really just dispatching
> > commands/keeping track of dependencies and timestamps ... it does not
> > provide any Scons Tools libraries etc. In my view somehow scons is
> > stuck in the middle of "Make" and a comprehensive build framework like
> > "Kbuild", more accurate, yet more difficult compared to pure Make for
> > small things, and yet again more difficult compared to full-fledged
> > build system due to the lack of a common build framework.
> >
> >
> >
> >
> > How much time are you willing to commit to development and ongoing
> support
> > of your changes?
> >
> >
> >
> >> What your suggesting is probably more along the lines of Parts? (Jason)
> >> (Which is build on top of SCons).
> >
> > I think I saw parts project quite some time ago on company intranet
> > ... , but wasn't really what I wanted. I want a single super repo for
> > everything a project requires, as compared to be able to build
> > independent small things and then stitch them together. Kbuild is
> > really what I wanted, kbuild would be perfect if it is build on top of
> > python instead of those eye-hurting shell script ... so I setup and
> > build a extremely similar (even better in many ways such as
> > inter-configuration dependencies) thing in python/scons (only took a
> > few days for the very first working version).
> >
> >> So if I understand properly, you want to add an alternative version of
> >> SConscript where the files would be presented and entirely different set
> >> of
> >> globals to work with?
> >
> > Yes, exactly. to bring SConscript from stone-age to industrial-age,
> > and yet still allow you to use chisel if you insist ... :)
> >
> >
> > That's nice. Good luck with your efforts.
> >
> >
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://eur01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%
> 2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%
> 7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=
> ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://eur01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%
> 2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%
> 7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=
> ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>


--
Gary
Jason Kenny
2018-02-23 15:12:38 UTC
Permalink
I know of Case 2)

Do you have an example of case 1)?

Jason
________________________________
From: Scons-users <scons-users-***@scons.org> on behalf of Gary Oberbrunner <***@oberbrunner.com>
Sent: Friday, February 23, 2018 8:42 AM
To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

In case folks don't know this, here are two ways to get symbols into the namespace that SConscripts start with:
1. Add them to SCons.Script (which is automatically imported into all SConscripts)
2. Put them in site_init/site_scons.py

The site init file logic (in src/engine/SCons/Script/Main.py) prepends site_scons to sys.path, imports site_init.py into the SCons.Script namespace, as well as prepending site_scons/site_tools to the default tool path.

Also note that in any Python file you can do 'import SCons.Script' and use standard SCons functions like File, Dir, Program, etc.

On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
No problem,

If you have any question.. want updated links to it etc.. just let me know. Also as Bill said.. feel free to "steal" any code in Parts to help you with your improvement to SCons.

Best of luck!
Jason
________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Hua Yanghao <***@gmail.com<mailto:***@gmail.com>>
Sent: Wednesday, February 21, 2018 3:29 PM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Hi Jason,
Indeed it was not Parts, sorry it is my bad.

I will give parts a close look.

Best Regards,
Yanghao

On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
> If the namespace object in parts helps you with the import export fixes you
> would like to make. Please feel free you use it/tweak it make this happen
>
> Jason
> ________________________________
> From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Bill Deegan
> <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> Sent: Wednesday, February 21, 2018 2:35 PM
> To: SCons users mailing list
> Subject: Re: [Scons-users] Provide default Import to SConscript
>
> Yangao,
>
> Please keep us up to date with your efforts.
> Take a look at our developer guide, any such would need docs and tests to be
> considered for inclusion to SCons, and any major changes would have to have
> support of the community.
>
> I don't have any time or energy to contribute, I'm working on some core
> SCons logic that requires all the time I have available.
>
> -Bill
> SCons Project Co-Manager
>
>
> On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> wrote:
>
>
>
> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com<mailto:***@gmail.com>> wrote:
>
> Hi Bill,
>
>> SCons is meant to be a python based make replacement.
>
> This is actually very much not true.
>
>
> From the scons.or website:
> "SCons is an Open Source software construction tool—that is, a
> next-generation build tool. Think of SCons as an improved, cross-platform
> substitute for the classic Make utility with integrated functionality
> similar to autoconf/automake and compiler caches such as ccache. In short,
> SCons is an easier, more reliable and faster way to build software."
>
>
> Make is really just dispatching
> commands/keeping track of dependencies and timestamps ... it does not
> provide any Scons Tools libraries etc. In my view somehow scons is
> stuck in the middle of "Make" and a comprehensive build framework like
> "Kbuild", more accurate, yet more difficult compared to pure Make for
> small things, and yet again more difficult compared to full-fledged
> build system due to the lack of a common build framework.
>
>
>
>
> How much time are you willing to commit to development and ongoing support
> of your changes?
>
>
>
>> What your suggesting is probably more along the lines of Parts? (Jason)
>> (Which is build on top of SCons).
>
> I think I saw parts project quite some time ago on company intranet
> ... , but wasn't really what I wanted. I want a single super repo for
> everything a project requires, as compared to be able to build
> independent small things and then stitch them together. Kbuild is
> really what I wanted, kbuild would be perfect if it is build on top of
> python instead of those eye-hurting shell script ... so I setup and
> build a extremely similar (even better in many ways such as
> inter-configuration dependencies) thing in python/scons (only took a
> few days for the very first working version).
>
>> So if I understand properly, you want to add an alternative version of
>> SConscript where the files would be presented and entirely different set
>> of
>> globals to work with?
>
> Yes, exactly. to bring SConscript from stone-age to industrial-age,
> and yet still allow you to use chisel if you insist ... :)
>
>
> That's nice. Good luck with your efforts.
>
>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org<mailto:Scons-***@scons.org>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0

_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C50b78035f9534ba785ea08d57acbb4ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549937679663269&sdata=9%2Fm7jsbf1xgXjLgNQI3mueFHxJy6IUhHNloIHoZj8vI%3D&reserved=0>




--
Gary
Bill Deegan
2018-02-23 15:31:20 UTC
Permalink
import SCons.Script

def something(...)

SCons.SCript.Something = something



On Fri, Feb 23, 2018 at 10:12 AM, Jason Kenny <***@live.com> wrote:

> I know of Case 2)
>
> Do you have an example of case 1)?
>
> Jason
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Gary
> Oberbrunner <***@oberbrunner.com>
> *Sent:* Friday, February 23, 2018 8:42 AM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> In case folks don't know this, here are two ways to get symbols into the
> namespace that SConscripts start with:
> 1. Add them to SCons.Script (which is automatically imported into all
> SConscripts)
> 2. Put them in site_init/site_scons.py
>
> The site init file logic (in src/engine/SCons/Script/Main.py) prepends
> site_scons to sys.path, imports site_init.py into the SCons.Script
> namespace, as well as prepending site_scons/site_tools to the default tool
> path.
>
> Also note that in any Python file you can do 'import SCons.Script' and use
> standard SCons functions like File, Dir, Program, etc.
>
> On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com> wrote:
>
> No problem,
>
> If you have any question.. want updated links to it etc.. just let me
> know. Also as Bill said.. feel free to "steal" any code in Parts to help
> you with your improvement to SCons.
>
> Best of luck!
> Jason
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Hua
> Yanghao <***@gmail.com>
> *Sent:* Wednesday, February 21, 2018 3:29 PM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> Hi Jason,
> Indeed it was not Parts, sorry it is my bad.
>
> I will give parts a close look.
>
> Best Regards,
> Yanghao
>
> On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com> wrote:
> > If the namespace object in parts helps you with the import export fixes
> you
> > would like to make. Please feel free you use it/tweak it make this happen
> >
> > Jason
> > ________________________________
> > From: Scons-users <scons-users-***@scons.org> on behalf of Bill
> Deegan
> > <***@baddogconsulting.com>
> > Sent: Wednesday, February 21, 2018 2:35 PM
> > To: SCons users mailing list
> > Subject: Re: [Scons-users] Provide default Import to SConscript
> >
> > Yangao,
> >
> > Please keep us up to date with your efforts.
> > Take a look at our developer guide, any such would need docs and tests
> to be
> > considered for inclusion to SCons, and any major changes would have to
> have
> > support of the community.
> >
> > I don't have any time or energy to contribute, I'm working on some core
> > SCons logic that requires all the time I have available.
> >
> > -Bill
> > SCons Project Co-Manager
> >
> >
> > On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
> > wrote:
> >
> >
> >
> > On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >
> > Hi Bill,
> >
> >> SCons is meant to be a python based make replacement.
> >
> > This is actually very much not true.
> >
> >
> > From the scons.or website:
> > "SCons is an Open Source software construction tool—that is, a
> > next-generation build tool. Think of SCons as an improved, cross-platform
> > substitute for the classic Make utility with integrated functionality
> > similar to autoconf/automake and compiler caches such as ccache. In
> short,
> > SCons is an easier, more reliable and faster way to build software."
> >
> >
> > Make is really just dispatching
> > commands/keeping track of dependencies and timestamps ... it does not
> > provide any Scons Tools libraries etc. In my view somehow scons is
> > stuck in the middle of "Make" and a comprehensive build framework like
> > "Kbuild", more accurate, yet more difficult compared to pure Make for
> > small things, and yet again more difficult compared to full-fledged
> > build system due to the lack of a common build framework.
> >
> >
> >
> >
> > How much time are you willing to commit to development and ongoing
> support
> > of your changes?
> >
> >
> >
> >> What your suggesting is probably more along the lines of Parts? (Jason)
> >> (Which is build on top of SCons).
> >
> > I think I saw parts project quite some time ago on company intranet
> > ... , but wasn't really what I wanted. I want a single super repo for
> > everything a project requires, as compared to be able to build
> > independent small things and then stitch them together. Kbuild is
> > really what I wanted, kbuild would be perfect if it is build on top of
> > python instead of those eye-hurting shell script ... so I setup and
> > build a extremely similar (even better in many ways such as
> > inter-configuration dependencies) thing in python/scons (only took a
> > few days for the very first working version).
> >
> >> So if I understand properly, you want to add an alternative version of
> >> SConscript where the files would be presented and entirely different set
> >> of
> >> globals to work with?
> >
> > Yes, exactly. to bring SConscript from stone-age to industrial-age,
> > and yet still allow you to use chisel if you insist ... :)
> >
> >
> > That's nice. Good luck with your efforts.
> >
> >
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://eur01.safelinks.protection.outlook.com/?url=https%
> 3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-
> users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C8
> 4df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%
> 2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://eur01.safelinks.protection.outlook.com/?url=https%
> 3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-
> users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C8
> 4df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%
> 2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C50b78035f9534ba785ea08d57acbb4ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549937679663269&sdata=9%2Fm7jsbf1xgXjLgNQI3mueFHxJy6IUhHNloIHoZj8vI%3D&reserved=0>
>
>
>
>
> --
> Gary
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
Jason Kenny
2018-02-23 16:06:13 UTC
Permalink
This is a little terse 😊

How does this file get loaded... is this case 2)? Add it to the site_init?

I am asking as it would be nice if Parts could add a file someplace that would be loaded when SCons starts up, instead of importing Parts directly in the SConstruct.

Jason


________________________________
From: Scons-users <scons-users-***@scons.org> on behalf of Bill Deegan <***@baddogconsulting.com>
Sent: Friday, February 23, 2018 9:31 AM
To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

import SCons.Script

def something(...)

SCons.SCript.Something = something



On Fri, Feb 23, 2018 at 10:12 AM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
I know of Case 2)

Do you have an example of case 1)?

Jason
________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Gary Oberbrunner <***@oberbrunner.com<mailto:***@oberbrunner.com>>
Sent: Friday, February 23, 2018 8:42 AM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

In case folks don't know this, here are two ways to get symbols into the namespace that SConscripts start with:
1. Add them to SCons.Script (which is automatically imported into all SConscripts)
2. Put them in site_init/site_scons.py

The site init file logic (in src/engine/SCons/Script/Main.py) prepends site_scons to sys.path, imports site_init.py into the SCons.Script namespace, as well as prepending site_scons/site_tools to the default tool path.

Also note that in any Python file you can do 'import SCons.Script' and use standard SCons functions like File, Dir, Program, etc.

On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
No problem,

If you have any question.. want updated links to it etc.. just let me know. Also as Bill said.. feel free to "steal" any code in Parts to help you with your improvement to SCons.

Best of luck!
Jason
________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Hua Yanghao <***@gmail.com<mailto:***@gmail.com>>
Sent: Wednesday, February 21, 2018 3:29 PM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Hi Jason,
Indeed it was not Parts, sorry it is my bad.

I will give parts a close look.

Best Regards,
Yanghao

On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
> If the namespace object in parts helps you with the import export fixes you
> would like to make. Please feel free you use it/tweak it make this happen
>
> Jason
> ________________________________
> From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Bill Deegan
> <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> Sent: Wednesday, February 21, 2018 2:35 PM
> To: SCons users mailing list
> Subject: Re: [Scons-users] Provide default Import to SConscript
>
> Yangao,
>
> Please keep us up to date with your efforts.
> Take a look at our developer guide, any such would need docs and tests to be
> considered for inclusion to SCons, and any major changes would have to have
> support of the community.
>
> I don't have any time or energy to contribute, I'm working on some core
> SCons logic that requires all the time I have available.
>
> -Bill
> SCons Project Co-Manager
>
>
> On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> wrote:
>
>
>
> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com<mailto:***@gmail.com>> wrote:
>
> Hi Bill,
>
>> SCons is meant to be a python based make replacement.
>
> This is actually very much not true.
>
>
> From the scons.or website:
> "SCons is an Open Source software construction tool—that is, a
> next-generation build tool. Think of SCons as an improved, cross-platform
> substitute for the classic Make utility with integrated functionality
> similar to autoconf/automake and compiler caches such as ccache. In short,
> SCons is an easier, more reliable and faster way to build software."
>
>
> Make is really just dispatching
> commands/keeping track of dependencies and timestamps ... it does not
> provide any Scons Tools libraries etc. In my view somehow scons is
> stuck in the middle of "Make" and a comprehensive build framework like
> "Kbuild", more accurate, yet more difficult compared to pure Make for
> small things, and yet again more difficult compared to full-fledged
> build system due to the lack of a common build framework.
>
>
>
>
> How much time are you willing to commit to development and ongoing support
> of your changes?
>
>
>
>> What your suggesting is probably more along the lines of Parts? (Jason)
>> (Which is build on top of SCons).
>
> I think I saw parts project quite some time ago on company intranet
> ... , but wasn't really what I wanted. I want a single super repo for
> everything a project requires, as compared to be able to build
> independent small things and then stitch them together. Kbuild is
> really what I wanted, kbuild would be perfect if it is build on top of
> python instead of those eye-hurting shell script ... so I setup and
> build a extremely similar (even better in many ways such as
> inter-configuration dependencies) thing in python/scons (only took a
> few days for the very first working version).
>
>> So if I understand properly, you want to add an alternative version of
>> SConscript where the files would be presented and entirely different set
>> of
>> globals to work with?
>
> Yes, exactly. to bring SConscript from stone-age to industrial-age,
> and yet still allow you to use chisel if you insist ... :)
>
>
> That's nice. Good luck with your efforts.
>
>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org<mailto:Scons-***@scons.org>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0

_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C50b78035f9534ba785ea08d57acbb4ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549937679663269&sdata=9%2Fm7jsbf1xgXjLgNQI3mueFHxJy6IUhHNloIHoZj8vI%3D&reserved=0>




--
Gary

_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C8d95978350a0445b925c08d57ad281b9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549966888805701&sdata=RO%2FWM3orKI8jNhnCbdT%2BNT9wx0GoCgqsvjosAPm8g44%3D&reserved=0>
Bill Deegan
2018-02-23 16:42:44 UTC
Permalink
You asked for example to #1.
So you could put in your SConstruct, SConscript before whatever is
referenced, or in your site_init

For Parts:
import Parts
import SCons.Script
SCons.Script.Parts=Parts

should work?

On Fri, Feb 23, 2018 at 11:06 AM, Jason Kenny <***@live.com> wrote:

> This is a little terse 😊
>
> How does this file get loaded... is this case 2)? Add it to the site_init?
>
> I am asking as it would be nice if Parts could add a file someplace that
> would be loaded when SCons starts up, instead of importing Parts directly
> in the SConstruct.
>
> Jason
>
>
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Bill
> Deegan <***@baddogconsulting.com>
> *Sent:* Friday, February 23, 2018 9:31 AM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> import SCons.Script
>
> def something(...)
>
> SCons.SCript.Something = something
>
>
>
> On Fri, Feb 23, 2018 at 10:12 AM, Jason Kenny <***@live.com> wrote:
>
> I know of Case 2)
>
> Do you have an example of case 1)?
>
> Jason
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Gary
> Oberbrunner <***@oberbrunner.com>
> *Sent:* Friday, February 23, 2018 8:42 AM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> In case folks don't know this, here are two ways to get symbols into the
> namespace that SConscripts start with:
> 1. Add them to SCons.Script (which is automatically imported into all
> SConscripts)
> 2. Put them in site_init/site_scons.py
>
> The site init file logic (in src/engine/SCons/Script/Main.py) prepends
> site_scons to sys.path, imports site_init.py into the SCons.Script
> namespace, as well as prepending site_scons/site_tools to the default tool
> path.
>
> Also note that in any Python file you can do 'import SCons.Script' and use
> standard SCons functions like File, Dir, Program, etc.
>
> On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com> wrote:
>
> No problem,
>
> If you have any question.. want updated links to it etc.. just let me
> know. Also as Bill said.. feel free to "steal" any code in Parts to help
> you with your improvement to SCons.
>
> Best of luck!
> Jason
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Hua
> Yanghao <***@gmail.com>
> *Sent:* Wednesday, February 21, 2018 3:29 PM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> Hi Jason,
> Indeed it was not Parts, sorry it is my bad.
>
> I will give parts a close look.
>
> Best Regards,
> Yanghao
>
> On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com> wrote:
> > If the namespace object in parts helps you with the import export fixes
> you
> > would like to make. Please feel free you use it/tweak it make this happen
> >
> > Jason
> > ________________________________
> > From: Scons-users <scons-users-***@scons.org> on behalf of Bill
> Deegan
> > <***@baddogconsulting.com>
> > Sent: Wednesday, February 21, 2018 2:35 PM
> > To: SCons users mailing list
> > Subject: Re: [Scons-users] Provide default Import to SConscript
> >
> > Yangao,
> >
> > Please keep us up to date with your efforts.
> > Take a look at our developer guide, any such would need docs and tests
> to be
> > considered for inclusion to SCons, and any major changes would have to
> have
> > support of the community.
> >
> > I don't have any time or energy to contribute, I'm working on some core
> > SCons logic that requires all the time I have available.
> >
> > -Bill
> > SCons Project Co-Manager
> >
> >
> > On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
> > wrote:
> >
> >
> >
> > On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >
> > Hi Bill,
> >
> >> SCons is meant to be a python based make replacement.
> >
> > This is actually very much not true.
> >
> >
> > From the scons.or website:
> > "SCons is an Open Source software construction tool—that is, a
> > next-generation build tool. Think of SCons as an improved, cross-platform
> > substitute for the classic Make utility with integrated functionality
> > similar to autoconf/automake and compiler caches such as ccache. In
> short,
> > SCons is an easier, more reliable and faster way to build software."
> >
> >
> > Make is really just dispatching
> > commands/keeping track of dependencies and timestamps ... it does not
> > provide any Scons Tools libraries etc. In my view somehow scons is
> > stuck in the middle of "Make" and a comprehensive build framework like
> > "Kbuild", more accurate, yet more difficult compared to pure Make for
> > small things, and yet again more difficult compared to full-fledged
> > build system due to the lack of a common build framework.
> >
> >
> >
> >
> > How much time are you willing to commit to development and ongoing
> support
> > of your changes?
> >
> >
> >
> >> What your suggesting is probably more along the lines of Parts? (Jason)
> >> (Which is build on top of SCons).
> >
> > I think I saw parts project quite some time ago on company intranet
> > ... , but wasn't really what I wanted. I want a single super repo for
> > everything a project requires, as compared to be able to build
> > independent small things and then stitch them together. Kbuild is
> > really what I wanted, kbuild would be perfect if it is build on top of
> > python instead of those eye-hurting shell script ... so I setup and
> > build a extremely similar (even better in many ways such as
> > inter-configuration dependencies) thing in python/scons (only took a
> > few days for the very first working version).
> >
> >> So if I understand properly, you want to add an alternative version of
> >> SConscript where the files would be presented and entirely different set
> >> of
> >> globals to work with?
> >
> > Yes, exactly. to bring SConscript from stone-age to industrial-age,
> > and yet still allow you to use chisel if you insist ... :)
> >
> >
> > That's nice. Good luck with your efforts.
> >
> >
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A
> %2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&
> data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7
> fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&
> sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://eur01.safelinks.protection.outlook.com/?url=https%3A
> %2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&
> data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7
> fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&
> sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C50b78035f9534ba785ea08d57acbb4ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549937679663269&sdata=9%2Fm7jsbf1xgXjLgNQI3mueFHxJy6IUhHNloIHoZj8vI%3D&reserved=0>
>
>
>
>
> --
> Gary
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C8d95978350a0445b925c08d57ad281b9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549966888805701&sdata=RO%2FWM3orKI8jNhnCbdT%2BNT9wx0GoCgqsvjosAPm8g44%3D&reserved=0>
>
>
>
Jason Kenny
2018-02-23 17:41:22 UTC
Permalink
to clarify I get stuff in via:

SConstruct:
from part import *
...

I know I could have a file in the site_init in the same directory as the SConstruct and run and that will run. No one wants to set this up manually
I forget if we allow more than one location for the site_init. I was hoping more for a place when Parts is installed it can place a file. If that could happen I would like to add a UsePartsExtension() function to control if Parts is used as part of the build or not

Maybe this should be a different talk about allowing users to install and register an extension to SCons

Jason
________________________________
From: Bill Deegan <***@baddogconsulting.com>
Sent: Friday, February 23, 2018 10:42 AM
To: Jason Kenny
Cc: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

You asked for example to #1.
So you could put in your SConstruct, SConscript before whatever is referenced, or in your site_init

For Parts:
import Parts
import SCons.Script
SCons.Script.Parts=Parts

should work?

On Fri, Feb 23, 2018 at 11:06 AM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
This is a little terse 😊

How does this file get loaded... is this case 2)? Add it to the site_init?

I am asking as it would be nice if Parts could add a file someplace that would be loaded when SCons starts up, instead of importing Parts directly in the SConstruct.

Jason


________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
Sent: Friday, February 23, 2018 9:31 AM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

import SCons.Script

def something(...)

SCons.SCript.Something = something



On Fri, Feb 23, 2018 at 10:12 AM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
I know of Case 2)

Do you have an example of case 1)?

Jason
________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Gary Oberbrunner <***@oberbrunner.com<mailto:***@oberbrunner.com>>
Sent: Friday, February 23, 2018 8:42 AM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

In case folks don't know this, here are two ways to get symbols into the namespace that SConscripts start with:
1. Add them to SCons.Script (which is automatically imported into all SConscripts)
2. Put them in site_init/site_scons.py

The site init file logic (in src/engine/SCons/Script/Main.py) prepends site_scons to sys.path, imports site_init.py into the SCons.Script namespace, as well as prepending site_scons/site_tools to the default tool path.

Also note that in any Python file you can do 'import SCons.Script' and use standard SCons functions like File, Dir, Program, etc.

On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
No problem,

If you have any question.. want updated links to it etc.. just let me know. Also as Bill said.. feel free to "steal" any code in Parts to help you with your improvement to SCons.

Best of luck!
Jason
________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Hua Yanghao <***@gmail.com<mailto:***@gmail.com>>
Sent: Wednesday, February 21, 2018 3:29 PM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Hi Jason,
Indeed it was not Parts, sorry it is my bad.

I will give parts a close look.

Best Regards,
Yanghao

On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
> If the namespace object in parts helps you with the import export fixes you
> would like to make. Please feel free you use it/tweak it make this happen
>
> Jason
> ________________________________
> From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Bill Deegan
> <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> Sent: Wednesday, February 21, 2018 2:35 PM
> To: SCons users mailing list
> Subject: Re: [Scons-users] Provide default Import to SConscript
>
> Yangao,
>
> Please keep us up to date with your efforts.
> Take a look at our developer guide, any such would need docs and tests to be
> considered for inclusion to SCons, and any major changes would have to have
> support of the community.
>
> I don't have any time or energy to contribute, I'm working on some core
> SCons logic that requires all the time I have available.
>
> -Bill
> SCons Project Co-Manager
>
>
> On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> wrote:
>
>
>
> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com<mailto:***@gmail.com>> wrote:
>
> Hi Bill,
>
>> SCons is meant to be a python based make replacement.
>
> This is actually very much not true.
>
>
> From the scons.or website:
> "SCons is an Open Source software construction tool—that is, a
> next-generation build tool. Think of SCons as an improved, cross-platform
> substitute for the classic Make utility with integrated functionality
> similar to autoconf/automake and compiler caches such as ccache. In short,
> SCons is an easier, more reliable and faster way to build software."
>
>
> Make is really just dispatching
> commands/keeping track of dependencies and timestamps ... it does not
> provide any Scons Tools libraries etc. In my view somehow scons is
> stuck in the middle of "Make" and a comprehensive build framework like
> "Kbuild", more accurate, yet more difficult compared to pure Make for
> small things, and yet again more difficult compared to full-fledged
> build system due to the lack of a common build framework.
>
>
>
>
> How much time are you willing to commit to development and ongoing support
> of your changes?
>
>
>
>> What your suggesting is probably more along the lines of Parts? (Jason)
>> (Which is build on top of SCons).
>
> I think I saw parts project quite some time ago on company intranet
> ... , but wasn't really what I wanted. I want a single super repo for
> everything a project requires, as compared to be able to build
> independent small things and then stitch them together. Kbuild is
> really what I wanted, kbuild would be perfect if it is build on top of
> python instead of those eye-hurting shell script ... so I setup and
> build a extremely similar (even better in many ways such as
> inter-configuration dependencies) thing in python/scons (only took a
> few days for the very first working version).
>
>> So if I understand properly, you want to add an alternative version of
>> SConscript where the files would be presented and entirely different set
>> of
>> globals to work with?
>
> Yes, exactly. to bring SConscript from stone-age to industrial-age,
> and yet still allow you to use chisel if you insist ... :)
>
>
> That's nice. Good luck with your efforts.
>
>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org<mailto:Scons-***@scons.org>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0

_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C50b78035f9534ba785ea08d57acbb4ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549937679663269&sdata=9%2Fm7jsbf1xgXjLgNQI3mueFHxJy6IUhHNloIHoZj8vI%3D&reserved=0>




--
Gary

_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C8d95978350a0445b925c08d57ad281b9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549966888805701&sdata=RO%2FWM3orKI8jNhnCbdT%2BNT9wx0GoCgqsvjosAPm8g44%3D&reserved=0>
Bill Deegan
2018-02-23 17:48:26 UTC
Permalink
Re multiple site_dirs..
Go look at http://scons.org/doc/production/HTML/scons-man.html seach for
--site-dir.

For posix systems (excluding win, macos, solaris.. see manpage for those)
here's the defaults:

/usr/share/scons/site_scons
$HOME/.scons/site_scons
./site_scons


I think this falls under current email subject.

Do you currently need to add UsePartsExtention() in each SConscript? Or can
you call it once?

-Bill

On Fri, Feb 23, 2018 at 12:41 PM, Jason Kenny <***@live.com> wrote:

> to clarify I get stuff in via:
>
> SConstruct:
> from part import *
> ...
>
> I know I could have a file in the site_init in the same directory as the
> SConstruct and run and that will run. No one wants to set this up manually
> I forget if we allow more than one location for the site_init. I was
> hoping more for a place when Parts is installed it can place a file. If
> that could happen I would like to add a UsePartsExtension() function to
> control if Parts is used as part of the build or not
>
> Maybe this should be a different talk about allowing users to install and
> register an extension to SCons
>
> Jason
> ------------------------------
> *From:* Bill Deegan <***@baddogconsulting.com>
> *Sent:* Friday, February 23, 2018 10:42 AM
> *To:* Jason Kenny
> *Cc:* SCons users mailing list
>
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> You asked for example to #1.
> So you could put in your SConstruct, SConscript before whatever is
> referenced, or in your site_init
>
> For Parts:
> import Parts
> import SCons.Script
> SCons.Script.Parts=Parts
>
> should work?
>
> On Fri, Feb 23, 2018 at 11:06 AM, Jason Kenny <***@live.com> wrote:
>
> This is a little terse 😊
>
> How does this file get loaded... is this case 2)? Add it to the site_init?
>
> I am asking as it would be nice if Parts could add a file someplace that
> would be loaded when SCons starts up, instead of importing Parts directly
> in the SConstruct.
>
> Jason
>
>
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Bill
> Deegan <***@baddogconsulting.com>
> *Sent:* Friday, February 23, 2018 9:31 AM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> import SCons.Script
>
> def something(...)
>
> SCons.SCript.Something = something
>
>
>
> On Fri, Feb 23, 2018 at 10:12 AM, Jason Kenny <***@live.com> wrote:
>
> I know of Case 2)
>
> Do you have an example of case 1)?
>
> Jason
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Gary
> Oberbrunner <***@oberbrunner.com>
> *Sent:* Friday, February 23, 2018 8:42 AM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> In case folks don't know this, here are two ways to get symbols into the
> namespace that SConscripts start with:
> 1. Add them to SCons.Script (which is automatically imported into all
> SConscripts)
> 2. Put them in site_init/site_scons.py
>
> The site init file logic (in src/engine/SCons/Script/Main.py) prepends
> site_scons to sys.path, imports site_init.py into the SCons.Script
> namespace, as well as prepending site_scons/site_tools to the default tool
> path.
>
> Also note that in any Python file you can do 'import SCons.Script' and use
> standard SCons functions like File, Dir, Program, etc.
>
> On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com> wrote:
>
> No problem,
>
> If you have any question.. want updated links to it etc.. just let me
> know. Also as Bill said.. feel free to "steal" any code in Parts to help
> you with your improvement to SCons.
>
> Best of luck!
> Jason
> ------------------------------
> *From:* Scons-users <scons-users-***@scons.org> on behalf of Hua
> Yanghao <***@gmail.com>
> *Sent:* Wednesday, February 21, 2018 3:29 PM
>
> *To:* SCons users mailing list
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
> Hi Jason,
> Indeed it was not Parts, sorry it is my bad.
>
> I will give parts a close look.
>
> Best Regards,
> Yanghao
>
> On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com> wrote:
> > If the namespace object in parts helps you with the import export fixes
> you
> > would like to make. Please feel free you use it/tweak it make this happen
> >
> > Jason
> > ________________________________
> > From: Scons-users <scons-users-***@scons.org> on behalf of Bill
> Deegan
> > <***@baddogconsulting.com>
> > Sent: Wednesday, February 21, 2018 2:35 PM
> > To: SCons users mailing list
> > Subject: Re: [Scons-users] Provide default Import to SConscript
> >
> > Yangao,
> >
> > Please keep us up to date with your efforts.
> > Take a look at our developer guide, any such would need docs and tests
> to be
> > considered for inclusion to SCons, and any major changes would have to
> have
> > support of the community.
> >
> > I don't have any time or energy to contribute, I'm working on some core
> > SCons logic that requires all the time I have available.
> >
> > -Bill
> > SCons Project Co-Manager
> >
> >
> > On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
> > wrote:
> >
> >
> >
> > On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com>
> wrote:
> >
> > Hi Bill,
> >
> >> SCons is meant to be a python based make replacement.
> >
> > This is actually very much not true.
> >
> >
> > From the scons.or website:
> > "SCons is an Open Source software construction tool—that is, a
> > next-generation build tool. Think of SCons as an improved, cross-platform
> > substitute for the classic Make utility with integrated functionality
> > similar to autoconf/automake and compiler caches such as ccache. In
> short,
> > SCons is an easier, more reliable and faster way to build software."
> >
> >
> > Make is really just dispatching
> > commands/keeping track of dependencies and timestamps ... it does not
> > provide any Scons Tools libraries etc. In my view somehow scons is
> > stuck in the middle of "Make" and a comprehensive build framework like
> > "Kbuild", more accurate, yet more difficult compared to pure Make for
> > small things, and yet again more difficult compared to full-fledged
> > build system due to the lack of a common build framework.
> >
> >
> >
> >
> > How much time are you willing to commit to development and ongoing
> support
> > of your changes?
> >
> >
> >
> >> What your suggesting is probably more along the lines of Parts? (Jason)
> >> (Which is build on top of SCons).
> >
> > I think I saw parts project quite some time ago on company intranet
> > ... , but wasn't really what I wanted. I want a single super repo for
> > everything a project requires, as compared to be able to build
> > independent small things and then stitch them together. Kbuild is
> > really what I wanted, kbuild would be perfect if it is build on top of
> > python instead of those eye-hurting shell script ... so I setup and
> > build a extremely similar (even better in many ways such as
> > inter-configuration dependencies) thing in python/scons (only took a
> > few days for the very first working version).
> >
> >> So if I understand properly, you want to add an alternative version of
> >> SConscript where the files would be presented and entirely different set
> >> of
> >> globals to work with?
> >
> > Yes, exactly. to bring SConscript from stone-age to industrial-age,
> > and yet still allow you to use chisel if you insist ... :)
> >
> >
> > That's nice. Good luck with your efforts.
> >
> >
> >
> >
> >
> > _______________________________________________
> > Scons-users mailing list
> > Scons-***@scons.org
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A
> %2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&
> data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7
> fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata
> =ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
> >
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://eur01.safelinks.protection.outlook.com/?url=https%3A
> %2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&
> data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7
> fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata
> =ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C50b78035f9534ba785ea08d57acbb4ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549937679663269&sdata=9%2Fm7jsbf1xgXjLgNQI3mueFHxJy6IUhHNloIHoZj8vI%3D&reserved=0>
>
>
>
>
> --
> Gary
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C8d95978350a0445b925c08d57ad281b9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549966888805701&sdata=RO%2FWM3orKI8jNhnCbdT%2BNT9wx0GoCgqsvjosAPm8g44%3D&reserved=0>
>
>
>
>
Jason Kenny
2018-02-23 18:45:36 UTC
Permalink
I don't need to add it at the moment ( the import works as is). I think it would be a good extension to have. Parts, for example, will be adding coloring, and change the way tools load. Some people may not want to have these items added, plus I could break something that did work ( such as they define there own --target switch). Having the ability let user control if the Scontruct is using an extension I think will be critical for having a strong user environment. I can add a function in Parts to control loading parts. however, I think it would be good to have such a design in core SCons.

Jason
________________________________
From: Bill Deegan <***@baddogconsulting.com>
Sent: Friday, February 23, 2018 11:48 AM
To: Jason Kenny
Cc: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Re multiple site_dirs..
Go look at http://scons.org/doc/production/HTML/scons-man.html<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fscons.org%2Fdoc%2Fproduction%2FHTML%2Fscons-man.html&data=02%7C01%7C%7Cf09f4aa1049d46f390f108d57ae5a50e%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636550049083752823&sdata=uymx9lFCPAzFfWg3Zhv9YxM0BYzNXbUnFlwck9nLO5Q%3D&reserved=0> seach for --site-dir.

For posix systems (excluding win, macos, solaris.. see manpage for those) here's the defaults:

/usr/share/scons/site_scons
$HOME/.scons/site_scons
./site_scons

I think this falls under current email subject.

Do you currently need to add UsePartsExtention() in each SConscript? Or can you call it once?

-Bill

On Fri, Feb 23, 2018 at 12:41 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
to clarify I get stuff in via:

SConstruct:
from part import *
...

I know I could have a file in the site_init in the same directory as the SConstruct and run and that will run. No one wants to set this up manually
I forget if we allow more than one location for the site_init. I was hoping more for a place when Parts is installed it can place a file. If that could happen I would like to add a UsePartsExtension() function to control if Parts is used as part of the build or not

Maybe this should be a different talk about allowing users to install and register an extension to SCons

Jason
________________________________
From: Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
Sent: Friday, February 23, 2018 10:42 AM
To: Jason Kenny
Cc: SCons users mailing list

Subject: Re: [Scons-users] Provide default Import to SConscript

You asked for example to #1.
So you could put in your SConstruct, SConscript before whatever is referenced, or in your site_init

For Parts:
import Parts
import SCons.Script
SCons.Script.Parts=Parts

should work?

On Fri, Feb 23, 2018 at 11:06 AM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
This is a little terse 😊

How does this file get loaded... is this case 2)? Add it to the site_init?

I am asking as it would be nice if Parts could add a file someplace that would be loaded when SCons starts up, instead of importing Parts directly in the SConstruct.

Jason


________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
Sent: Friday, February 23, 2018 9:31 AM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

import SCons.Script

def something(...)

SCons.SCript.Something = something



On Fri, Feb 23, 2018 at 10:12 AM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
I know of Case 2)

Do you have an example of case 1)?

Jason
________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Gary Oberbrunner <***@oberbrunner.com<mailto:***@oberbrunner.com>>
Sent: Friday, February 23, 2018 8:42 AM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

In case folks don't know this, here are two ways to get symbols into the namespace that SConscripts start with:
1. Add them to SCons.Script (which is automatically imported into all SConscripts)
2. Put them in site_init/site_scons.py

The site init file logic (in src/engine/SCons/Script/Main.py) prepends site_scons to sys.path, imports site_init.py into the SCons.Script namespace, as well as prepending site_scons/site_tools to the default tool path.

Also note that in any Python file you can do 'import SCons.Script' and use standard SCons functions like File, Dir, Program, etc.

On Wed, Feb 21, 2018 at 4:47 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
No problem,

If you have any question.. want updated links to it etc.. just let me know. Also as Bill said.. feel free to "steal" any code in Parts to help you with your improvement to SCons.

Best of luck!
Jason
________________________________
From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Hua Yanghao <***@gmail.com<mailto:***@gmail.com>>
Sent: Wednesday, February 21, 2018 3:29 PM

To: SCons users mailing list
Subject: Re: [Scons-users] Provide default Import to SConscript

Hi Jason,
Indeed it was not Parts, sorry it is my bad.

I will give parts a close look.

Best Regards,
Yanghao

On Wed, Feb 21, 2018 at 9:53 PM, Jason Kenny <***@live.com<mailto:***@live.com>> wrote:
> If the namespace object in parts helps you with the import export fixes you
> would like to make. Please feel free you use it/tweak it make this happen
>
> Jason
> ________________________________
> From: Scons-users <scons-users-***@scons.org<mailto:scons-users-***@scons.org>> on behalf of Bill Deegan
> <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> Sent: Wednesday, February 21, 2018 2:35 PM
> To: SCons users mailing list
> Subject: Re: [Scons-users] Provide default Import to SConscript
>
> Yangao,
>
> Please keep us up to date with your efforts.
> Take a look at our developer guide, any such would need docs and tests to be
> considered for inclusion to SCons, and any major changes would have to have
> support of the community.
>
> I don't have any time or energy to contribute, I'm working on some core
> SCons logic that requires all the time I have available.
>
> -Bill
> SCons Project Co-Manager
>
>
> On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>>
> wrote:
>
>
>
> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com<mailto:***@gmail.com>> wrote:
>
> Hi Bill,
>
>> SCons is meant to be a python based make replacement.
>
> This is actually very much not true.
>
>
> From the scons.or website:
> "SCons is an Open Source software construction tool—that is, a
> next-generation build tool. Think of SCons as an improved, cross-platform
> substitute for the classic Make utility with integrated functionality
> similar to autoconf/automake and compiler caches such as ccache. In short,
> SCons is an easier, more reliable and faster way to build software."
>
>
> Make is really just dispatching
> commands/keeping track of dependencies and timestamps ... it does not
> provide any Scons Tools libraries etc. In my view somehow scons is
> stuck in the middle of "Make" and a comprehensive build framework like
> "Kbuild", more accurate, yet more difficult compared to pure Make for
> small things, and yet again more difficult compared to full-fledged
> build system due to the lack of a common build framework.
>
>
>
>
> How much time are you willing to commit to development and ongoing support
> of your changes?
>
>
>
>> What your suggesting is probably more along the lines of Parts? (Jason)
>> (Which is build on top of SCons).
>
> I think I saw parts project quite some time ago on company intranet
> ... , but wasn't really what I wanted. I want a single super repo for
> everything a project requires, as compared to be able to build
> independent small things and then stitch them together. Kbuild is
> really what I wanted, kbuild would be perfect if it is build on top of
> python instead of those eye-hurting shell script ... so I setup and
> build a extremely similar (even better in many ways such as
> inter-configuration dependencies) thing in python/scons (only took a
> few days for the very first working version).
>
>> So if I understand properly, you want to add an alternative version of
>> SConscript where the files would be presented and entirely different set
>> of
>> globals to work with?
>
> Yes, exactly. to bring SConscript from stone-age to industrial-age,
> and yet still allow you to use chisel if you insist ... :)
>
>
> That's nice. Good luck with your efforts.
>
>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org<mailto:Scons-***@scons.org>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0
>
_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C71f860a3b33a46f15a2508d579723b02%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636548453874536512&sdata=ukUWX%2Be4Pb9DrdaLM48LQkZp%2FbU5YkQCwKOUeXeOtvs%3D&reserved=0

_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C50b78035f9534ba785ea08d57acbb4ad%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549937679663269&sdata=9%2Fm7jsbf1xgXjLgNQI3mueFHxJy6IUhHNloIHoZj8vI%3D&reserved=0>




--
Gary

_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C8d95978350a0445b925c08d57ad281b9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636549966888805701&sdata=RO%2FWM3orKI8jNhnCbdT%2BNT9wx0GoCgqsvjosAPm8g44%3D&reserved=0>
Hua Yanghao
2018-02-23 18:49:14 UTC
Permalink
Hi Gary,

On Fri, Feb 23, 2018 at 3:42 PM, Gary Oberbrunner <***@oberbrunner.com> wrote:
> In case folks don't know this, here are two ways to get symbols into the
> namespace that SConscripts start with:
> 1. Add them to SCons.Script (which is automatically imported into all
> SConscripts)

This doesn't work for me, I assigned "usw_files" to
SCons.Script.usw_files right before SConscript got called:
import SCons.Script
SCons.Script.usw_files = usw_files
SConscript(...)

and removed the import from one of the SConscript file, I got below error:
Running : ./tools/scons -Q config=configs/qemu_arm_vexpress.py
NameError: name 'usw_files' is not defined:
File "/home/hua/git/usw/SConstruct", line 38:
usw_config(config, usw_target, target_list, verbose=V)
File "/home/hua/git/usw/configs/qemu_arm_vexpress.py", line 176:
main = usw_target(path, "main", "elf", prepend("firmware",
main_list), main_config, output_list, depends=bios,
target_list=target_list, verbose=verbose)
File "/home/hua/git/usw/site_scons/usw_tools.py", line 78:
BuildObjList(env, scons_folder, cwd, build_dir)
File "/home/hua/git/usw/site_scons/common.py", line 86:
env.SConscript(true_scons_file, variant_dir=variant_dir)
File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/SCons/Script/SConscript.py",
line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/SCons/Script/SConscript.py",
line 256:
call_stack[-1].globals)
File "/home/hua/git/usw/build/configs/qemu_arm_vexpress/main/firmware/common/SConscript",
line 6:
usw_files("elf_obj", obj_files)


> 2. Put them in site_init/site_scons.py
> The site init file logic (in src/engine/SCons/Script/Main.py) prepends
> site_scons to sys.path, imports site_init.py into the SCons.Script
> namespace, as well as prepending site_scons/site_tools to the default tool
> path.
>
> Also note that in any Python file you can do 'import SCons.Script' and use
> standard SCons functions like File, Dir, Program, etc.


I tried but failed to use this method, as my usw_files function needs
to be different for different configs. this is partially to
work-around removing the "Return()" part in the SConscript file.If I
have a way to return things implicitly from SConscript file then I can
make usw_files() as a static API which can be put in site_init.py.

I tried to put a dummy function in site_init.py and indeed my
SConscript can see it and call it properly! thanks a lot for the tip.
Do you have any suggestion to make it easier to implement implicit
Return() from SConscript?
Bill Deegan
2018-02-23 20:01:57 UTC
Permalink
Take a look at this:

https://gist.github.com/bdbaddog/1ddedecdfd13f6193c173e511e895b1f

That should work.

Forgot that by the time you're in SConstruct it's too late for this to
work. (Or so it seems)

-Bill

On Fri, Feb 23, 2018 at 1:49 PM, Hua Yanghao <***@gmail.com> wrote:

> Hi Gary,
>
> On Fri, Feb 23, 2018 at 3:42 PM, Gary Oberbrunner <***@oberbrunner.com>
> wrote:
> > In case folks don't know this, here are two ways to get symbols into the
> > namespace that SConscripts start with:
> > 1. Add them to SCons.Script (which is automatically imported into all
> > SConscripts)
>
> This doesn't work for me, I assigned "usw_files" to
> SCons.Script.usw_files right before SConscript got called:
> import SCons.Script
> SCons.Script.usw_files = usw_files
> SConscript(...)
>
> and removed the import from one of the SConscript file, I got below error:
> Running : ./tools/scons -Q config=configs/qemu_arm_vexpress.py
> NameError: name 'usw_files' is not defined:
> File "/home/hua/git/usw/SConstruct", line 38:
> usw_config(config, usw_target, target_list, verbose=V)
> File "/home/hua/git/usw/configs/qemu_arm_vexpress.py", line 176:
> main = usw_target(path, "main", "elf", prepend("firmware",
> main_list), main_config, output_list, depends=bios,
> target_list=target_list, verbose=verbose)
> File "/home/hua/git/usw/site_scons/usw_tools.py", line 78:
> BuildObjList(env, scons_folder, cwd, build_dir)
> File "/home/hua/git/usw/site_scons/common.py", line 86:
> env.SConscript(true_scons_file, variant_dir=variant_dir)
> File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/
> SCons/Script/SConscript.py",
> line 551:
> return _SConscript(self.fs, *files, **subst_kw)
> File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/
> SCons/Script/SConscript.py",
> line 256:
> call_stack[-1].globals)
> File "/home/hua/git/usw/build/configs/qemu_arm_vexpress/
> main/firmware/common/SConscript",
> line 6:
> usw_files("elf_obj", obj_files)
>
>
> > 2. Put them in site_init/site_scons.py
> > The site init file logic (in src/engine/SCons/Script/Main.py) prepends
> > site_scons to sys.path, imports site_init.py into the SCons.Script
> > namespace, as well as prepending site_scons/site_tools to the default
> tool
> > path.
> >
> > Also note that in any Python file you can do 'import SCons.Script' and
> use
> > standard SCons functions like File, Dir, Program, etc.
>
>
> I tried but failed to use this method, as my usw_files function needs
> to be different for different configs. this is partially to
> work-around removing the "Return()" part in the SConscript file.If I
> have a way to return things implicitly from SConscript file then I can
> make usw_files() as a static API which can be put in site_init.py.
>
> I tried to put a dummy function in site_init.py and indeed my
> SConscript can see it and call it properly! thanks a lot for the tip.
> Do you have any suggestion to make it easier to implement implicit
> Return() from SConscript?
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Jason Kenny
2018-02-24 01:07:28 UTC
Permalink
I added a note to the gist

Jason

From: Scons-users [mailto:scons-users-***@scons.org] On Behalf Of Bill Deegan
Sent: Friday, February 23, 2018 2:02 PM
To: SCons users mailing list <scons-***@scons.org>
Subject: Re: [Scons-users] Provide default Import to SConscript

Take a look at this:

https://gist.github.com/bdbaddog/1ddedecdfd13f6193c173e511e895b1f<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fbdbaddog%2F1ddedecdfd13f6193c173e511e895b1f&data=02%7C01%7C%7C9ba5a5679c7c4a5b9f0608d57af8502f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636550129266512092&sdata=m7ceCpui%2Bokl0dpAl4eHknRXS4my907berk28vtsiWA%3D&reserved=0>
That should work.
Forgot that by the time you're in SConstruct it's too late for this to work. (Or so it seems)
-Bill

On Fri, Feb 23, 2018 at 1:49 PM, Hua Yanghao <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi Gary,

On Fri, Feb 23, 2018 at 3:42 PM, Gary Oberbrunner <***@oberbrunner.com<mailto:***@oberbrunner.com>> wrote:
> In case folks don't know this, here are two ways to get symbols into the
> namespace that SConscripts start with:
> 1. Add them to SCons.Script (which is automatically imported into all
> SConscripts)

This doesn't work for me, I assigned "usw_files" to
SCons.Script.usw_files right before SConscript got called:
import SCons.Script
SCons.Script.usw_files = usw_files
SConscript(...)

and removed the import from one of the SConscript file, I got below error:
Running : ./tools/scons -Q config=configs/qemu_arm_vexpress.py
NameError: name 'usw_files' is not defined:
File "/home/hua/git/usw/SConstruct", line 38:
usw_config(config, usw_target, target_list, verbose=V)
File "/home/hua/git/usw/configs/qemu_arm_vexpress.py", line 176:
main = usw_target(path, "main", "elf", prepend("firmware",
main_list), main_config, output_list, depends=bios,
target_list=target_list, verbose=verbose)
File "/home/hua/git/usw/site_scons/usw_tools.py", line 78:
BuildObjList(env, scons_folder, cwd, build_dir)
File "/home/hua/git/usw/site_scons/common.py", line 86:
env.SConscript(true_scons_file, variant_dir=variant_dir)
File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/SCons/Script/SConscript.py",
line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/SCons/Script/SConscript.py",
line 256:
call_stack[-1].globals)
File "/home/hua/git/usw/build/configs/qemu_arm_vexpress/main/firmware/common/SConscript",
line 6:
usw_files("elf_obj", obj_files)


> 2. Put them in site_init/site_scons.py
> The site init file logic (in src/engine/SCons/Script/Main.py) prepends
> site_scons to sys.path, imports site_init.py into the SCons.Script
> namespace, as well as prepending site_scons/site_tools to the default tool
> path.
>
> Also note that in any Python file you can do 'import SCons.Script' and use
> standard SCons functions like File, Dir, Program, etc.


I tried but failed to use this method, as my usw_files function needs
to be different for different configs. this is partially to
work-around removing the "Return()" part in the SConscript file.If I
have a way to return things implicitly from SConscript file then I can
make usw_files() as a static API which can be put in site_init.py.

I tried to put a dummy function in site_init.py and indeed my
SConscript can see it and call it properly! thanks a lot for the tip.
Do you have any suggestion to make it easier to implement implicit
Return() from SConscript?
_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C9ba5a5679c7c4a5b9f0608d57af8502f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636550129266512092&sdata=KKuECnGCQvuf3cNPOAqFj1CY84M%2B%2FYjfHj0lcK6ICwA%3D&reserved=0>
Bill Deegan
2018-02-24 03:02:50 UTC
Permalink
I responded, though should probably make a different gist as this confuses
the purpose of my gist..

On Fri, Feb 23, 2018 at 8:07 PM, Jason Kenny <***@live.com> wrote:

> I added a note to the gist
>
>
>
> Jason
>
>
>
> *From:* Scons-users [mailto:scons-users-***@scons.org] *On Behalf Of *Bill
> Deegan
> *Sent:* Friday, February 23, 2018 2:02 PM
> *To:* SCons users mailing list <scons-***@scons.org>
> *Subject:* Re: [Scons-users] Provide default Import to SConscript
>
>
>
> Take a look at this:
>
> https://gist.github.com/bdbaddog/1ddedecdfd13f6193c173e511e895b1f
> <https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fbdbaddog%2F1ddedecdfd13f6193c173e511e895b1f&data=02%7C01%7C%7C9ba5a5679c7c4a5b9f0608d57af8502f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636550129266512092&sdata=m7ceCpui%2Bokl0dpAl4eHknRXS4my907berk28vtsiWA%3D&reserved=0>
>
> That should work.
>
> Forgot that by the time you're in SConstruct it's too late for this to
> work. (Or so it seems)
>
> -Bill
>
>
>
> On Fri, Feb 23, 2018 at 1:49 PM, Hua Yanghao <***@gmail.com> wrote:
>
> Hi Gary,
>
> On Fri, Feb 23, 2018 at 3:42 PM, Gary Oberbrunner <***@oberbrunner.com>
> wrote:
> > In case folks don't know this, here are two ways to get symbols into the
> > namespace that SConscripts start with:
> > 1. Add them to SCons.Script (which is automatically imported into all
> > SConscripts)
>
> This doesn't work for me, I assigned "usw_files" to
> SCons.Script.usw_files right before SConscript got called:
> import SCons.Script
> SCons.Script.usw_files = usw_files
> SConscript(...)
>
> and removed the import from one of the SConscript file, I got below error:
> Running : ./tools/scons -Q config=configs/qemu_arm_vexpress.py
> NameError: name 'usw_files' is not defined:
> File "/home/hua/git/usw/SConstruct", line 38:
> usw_config(config, usw_target, target_list, verbose=V)
> File "/home/hua/git/usw/configs/qemu_arm_vexpress.py", line 176:
> main = usw_target(path, "main", "elf", prepend("firmware",
> main_list), main_config, output_list, depends=bios,
> target_list=target_list, verbose=verbose)
> File "/home/hua/git/usw/site_scons/usw_tools.py", line 78:
> BuildObjList(env, scons_folder, cwd, build_dir)
> File "/home/hua/git/usw/site_scons/common.py", line 86:
> env.SConscript(true_scons_file, variant_dir=variant_dir)
> File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/
> SCons/Script/SConscript.py",
> line 551:
> return _SConscript(self.fs, *files, **subst_kw)
> File "/home/hua/git/usw/tools/scons-3.0.1/scons-local-3.0.1/
> SCons/Script/SConscript.py",
> line 256:
> call_stack[-1].globals)
> File "/home/hua/git/usw/build/configs/qemu_arm_vexpress/
> main/firmware/common/SConscript",
> line 6:
> usw_files("elf_obj", obj_files)
>
>
> > 2. Put them in site_init/site_scons.py
> > The site init file logic (in src/engine/SCons/Script/Main.py) prepends
> > site_scons to sys.path, imports site_init.py into the SCons.Script
> > namespace, as well as prepending site_scons/site_tools to the default
> tool
> > path.
> >
> > Also note that in any Python file you can do 'import SCons.Script' and
> use
> > standard SCons functions like File, Dir, Program, etc.
>
>
> I tried but failed to use this method, as my usw_files function needs
> to be different for different configs. this is partially to
> work-around removing the "Return()" part in the SConscript file.If I
> have a way to return things implicitly from SConscript file then I can
> make usw_files() as a static API which can be put in site_init.py.
>
> I tried to put a dummy function in site_init.py and indeed my
> SConscript can see it and call it properly! thanks a lot for the tip.
> Do you have any suggestion to make it easier to implement implicit
> Return() from SConscript?
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> <https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C9ba5a5679c7c4a5b9f0608d57af8502f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636550129266512092&sdata=KKuECnGCQvuf3cNPOAqFj1CY84M%2B%2FYjfHj0lcK6ICwA%3D&reserved=0>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
Hua Yanghao
2018-02-21 21:36:11 UTC
Permalink
Thanks Bill.

Will do and maybe we can somehow combine the best of Parts and the
"kbuild" concepts and make it into scons.
So developer can really start a project in less than 5 lines of code
for the build system and have very good scalability for the future as
well.

SCons is really already good for me but I do see quite some developers
opt for Make for small project (which gradually grow big and no longer
easy to maintain, with mysterious issues here and there, very
difficult to debug, runs in this shell but not that shell, or runs in
bash but not bash-in-screen ... ). I solved this problem with the
kbuild-like configuration system and pulled back a few developers to
use SCons ;-)

Best Regards,
Yanghao

On Wed, Feb 21, 2018 at 9:35 PM, Bill Deegan <***@baddogconsulting.com> wrote:
> Yangao,
>
> Please keep us up to date with your efforts.
> Take a look at our developer guide, any such would need docs and tests to be
> considered for inclusion to SCons, and any major changes would have to have
> support of the community.
>
> I don't have any time or energy to contribute, I'm working on some core
> SCons logic that requires all the time I have available.
>
> -Bill
> SCons Project Co-Manager
>
>
> On Wed, Feb 21, 2018 at 3:22 PM, Bill Deegan <***@baddogconsulting.com>
> wrote:
>>
>>
>>
>> On Wed, Feb 21, 2018 at 2:59 PM, Hua Yanghao <***@gmail.com> wrote:
>>>
>>> Hi Bill,
>>>
>>> > SCons is meant to be a python based make replacement.
>>>
>>> This is actually very much not true.
>>
>>
>> From the scons.or website:
>> "SCons is an Open Source software construction tool—that is, a
>> next-generation build tool. Think of SCons as an improved, cross-platform
>> substitute for the classic Make utility with integrated functionality
>> similar to autoconf/automake and compiler caches such as ccache. In short,
>> SCons is an easier, more reliable and faster way to build software."
>>
>>>
>>> Make is really just dispatching
>>> commands/keeping track of dependencies and timestamps ... it does not
>>> provide any Scons Tools libraries etc. In my view somehow scons is
>>> stuck in the middle of "Make" and a comprehensive build framework like
>>> "Kbuild", more accurate, yet more difficult compared to pure Make for
>>> small things, and yet again more difficult compared to full-fledged
>>> build system due to the lack of a common build framework.
>>
>>
>>
>>
>> How much time are you willing to commit to development and ongoing support
>> of your changes?
>>
>>>
>>>
>>> > What your suggesting is probably more along the lines of Parts? (Jason)
>>> > (Which is build on top of SCons).
>>>
>>> I think I saw parts project quite some time ago on company intranet
>>> ... , but wasn't really what I wanted. I want a single super repo for
>>> everything a project requires, as compared to be able to build
>>> independent small things and then stitch them together. Kbuild is
>>> really what I wanted, kbuild would be perfect if it is build on top of
>>> python instead of those eye-hurting shell script ... so I setup and
>>> build a extremely similar (even better in many ways such as
>>> inter-configuration dependencies) thing in python/scons (only took a
>>> few days for the very first working version).
>>>
>>> > So if I understand properly, you want to add an alternative version of
>>> > SConscript where the files would be presented and entirely different
>>> > set of
>>> > globals to work with?
>>>
>>> Yes, exactly. to bring SConscript from stone-age to industrial-age,
>>> and yet still allow you to use chisel if you insist ... :)
>>
>>
>> That's nice. Good luck with your efforts.
>>
>>
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-***@scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
Hua Yanghao
2018-02-18 09:02:17 UTC
Permalink
On Sun, Feb 18, 2018 at 12:17 AM, Bill Deegan <***@baddogconsulting.com> wrote:
> Hua,
>
> From the tree you've shared, I'm going to guess you have way more
> SConscripts than you need.
>
> For example, you're set of test directories could have a single SConscript
> instead of one per.
> Which no doubt are just a few lines each.

I think this is doable, however then I need to abstract on a different level.
For example, each and every one of the module can be separately
enabled/disabled,
And I am really trying to use the Kbuild/Makefile way of doing this:
by simply enable
the directory that has the SConscript file in a top level config file.

If I do use a single SConscript file to handle a lot more individually
independent module
I could have just end up doing everything in the top level SConstruct
as well, or ending
up with Spencer's solution to have a separate set of module level
configuration file that
is completely un-related to scons (not very good for promoting scons).


> In some cases it looks like you have a SConscript in a directory which only
> has a header file (or none) and then a directory (or more) of source code.
> Skip the SConscript in the basically no-op directorie(s).

This is intended, as I do not want to expose all include files un-conditionally,
to make sure if a module (even if only consists of only header files,
for example uthash library)
is disabled nothing get included in the build process.

> Another suggestion, use variant dirs so you're not creating build files in
> your source directory.

I am using variant_dir and the tree is from the build directory, it is
just I didn't disable the hard linking
in the build directory. this is the default scons behavior.

> If you find yourself with a ton of very small SConscripts, it's a sign that
> you may be doing something non-scons'ian.
>
> Of course it also depends on how working on each group of code is split up
> between different developers.
>
> There is some art in structuring your build system (and your code) such that
> engineers rarely end up causing merge conflicts with each other.

The only state of the art building system I admire is the kbuild
system. If all those small
makefiles in the kbuild system is considered non-scons'ian, I have to
say non-scons'ian
will be my intention. ;-)

> I can see some value in default_import, but it would be something requiring
> some debate on getting accepted.
> As far as I can recall, your's is the first request for something like this
> in the history of SCons (or at least as long as I've been involved).

I am looking forward to more opinions on this and I will personally
starts looking into
the guts and see what I can help here.

> Philosophically SCons is about being explicit in the build requirements and
> also about being correct by design. Yielding reproducible builds regardless
> of the individual developers shell and machine setup.

Yes, and this is why me and many others loves scons.
But this doesn't prevent from scons to getting even better.

Cheers,
Yanghao
Loading...