Re: Command with empty action turns a normal file target into a directory

Bill Deegan <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAEyG4CGa-WWW6bmSv9KzVsa6NUGeNVveMWOvNZaMtf3KhpWfog@mail.gmail.com>
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 <[email protected]> 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
> [email protected]
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.