Move all env vars into ci script

This commit is contained in:
Kovid Goyal 2017-05-09 23:49:04 +05:30
parent 09ddb332d9
commit 6c42d36b18
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 34 additions and 8 deletions

View File

@ -10,12 +10,7 @@ matrix:
include:
- os: linux
sudo: false
env:
- SW=$HOME/sw PATH=$SW/bin:$PATH CFLAGS=-I$SW/include LDFLAGS=-L$SW/lib LD_LIBRARY_PATH=$SW/qt/lib:$SW/lib PKG_CONFIG_PATH=$SW/lib/pkgconfig QMAKE=$SW/qt/bin/qmake QT_PLUGIN_PATH=$SW/qt/plugins
- os: osx
env:
# On OS X the frameworks/dylibs contain hard coded paths, so we have to re-create the paths in the VM exactly
- SWBASE=/Users/kovid SW=$SWBASE/sw PATH=$SW/bin:$SW/qt/bin:$SW/python/Python.framework/Versions/2.7/bin:$PWD/node_modules/.bin:$PATH CFLAGS=-I$SW/include LDFLAGS=-L$SW/lib QMAKE=$SW/qt/bin/qmake QT_PLUGIN_PATH=$SW/qt/plugins
before_install:
- python setup/unix-ci.py install

View File

@ -15,6 +15,30 @@ _plat = sys.platform.lower()
isosx = 'darwin' in _plat
def setenv(key, val):
os.environ[key] = os.path.expandvars(val)
if isosx:
# On OS X the frameworks/dylibs contain hard coded paths, so we have to re-create the paths in the VM exactly
setenv('SWBASE', '/Users/kovid')
setenv('SW', '$SWBASE/sw')
setenv('PATH', '$SW/bin:$SW/qt/bin:$SW/python/Python.framework/Versions/2.7/bin:$PWD/node_modules/.bin:$PATH')
setenv('CFLAGS', '-I$SW/include')
setenv('LDFLAGS', '-L$SW/lib')
setenv('QMAKE', '$SW/qt/bin/qmake')
setenv('QT_PLUGIN_PATH', '$SW/qt/plugins')
else:
setenv('SW', '$HOME/sw')
setenv('PATH', '$SW/bin:$PATH')
setenv('CFLAGS', '-I$SW/include')
setenv('LDFLAGS', '-L$SW/lib')
setenv('LD_LIBRARY_PATH', '$SW/qt/lib:$SW/lib')
setenv('PKG_CONFIG_PATH', '$SW/lib/pkgconfig')
setenv('QMAKE', '$SW/qt/bin/qmake')
setenv('QT_PLUGIN_PATH', '$SW/qt/plugins')
def run(*args):
if len(args) == 1:
args = shlex.split(args[0])
@ -49,9 +73,15 @@ def main():
if isosx:
os.makedirs(os.environ['SWBASE'])
run('sudo', 'chown', os.environ['USER'], os.environ['SWBASE'])
download_and_decompress('https://download.calibre-ebook.com/travis/sw-osx.tar.bz2', os.environ['SWBASE'])
download_and_decompress(
'https://download.calibre-ebook.com/travis/sw-osx.tar.bz2',
os.environ['SWBASE']
)
else:
download_and_decompress('https://download.calibre-ebook.com/travis/sw-linux.tar.xz', os.path.expanduser('~'))
download_and_decompress(
'https://download.calibre-ebook.com/travis/sw-linux.tar.xz',
os.path.expanduser('~')
)
run('npm install --no-optional rapydscript-ng')
print(os.environ['PATH'])
@ -61,7 +91,8 @@ def main():
run(python, 'setup.py', 'bootstrap', '--ephemeral')
elif action == 'test':
if isosx:
os.environ['SSL_CERT_FILE'] = os.path.abspath('resources/mozilla-ca-certs.pem')
os.environ['SSL_CERT_FILE'
] = os.path.abspath('resources/mozilla-ca-certs.pem')
run(python, 'setup.py', 'test')