Skip to content
Snippets Groups Projects
Select Git revision
  • c2862e8a2bcce235d2b261436c1b51f767cc9ab5
  • master default protected
  • L2SS-1914-fix_job_dispatch
  • TMSS-3170
  • TMSS-3167
  • TMSS-3161
  • TMSS-3158-Front-End-Only-Allow-Changing-Again
  • TMSS-3133
  • TMSS-3319-Fix-Templates
  • test-fix-deploy
  • TMSS-3134
  • TMSS-2872
  • defer-state
  • add-custom-monitoring-points
  • TMSS-3101-Front-End-Only
  • TMSS-984-choices
  • SDC-1400-Front-End-Only
  • TMSS-3079-PII
  • TMSS-2936
  • check-for-max-244-subbands
  • TMSS-2927---Front-End-Only-PXII
  • Before-Remove-TMSS
  • LOFAR-Release-4_4_318 protected
  • LOFAR-Release-4_4_317 protected
  • LOFAR-Release-4_4_316 protected
  • LOFAR-Release-4_4_315 protected
  • LOFAR-Release-4_4_314 protected
  • LOFAR-Release-4_4_313 protected
  • LOFAR-Release-4_4_312 protected
  • LOFAR-Release-4_4_311 protected
  • LOFAR-Release-4_4_310 protected
  • LOFAR-Release-4_4_309 protected
  • LOFAR-Release-4_4_308 protected
  • LOFAR-Release-4_4_307 protected
  • LOFAR-Release-4_4_306 protected
  • LOFAR-Release-4_4_304 protected
  • LOFAR-Release-4_4_303 protected
  • LOFAR-Release-4_4_302 protected
  • LOFAR-Release-4_4_301 protected
  • LOFAR-Release-4_4_300 protected
  • LOFAR-Release-4_4_299 protected
41 results

lofarinit.csh.in

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    lofarinit.csh.in 5.12 KiB
    #!/bin/echo Usage: source
    #-----------------------------------------------------------------------------
    # lofarinit.csh: Define the LOFAR environment for C-like shells
    #-----------------------------------------------------------------------------
    #
    # Copyright (C) 2005
    # ASTRON (Netherlands Institute for Radio Astronomy)
    # P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
    #
    # This file is part of the LOFAR software suite.
    # The LOFAR software suite is free software: you can redistribute it and/or
    # modify it under the terms of the GNU General Public License as published
    # by the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # The LOFAR software suite is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License along
    # with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
    #
    # $Id$
    
    # Define root here.
    # This is a placeholder, so do NOT change the line.
    # The actual value is filled in by make install (see Makefile.am).
    set lfr_root=@prefix@
    set lfr_libdir=@libdir@
    
    # CMake does not define libdir, so we need to do things differently
    if ("$lfr_libdir" == "") then
      set lfr_libdir=@CMAKE_INSTALL_PREFIX@/@LOFAR_LIBDIR@
    endif
    
    # Use only the basename of the the lib
    set lfr_libdir=`basename $lfr_libdir`
    
    # Get directory for Python extensions
    set lfr_pylibdir=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=True, prefix='')"`
    
    # Only modify path variables if $lfr_root is an existing directory.
    if (! (-d $lfr_root) ) then
        echo "LOFAR root directory $lfr_root does not exist"
    else
        # First strip the current LOFARROOT from PATH, LD_LIBRARY_PATH, PYTHONPATH.
        # Take care that a possible . is preceeded by a backslash.
        if ($?LOFARROOT) then
            set lfr_path = `echo $LOFARROOT | sed -e 's/\./\\\./g'`
    	if ($?PATH) then
    	    foreach lfr_bin (bin sbin)
    		set lfr_bin = "$lfr_path/$lfr_bin"
    		setenv PATH `echo $PATH | sed -e "s%:${lfr_bin}:%:%g" -e "s%^${lfr_bin}:%%"  -e "s%:${lfr_bin}"'$%%' -e "s%^${lfr_bin}"'$%%'`
    	    end
            endif
            if ($?LD_LIBRARY_PATH) then
                set lfr_lib = "$lfr_path/$lfr_libdir"
                setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | sed -e "s%:${lfr_lib}:%:%g" -e "s%^${lfr_lib}:%%"  -e "s%:${lfr_lib}"'$%%' -e "s%^${lfr_lib}"'$%%'`
            endif
            if ($?PYTHONPATH) then
                set lfr_pyt = "$lfr_path/$lfr_pylibdir"
                setenv PYTHONPATH `echo $PYTHONPATH | sed -e "s%:${lfr_pyt}:%:%g" -e "s%^${lfr_pyt}:%%"  -e "s%:${lfr_pyt}"'$%%' -e "s%^${lfr_pyt}"'$%%'`
            endif
        endif
    
        # Now define the new LOFARROOT
        # If not needed, do not do cd;pwd because that resolves symlinks.
        if ( $lfr_root =~ /* ) then
            setenv LOFARROOT $lfr_root
        else
            setenv LOFARROOT `cd >/dev/null $lfr_root; pwd`   # make path absolute
        endif
    
        # Also strip this path from the current paths (in case it is contained in
        # it).
        set lfr_path = `echo $LOFARROOT | sed -e 's/\./\\\./g'`
        if ($?PATH) then
    	foreach lfr_bin (bin sbin)
    	    set lfr_bin = "$lfr_path/$lfr_bin"
                setenv PATH `echo $PATH | sed -e "s%:${lfr_bin}:%:%g" -e "s%^${lfr_bin}:%%"  -e "s%:${lfr_bin}"'$%%' -e "s%^${lfr_bin}"'$%%'`
    	end
        endif
        if ($?LD_LIBRARY_PATH) then
            set lfr_lib = "$lfr_path/$lfr_libdir"
            setenv LD_LIBRARY_PATH `echo $LD_LIBRARY_PATH | sed -e "s%:${lfr_lib}:%:%g" -e "s%^${lfr_lib}:%%"  -e "s%:${lfr_lib}"'$%%' -e "s%^${lfr_lib}"'$%%'`
        endif
        if ($?PYTHONPATH) then
            set lfr_pyt = "$lfr_path/$lfr_pylibdir"
            setenv PYTHONPATH `echo $PYTHONPATH | sed -e "s%:${lfr_pyt}:%:%g" -e "s%^${lfr_pyt}:%%"  -e "s%:${lfr_pyt}"'$%%' -e "s%^${lfr_pyt}"'$%%'`
        endif
    
        # Add the path to the standard paths.
        if (! $?PATH) then
            setenv PATH $LOFARROOT/bin:$LOFARROOT/sbin
        else
            setenv PATH $LOFARROOT/bin:$LOFARROOT/sbin:$PATH
        endif
        if (! $?LD_LIBRARY_PATH) then
            setenv LD_LIBRARY_PATH $LOFARROOT/$lfr_libdir
        else
            setenv LD_LIBRARY_PATH $LOFARROOT/${lfr_libdir}:$LD_LIBRARY_PATH
        endif
        set lfr_pyt = "$LOFARROOT/$lfr_pylibdir"
        if (! $?PYTHONPATH) then
            setenv PYTHONPATH $lfr_pyt
        else
            setenv PYTHONPATH ${lfr_pyt}:$PYTHONPATH
        endif
    
        # Now define the new LOFARDATAROOT (if possible).
        # First try as data directory of the LOFAR install directory.
        set lfr_path = `echo $LOFARROOT | sed -e 's%/installed.*%%'`
        if ( "$lfr_path" != ""  &&  -d $lfr_path/data ) then
            setenv LOFARDATAROOT $lfr_path/data
        else
            # Try it as the LOFARDATA directory (part of the source tree).
            set lfr_path = `echo $LOFARROOT | sed -e 's%/LOFAR/.*%/LOFAR%'`
            if ( "$lfr_path" != ""  &&  -d ${lfr_path}DATA ) then
                setenv LOFARDATAROOT ${lfr_path}DATA
            else
                setenv LOFARDATAROOT /opt/lofar/data
            endif
        endif
    
    endif
    
    unset lfr_root lfr_bin lfr_libdir lfr_lib lfr_pylibdir lfr_pyt lfr_path