[Scons-users] Command with empty action turns a normal file target into a directory

Bill Deegan bill at baddogconsulting.com
Wed Jun 23 19:33:28 EDT 2021


Generally having a Directory as a source will not work well.
SCons is a file based system.
So changes in the source2 directory will not cause a rebuild.

Try:
Command([File('target.txt'), Dir('target2')], [File('source.txt'),
Dir('source2')], some_action)

Also why are you using a python action?

Also doing ` rm .sconsign.dblite` from inside a running SCons will cause
errors.

On Wed, Jun 23, 2021 at 4:17 PM Lem Ming <ramboman777 at gmail.com> wrote:

> I am new to scons. I am trying to create custom actions that deal with
> targets and sources. I created an empty function to use as an action in a
> Command object. When the Command is executed, it is supposed to change
> nothing (to my understanding), but it changes one of the targets into a
> directory.
>
> Here is how to recreate the situation:
> - Create the following files:
> Makefile:
> ```
> exec:
> touch target.txt
> mkdir target2
> touch source.txt
> mkdir source2
> scons
> rm .sconsign.dblite
> scons
>
> clean:
> rm -r target.txt target2 source.txt source2 .sconsign.dblite
> ```
>
> SConstruct:
> ```
> #!/usr/bin/env python3
>
> def some_action(target, source, env):
>     pass
>
> Command(['target.txt', 'target2'], ['source.txt', 'source2'], some_action)
> ```
> - Execute `make exec`
>
> What I expected:
> ```
> target.txt # type: normal file
> target2    # type: directory
> source.txt # type: normal file
> source2    # type: directory
> ```
>
> What happened:
> ```
> target.txt # type: directory
> target2    # type: directory
> source.txt # type: normal file
> source2    # type: directory
> ```
>
> Some info about my setup:
> - os: Fedora 33
> - scons version: 4.0.1
>
> Question:
> - What is causing this behavior?
>
> --
> Lem
> _______________________________________________
> 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/20210623/1fe6b539/attachment.htm>


More information about the Scons-users mailing list