b8bc9e9120d7801dade0c16ca5ccb564c6e4566c
[nivanova/samba-autobuild/.git] / lib / wscript_build
1 #!/usr/bin/env python
2
3 import os, Options
4 from samba_utils import TOUCH_FILE, EXPAND_VARIABLES
5
6 # work out what python external libraries we need to install
7 external_libs = {
8     "dns.resolver": "dnspython/dns",
9     "subunit": "subunit/python/subunit",
10     "testtools": "testtools/testtools"}
11
12 list = []
13
14 for module, package in external_libs.iteritems():
15     try:
16         __import__(module)
17     except ImportError:
18         list.append(package)
19
20 for e in list:
21     bld.INSTALL_WILDCARD('${PYTHONDIR}/samba/external', e + '/**/*', flat=False,
22                          exclude='*.pyc', trim_path=os.path.dirname(e))
23
24 if Options.is_install:
25     # we need a blank __init__.py in samba/external
26     TOUCH_FILE(bld.EXPAND_VARIABLES('${PYTHONDIR}/samba/external/__init__.py'))