[Scons-users] Forcing projects to build in order

Bill Deegan bill at baddogconsulting.com
Fri Aug 7 09:52:03 EDT 2015


Ora,

As I mentioned in a previous reply, the easiest solution is to wrap steps
which must be run in a specific directory in a script. Then the step will
not need SCons to change directory and there is no need to limit
parallelism.

Or you can change the command string from say "./runSomething -o $TARGET
$SOURCES" to
"cd somedir; ./runSomething -o $TARGET $SOURCES"
That way it is not python but the invoked shell which is changing
directories.


-Bill

On Fri, Aug 7, 2015 at 2:22 AM, Ora <orshalev at gmail.com> wrote:

> Hi,
>
> During a few of the build steps the script calls various tools which MUST
> be run in a specific directory.  That is not something I can change at this
> point.
>
> Each such step is defined as its own builder which changes the directory
> and runs the required tool.
>
> However, when running with the '-j' option, Scons tries to run several
> such steps in parallel, and therefore, tries to execute commands in the
> wrong directory.
>
> I cannot avoid parallelism altogether as it it would make my script run
> for so long, it would be useless.
> I cannot avoid changing directories.
>
> I wish SCons would handle changing directories properly on its own, but I
> understand that's not going to happen.
>
> I am therefore looking for a solution to this problem by partially
> limiting parallelism so that the builder steps / projects which change
> directory would not be called in parallel with other builders.
>
>
> Ora
>
> On Thu, Aug 6, 2015 at 7:11 PM, William Blevins <wblevins001 at gmail.com>
> wrote:
>
>>
>> On Thu, Aug 6, 2015 at 11:09 AM, Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>>
>>>
>>> On Thu, Aug 6, 2015 at 8:04 AM, William Blevins <wblevins001 at gmail.com>
>>> wrote:
>>>
>>>> I cannot think of many (if any) good reasons to perform CWD.
>>>>
>>>> Can you modify your build to work without?
>>>> On Thu, Aug 6, 2015 at 10:26 AM, Bill Deegan <bill at baddogconsulting.com
>>>> > wrote:
>>>>
>>>>> Ora,
>>>>>
>>>>> Why do you want to force build order and/or limit parallelism?
>>>>>
>>>>>
>>>> He is performing "change working directory" commands which cause issues
>>>> with parallel builds.
>>>>
>>>
>>> When I run into those I typically do env.Command(target,source,"cd xyz;
>>> do actual command")  or wrap said command in a script and run that from the
>>> command.
>>>
>>
>> That makes sense.  Keeps the CWD commands outside the SCons context :)
>>
>>
>>>
>>>>
>>>>> -Bill
>>>>>
>>>>> On Thu, Aug 6, 2015 at 3:58 AM, Ora <orshalev at gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> My script builds several different projects which are not necessarily
>>>>>> related.   How can I force those projects to build in a certain order?
>>>>>>
>>>>>> That is, I have three projects: a, b and c.
>>>>>> I want 'b' to start building only after 'a' finishes, and for 'c' to
>>>>>> start building only after 'b' finishes.
>>>>>>
>>>>>> This is necessary in order to avoid problems with changing
>>>>>> directories during parallel builds.
>>>>>>
>>>>>> I tried using 'Requires', with every target requiring the target
>>>>>> before it.
>>>>>> Requires (b, a)
>>>>>> Requires (c, b)
>>>>>>
>>>>>> But that doesn't solve the problem because, if I understood
>>>>>> correctly, it only tells Scons that it should finish building 'a' before it
>>>>>> finishes building 'b', and doesn't prevent it from compiling both projects
>>>>>> at the same time.
>>>>>>
>>>>>> Any suggestions on how to deal with this issue would be appreciated.
>>>>>>
>>>>>> Thanks in advance,
>>>>>> Ora
>>>>>>
>>>>>> _______________________________________________
>>>>>>
>>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150807/50aaaae8/attachment.html>


More information about the Scons-users mailing list