From 5f64cacc74d9be4c9646b669778d294fa12386b3 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 26 Oct 2010 15:02:20 +0000 Subject: [PATCH] generate alias in ~/bin for processing scripts --- processing/make_public | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 processing/make_public diff --git a/processing/make_public b/processing/make_public new file mode 100644 index 000000000..2ab8f24f6 --- /dev/null +++ b/processing/make_public @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Makes the postprocessing routines acessible from everywhere. +# you need a ~/bin directory in your home folder +# add the bin directory to your path by adding the following lines +# to your .bashrc file: +# PATH="$PATH:~/bin" +# export PATH + +import os,sys + +public_bin = { \ + 'pre' : [ + 'marc_addUserOutput', + 'mentat_pbcOnBoxMesh', + 'mentat_patchFromReconstructedBoundaries', + 'mentat_spectralBox', + ], + 'post' : [ + 'postResults', + 'mentat_colorMap', + ], + } + +homedir = os.getenv('HOME') +basedir = os.path.dirname(sys.argv[0]) +for dir in public_bin: + for file in public_bin[dir]: + src = os.path.abspath(os.path.join(basedir,dir,file)) + if (file == ''): + dst = os.path.abspath(os.path.join(homedir,'bin',dir)) + else: + dst = os.path.abspath(os.path.join(homedir,'bin',file)) + print src,'-->',dst + if os.path.lexists(dst): + os.remove(dst) + os.symlink(src,dst)