From 4a4886f63ef21e763092ec04876215b61962dcab Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 2 Dec 2017 19:49:08 -0500 Subject: [PATCH] Generate setup_cantera.csh for use with csh/tcsh Resolves #453 --- SConstruct | 7 ++--- platform/posix/SConscript | 9 ++++--- platform/posix/setup_cantera.csh.in | 41 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 platform/posix/setup_cantera.csh.in diff --git a/SConstruct b/SConstruct index 37354ea2c..21a9c62ac 100644 --- a/SConstruct +++ b/SConstruct @@ -1710,11 +1710,12 @@ def postInstallMessage(target, source, env): if os.name != 'nt': install_message += textwrap.dedent(""" - A setup script to configure the environment for Cantera is at: + Setup scripts to configure the environment for Cantera are at: - setup script {ct_bindir!s}/setup_cantera + setup script (bash) {ct_bindir!s}/setup_cantera + setup script (csh/tcsh) {ct_bindir!s}/setup_cantera.csh - It is recommended that you run this script by typing: + It is recommended that you run the script for your shell by typing: source {ct_bindir!s}/setup_cantera diff --git a/platform/posix/SConscript b/platform/posix/SConscript index a3a20130a..f00657107 100644 --- a/platform/posix/SConscript +++ b/platform/posix/SConscript @@ -33,10 +33,11 @@ if localenv['layout'] != 'debian' and env['OS'] != 'Windows': env['python_cmd'] = env['python{}_cmd'.format(major)] env['python_array_home'] = env['python{}_array_home'.format(major)] - target = env.SubstFile('setup_cantera', 'setup_cantera.in') - localenv.AddPreAction(target, copy_var) - localenv.Depends(target, env['install_python{}_action'.format(major)]) - install('$inst_bindir', target) + for script in ['setup_cantera', 'setup_cantera.csh']: + target = env.SubstFile(script, script + '.in') + localenv.AddPreAction(target, copy_var) + localenv.Depends(target, env['install_python{}_action'.format(major)]) + install('$inst_bindir', target) # Cantera.mak include file for Makefile projects # cantera.pc for use with pkg-config diff --git a/platform/posix/setup_cantera.csh.in b/platform/posix/setup_cantera.csh.in new file mode 100644 index 000000000..dcccfa1a5 --- /dev/null +++ b/platform/posix/setup_cantera.csh.in @@ -0,0 +1,41 @@ +#!/bin/csh + +if (! $?LD_LIBRARY_PATH) then + setenv LD_LIBRARY_PATH @ct_libdir@ +else + setenv LD_LIBRARY_PATH @ct_libdir@:$LD_LIBRARY_PATH +endif + +if (! $?PKG_CONFIG_PATH) then + setenv PKG_CONFIG_PATH @ct_libdir@/pkgconfig +else + setenv PKG_CONFIG_PATH @ct_libdir@/pkgconfig:$PKG_CONFIG_PATH +endif + +setenv PYTHON_CMD @python_cmd@ + +setenv PATH @ct_bindir@:$PATH + +if ("@python_cmd@" != `which python`) then + alias ctpython @python_cmd@ +endif + +if ("@matlab_toolbox@" == "y") then + if (! $?MATLAB_PATH) then + setenv MATLABPATH @ct_matlab_dir@:@ct_matlab_dir@/1D + else + setenv MATLABPATH $MATLABPATH:@ct_matlab_dir@:@ct_matlab_dir@/1D + endif +endif + +if ("@python_module_loc_sc@" != "") then + if (! $?PYTHONPATH) then + setenv PYTHONPATH @python_module_loc_sc@ + else + setenv PYTHONPATH @python_module_loc_sc@:$PYTHONPATH + endif +endif + +if ("@python_array_home@" != "") then + setenv PYTHONPATH @python_array_home@:$PYTHONPATH +endif