[Scons-users] sources in zip

Kraus Philipp philipp.kraus at flashpixx.de
Sun Aug 12 15:55:49 EDT 2012


Hi,

I use env.Command for downloading a gz file, another env.command for unzipping and than I would like to compile some sources of this extracted data.
I have got some problems with the dependencies, I'm using Depends for create the connections:

download = env.Command("download", "", download)
extract = env.Command("extract", "", "tar xfv ....")
build = env.Program(...)

Depends(extract, download)
Depends(build, extract)

My problem is now, that I know the source file name, but not the directory. If I extract the gz file, I will get an directory mysources-??-??
were ?? are number of the version. I know that the sources files are stored in mysources-??-??/src/ but in which way can I detect the
correct directory name with the correct dependency graph, because env.Program must get the correct path.

My first try, that does not work, was that I call the tar call into a own python function, that adds after untaring the path to the env variable like:

def untar(target, source, env)
os.system("tar....")

env["untarpath"] = glob.glob("mysources-*")

and than
extract = env.Command("extract", "", untar)

I can not use a static path, because the directory is stored within the tar.gz, so on extracting the path is also extracted.
IMHO the graph dependency should be, program => sources => sourcedir => tar => download, but the sourcedir is
dynamic, so I can get the name after untaring.

Can I do this with scons and how can I do this?

Thx

Phil



More information about the Scons-users mailing list