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: Zhang Le
Subject: [Autoscons-devel] Re: delay dist command
Date: Fri, 26 Sep 2003 22:10:53 +0800
User-agent: Mutt/1.4i

On Thu, Sep 25, 2003 at 08:17:34AM -0500, David Snopek wrote:
> Now your question: You can't do it the way you are above.  SCons runs in
> two passes: first setup the targets, then build them.  The function
> build_dist() would be called in the second phase when adding new targets
> has no effect.
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)
> 
> There are two options as I see it:
>  (1) Cache the file list somewhere.  You could do (untested):
> 
> def BuildFileList(target, source, env):
>   fd = open(str(target), "wt")
>   for file in get_files():
>     fd.write(file + '\n')
> 
> # you can use None instead of '/dir/with/the/files' but this will make
> # SCons track the contents of the directory.  It may take extra time ...
> 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." % \
> 
>  (2) Use an argument instead of a target to do pretty much what you were
> trying (also, untested):
This works for me.
> 
> # builds dist when calling:
> #  scons build_dist=yes
> if ARGUMENTS.get('build_dist', 'no') == 'yes':
>   pkg.ExtraDist(get_files())
>   env.AlwaysBuild(pkg.BuildDist(env))
> 
>
BTW: where can I get latest source of autoscons: from libksd's CVS or
this site's CVS?





reply via email to

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