autoscons-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Autoscons-devel] Re: delay dist command


From: David Snopek
Subject: [Autoscons-devel] Re: delay dist command
Date: Fri, 26 Sep 2003 09:44:55 -0500 (CDT)

Zhang Le said:
> Hmm, it means I can not push new targets during the execution of scons
> dist right?
> Is is possible to add some function hooks in the scons dist process so
> that
> I can execute some commands before/after a dist (creating version string
> based on time, for example)

Yes.  The node given to you by the pkg.BuildDist() can have pre and post
actions added to it:

dist_node = pkg.BuildDist()
AddPreAction(dist_node, MyPreAction)
AddPostAction(dist_node, MyPostAction)

>> cache = env.Command('filelist.cache', '/dir/with/the/files',
>> BuildFileList)
>> pkg.DistExtra(cache.get_contents().split('\n'))
> This does not work (I also tried None parameter and got the same error):
> TypeError: Tried to lookup Dir '.' as a File.:
>   File "SConstruct", line 191:
>     pkg.ExtraDist(cache.get_contents().split('\n'))
>   File "/home/zl/prj/pymaxent/Autoscons/__init__.py", line 187:
>     node = SCons.Node.FS.default_fs.File(name)
>   File "/usr/local/lib/scons/SCons/Node/FS.py", line 757:
>     return self.Entry(name, directory, create, File)
>   File "/usr/local/lib/scons/SCons/Node/FS.py", line 744:
>     return self.__doLookup(klass, name, directory, create)
>   File "/usr/local/lib/scons/SCons/Node/FS.py", line 666:
>     ret = self.__checkClass(directory.entries[file_name], fsclass)
>   File "/usr/local/lib/scons/SCons/Node/FS.py", line 600:
>     raise TypeError, "Tried to lookup %s '%s' as a %s." % \

Ok, this was an oversight on my part.  The builder makes a file with
contents like:

file1\n
file2\n
file3\n

Doing a "get_contents().split('\n')" will create the the file list:

[ 'file1', 'file2', 'file3', '' ]

The last entry ('') will cause trouble.  While this is still untested,
doing this ...

pkg.DistExtra(cache.get_contents().split('\n')[:-1])

... will exclude the the last entry.  There may be other problems, but the
concept is good.

>>
>>  (2) Use an argument instead of a target to do pretty much what you were
>> trying (also, untested):
> This works for me.

I hope this is satisfactory.

> BTW: where can I get latest source of autoscons: from libksd's CVS or
> this site's CVS?

>From the Autoscons CVS on Savannah.  I am taking some time off from
working on libksd, so it will only get updated when I make fundemental
changes that I want to test an a large scale.

Thank you.
  -- David Snopek

Satellite Computing Solutions, LLC




reply via email to

[Prev in Thread] Current Thread [Next in Thread]