a) The destination directory of autoqa library depends on the
python version used. We can't hardcode it. Maybe we can transfer the
library source code and do 'python setup.py install'?
Even though James suggested taking another approach, in the meantime
I worked on this one and this is the result I currently have:
# copy autoqa library
logging.debug("Copying autoqa library")
import autoqa
srcdir = os.path.dirname(autoqa.__file__)
assert srcdir, "Can't find autoqa library on the server"
srcdir += '/' # trailing slash is important
site_pkgs = host.run('python -c \'import sys,re; print filter(lambda s:
re.match("/usr/lib/.*/site-packages$",s),sys.path)[0]\'').stdout
site_pkgs = site_pkgs.strip() # remove trailing newline
assert site_pkgs, "Can't find python site-packages directory on the
client"
destdir = site_pkgs + '/autoqa/'
host.run('rm -rf %(dir)s; mkdir -p %(dir)s' % {'dir': destdir})
host.send_file(srcdir, destdir)
Too hackish?