[Scons-users] SCons.Node.Python.Value on target_factory

Philipp Kraus philipp.kraus at flashpixx.de
Sun Apr 7 21:42:14 EDT 2013



Am 08.04.2013 um 03:11 schrieb Bill Deegan:


> Any reason your not just doing Execute(your_actions)?

> Are you using the dependencies? It looks like not.

> Unless I'm misunderstanding, you just want an alias to run some commands for you.


The discussion goes off-topic, please forgot the previous discussion and take a look to this example only:

------------
import SCons.Action

env = Environment()

env["BUILDERS"]["WithPyValue"] = SCons.Builder.Builder( action = SCons.Action.Action("echo testbuild 1"), source_factory = SCons.Node.FS.File, target_factory = SCons.Node.Python.Value )
env["BUILDERS"]["WithoutPyValue"] = SCons.Builder.Builder( action = SCons.Action.Action("echo testbuild 2"), source_factory = SCons.Node.FS.File )

env.WithPyValue("target1", "source1")
# env.WithoutPyValue("target2", "source2")
---------------


In this case my system produce:

scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.

IMHO it should produce an error "source1" not exists, but in this case it should be the default target.
If I replace it to: Default( env.WithPyValue("target1", "source1") )
The error is occured.

If I comment out the line
env.WithPyValue("target1", "source1")
and comment in the second line:
env.WithoutPyValue("target2", "source2")

the output is
scons: Building targets ...
scons: *** [target2] Source `source2' not found, needed by target `target2'.
scons: building terminated because of errors.

so the second build command is always run (with and without a Default).

The difference between the two builder is only the target_factory, so can you explain me
why the builder, which has got the target_factory = Scons.Node.Python.Value is not
run by default. In my example a builder, which has got a target_factory = Python.Value
is only run, if it is explicit be called.

Phil




>

>

> On Sun, Apr 7, 2013 at 5:39 PM, Philipp Kraus <philipp.kraus at flashpixx.de> wrote:

>

> Am 08.04.2013 um 01:54 schrieb Bill Deegan:

>

>> You've yet to address some questions from my previous message:

>> Can you paste an example invocation of your GitPull builder?

>

> Yes, see the SConstruct in the link (branch Python.Value is a full working example).

>

> env.GitClone("gittest", "https://github.com/flashpixx/Storage.git")

> env.GitPull("#target-not-needed", "gittest")

>

> The clone command clones the sources, but the pull builder seems not to be run, only if

> the target_factory = Scons.Python.Value.

>

> You can copy also this short example to a SConstruct, it reproduce the problem:

> ------------

> import SCons.Action

>

> env = Environment()

>

> env["BUILDERS"]["WithPyValue"] = SCons.Builder.Builder( action = SCons.Action.Action("echo testbuild 1"), target_factory = SCons.Node.Python.Value )

> env["BUILDERS"]["WithoutPyValue"] = SCons.Builder.Builder( action = SCons.Action.Action("echo testbuild 2"), source_factory = SCons.Node.Python.Value )

>

> env.WithPyValue("target1", "source1")

> env.WithoutPyValue("target2", "source2")

> ---------------

>

> On my OSX I get:

>

> scons: Building targets ...

> echo testbuild 2

> testbuild 2

> scons: done building targets.

>

> the first builder is not run.

>

>

>> Your implementation looks reasonable.

>>

>> Did you read the comments on the SourceCode() builder (which is deprecated)?

>

> Yes, i have read this

>

>

>> Any particular reason you want to have your source code checkout and in in your SCons logic?

>

> Yes, in my projects I create always an alias for building all depended libraries from their sources, because

> manual download / clone / checkout, extracting, compiling are interminable, so I use Scons for this

> building process. This process must be run once, but I need different sources (HTTP download, Git clone, SVN checkout).

> I do this, because I don't want to explain all difference of the library install procedure for new project members (eg students

> which are working first time with the project).

> Okay, I would have implementated only the clone / checkout function or use env.Command, but for practice use I would like to implementate

> also the pull / commit calls.

>

> This builder should not be used for the main code base, but rather on install the project library base.

>

>

>

>

>> On Sun, Apr 7, 2013 at 4:13 PM, Philipp Kraus <philipp.kraus at flashpixx.de> wrote:

>>

>> Am 08.04.2013 um 00:21 schrieb Bill Deegan:

>>

>>> Are you trying to implement something like what the old SourceCode() builder was?

>>> http://www.scons.org/doc/production/HTML/scons-man.html

>>

>> I think so, I have created a branch, which shows the Python.Value call

>> https://github.com/flashpixx/Storage/tree/Python.Value/Scons

>>

>> The SConstruct runs first the "clone" builder, after that the pull, but the pull isn't working (the message isn't shown)

>> in the site_scons/site_tools/Repository.py the line 95 is modified, I have added the target_factory.

>>

>> Is the implementation if my builder correct?

>>

>> Thanks

>>

>> Phil

>>

>>>

>>> On Sun, Apr 7, 2013 at 3:19 PM, Bill Deegan <bill at baddogconsulting.com> wrote:

>>> Seems like you should specify the target_factory as Dir, and the source_factory as a Value if the action is a git pull?

>>>

>>> Regardless, when trying to understand such logic, you're always better off to make a simple single file SConstruct and get it working the way you expect.

>>> Even make the action just an echo of source and target..

>>>

>>> Can you paste an example invocation of your GitPull builder?

>>>

>>> -Bill

>>>

>>>

>>> On Sun, Apr 7, 2013 at 2:30 PM, Philipp Kraus <philipp.kraus at flashpixx.de> wrote:

>>> Hi Bill,

>>>

>>> I have added a Builder for Git & SVN support (builder source: https://github.com/flashpixx/Storage/blob/master/Scons/site_scons/site_tools/Repository.py and my example repo) and I add in the generate eg

>>>

>>> env["BUILDERS"]["GitPull"] = SCons.Builder.Builder( action = SCons.Action.Action("${REPOSITORY['GIT']['PULL']}"), source_factory = SCons.Node.FS.Dir, single_source = True, PRINT_CMD_LINE_FUNC = __GitPullMessage )

>>>

>>> If I add "target_factory = SCons.Node.Python.Value" I can call the builder with env.GitPull

>>> but the action is not run. If I remove the target_factory option or change it to Dir / File (all except Python.Value),

>>> the builder works well.

>>> If I set the source_factory to Python.Value and the target_factory to eg Dir, everything works fine.

>>>

>>> The code works at the moment fine, it is only a question to understand the different factories.

>>>

>>> Thanks

>>>

>>> Phil

>>>

>>>

>>>

>>> Am 07.04.2013 um 22:49 schrieb Bill Deegan:

>>>

>>>> Phil,

>>>>

>>>> So something like:

>>>>

>>>> env.Command(Value('blah'),'mysource.txt')

>>>>

>>>> ?

>>>> What is the source to your builder? has it changed?

>>>>

>>>> -Bill

>>>>

>>>>

>>>>

>>>> On Sun, Apr 7, 2013 at 12:51 PM, Philipp Kraus <philipp.kraus at flashpixx.de> wrote:

>>>> Hello,

>>>>

>>>> I use on my builder for the target_factory a SCons.Node.Python.Value, because

>>>> the target is in my builder is not used by the action. On this

>>>> target_factory the action of the builder is not run. I have removed

>>>> the target_factory option of the builder and the builder runs.

>>>>

>>>> Why does the builder not run, if I set the target_factory to the Python.Value?

>>>>

>>>> (tested under Scons 2.2.0 & 2.3.0)

>>>>

>>>> Thx

>>>>

>>>> Phil

>>>>

>>>> _______________________________________________

>>>> Scons-users mailing list

>>>> Scons-users at scons.org

>>>> http://four.pairlist.net/mailman/listinfo/scons-users

>>>>

>>>>

>>>> _______________________________________________

>>>> Scons-users mailing list

>>>> Scons-users at scons.org

>>>> http://four.pairlist.net/mailman/listinfo/scons-users

>>>

>>>

>>> _______________________________________________

>>> Scons-users mailing list

>>> Scons-users at scons.org

>>> http://four.pairlist.net/mailman/listinfo/scons-users

>>>

>>>

>>>

>>> _______________________________________________

>>> Scons-users mailing list

>>> Scons-users at scons.org

>>> http://four.pairlist.net/mailman/listinfo/scons-users

>>

>>

>> _______________________________________________

>> Scons-users mailing list

>> Scons-users at scons.org

>> http://four.pairlist.net/mailman/listinfo/scons-users

>>

>>

>> _______________________________________________

>> Scons-users mailing list

>> Scons-users at scons.org

>> http://four.pairlist.net/mailman/listinfo/scons-users

>

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130408/fe114497/attachment-0001.html>


More information about the Scons-users mailing list