recipes/apycot.setup.distutils.py
author David Douard <david.douard@logilab.fr>
Thu, 13 Nov 2014 14:55:11 +0100
changeset 1752 31c34cf9f19f
parent 1751 56eb553a3618
child 1601 f18dfc77fc04
permissions -rw-r--r--
[testutils] small improvements

# normally executed with following builtin variables:
# :prefix: where to install
# :wdir: working directory
# :test: the apyclotlib.atest.Test instance

import os
from os.path import join
from apycotlib import Command, SUCCESS

# ensure environment variables are OK
test.update_env(wdir, 'PATH',
                os.pathsep.join((join(prefix, 'sbin'), join(wdir, 'sbin'),)),
                os.pathsep)
test.update_env(wdir, 'PYTHONPATH',
                join(prefix, 'lib', 'python'),
                os.pathsep)
test.update_env(wdir, 'LD_LIBRARY_PATH',
                join(prefix, 'lib'),
                os.pathsep)

test.writer.warning('Installing with prefix=%s' % prefix)
cmdargs = ['python', 'setup.py', 'install', '--home', prefix]
st = Command(test.writer, cmdargs, raises=True, cwd=wdir).run()
if st == SUCCESS:
    test.writer.info('Installation successfull')
else:
    test.writer.error('Installation failed (%s)'% st)