1 # Copyright (C) 2007, Thomas Leonard
2 # See http://0install.net/0compile.html
4 import sys
, os
, __main__
5 from logging
import info
6 from zeroinstall
.zerostore
import manifest
, Store
10 def do_include_deps(args
):
14 depdir
= os
.path
.realpath('dependencies')
19 for needed_iface
in buildenv
.interfaces
:
20 impl
= buildenv
.chosen_impl(needed_iface
)
22 if impl
.id.startswith('/'):
23 raise SafeException("Can't export '%s' as it's a local implementation (not supported yet; sorry)" % impl
)
24 dirs_to_copy
.append(lookup(impl
.id))
27 for cached
in dirs_to_copy
:
28 required_digest
= os
.path
.basename(cached
)
29 target_impl_dir
= os
.path
.join(depdir
, required_digest
)
30 if not os
.path
.isdir(target_impl_dir
):
31 if required_digest
.startswith('sha1='):
32 shutil
.copytree(cached
, target_impl_dir
)
34 manifest_data
= file(os
.path
.join(cached
, '.manifest')).read()
35 manifest
.copy_tree_with_verify(cached
, depdir
, manifest_data
, required_digest
)
38 print "Copied %d dependencies to %s (%d already there)" % (copied
, depdir
, len(dirs_to_copy
) - copied
)
40 __main__
.commands
.append(do_include_deps
)