[Scons-users] Package Builder & Variant oddity

Dirk Bächle tshortik at gmx.de
Thu Sep 12 13:51:06 EDT 2013


Hi Mark,

On 12.09.2013 17:20, Mark Holloway wrote:

> I'm seeing a problem when using Install/Package to a local directory

> when variants are in use.

>


the underlying problem is not your usage of VariantDirs. Whenever you
call Install() or InstallAs(), the names of the files get collected in a
global variable _INSTALLED_FILES,...and "global" really means that there
is only one of it for the whole SCons run.
This is based on the assumption that you usually have only a single
application/product and want to install it, then easily package afterwards.

The env.Package() looks up the filenames in this "installed" list, and
puts them into whatever archive type you specified. It does this as long
as you don't explicitly give it a list of sources for the archive, so
the solution for your problem looks something like this:

======================================

SConscript:

Import('env')

ifiles = env.Install('Test', 'out.txt')

env.Package(source=ifiles,
NAME='testme',
VERSION='0.0.1',
PACKAGEVERSION=0,
PACKAGETYPE='zip')

======================================


Now, the Package() method doesn't have to guess anymore which files you
want to archive for the current variant.

Finally, I'd recommend to put all sources in a subfolder "src" (for
example), and then build the variants "VariantA/B" in parallel to it:

======================================

SConstruct:

env = Environment( tools=['default','packaging'] )
for variant in ['A','B']:
SConscript('src/SConscript', variant_dir='Variant'+variant,
duplicate=0, exports={'env':env})

======================================

But this is mainly a matter of taste...

Best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20130912/77536457/attachment.html


More information about the Scons-users mailing list