[Bio] / FigCommon / configure-env Repository:
ViewVC logotype

View of /FigCommon/configure-env

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (annotate)
Mon Dec 5 19:10:06 2005 UTC (13 years, 11 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, rast_rel_2008_06_18, rast_rel_2008_06_16, mgrast_dev_05262011, rast_rel_2008_12_18, mgrast_dev_04082011, rast_rel_2008_07_21, rast_rel_2010_0928, rast_2008_0924, mgrast_version_3_2, mgrast_dev_12152011, rast_rel_2008_04_23, help, mgrast_dev_06072011, rast_rel_2008_09_30, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, caBIG-05Apr06-00, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_rel_2008_0625, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, rast_rel_2008_10_09, mgrast_dev_04012011, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0919, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, mgrast_dev_04052011, mgrast_dev_02222011, caBIG-13Feb06-00, rast_rel_2009_03_26, mgrast_dev_10262011, rast_rel_2008_11_24, rast_rel_2008_08_07, HEAD
Changes since 1.4: +17 -0 lines
Added license words.

#!/bin/sh
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#


#
# FIG/SEED configuration script
#
# This script takes as an argument the name of the environment
# that we are configuring for.  It takes a second argument specifying
# the path to the code installation, i.e., the dirname under which we
# can find FigKernelPackages, bin, and CGI.  This is no longer the same
# as where the data are installed
#
# If no argument is passed, a list of valid environment names will be
# displayed.
#
# 
# We configure the following files (all paths relative to the top 
# of the FIGdisk directory):
#
# NOTE:  all these are now made in ., not in the directories shown.
# That's because this is now called from a makefile, e.g., and the
# caller is responsible for mv'ing them to the right place.
#
# fig-user-env.sh
# FIG/Packages/FIG_Config.pm
# FIG/Packages/FIG_Config.py
# FIG/tool_hdr
# FIG/tool_hdr_py
# bin/start-servers
# bin/stop-servers
# 
########################################################################

#
# Where the output files are to be placed
#
GenDir=`pwd`

#
# Figure out where we are; set the FIG_HOME and 
# EnvDir values.
#
# Now that the code is in one place and the core stuff and
# data are in another, we can't assume we are building in
# the root of the FIG installation.
#
# Take it from the env for now.  Ick

#FIG_HOME=`pwd`
echo "Using FIG_HOME=$FIG_HOME"


#
# Make sure we're running from a real FIGdisk directory, i.e.,
# that FIG_HOME is set right.
#
if [ ! -d $FIG_HOME/env -o ! -d $FIG_HOME/FIG ] ; then
    echo "Please set FIG_HOME correctly"
    exit
fi


#
# Determine what environments are present.
#

AvailableEnvironments=""
for d in $FIG_HOME/env/* ; do
    e=`basename $d`
    AvailableEnvironments="$AvailableEnvironments $e"
done

if [ $# -ne 2 ] ; then
    echo "Usage: $0 environment-name pathToCodeInstallation"
    echo "Available environments: $AvailableEnvironments"
    exit
fi

#
# Check to see if the user picked a valid environment.
#

if [ ! -d "$FIG_HOME/env/$1" ] ; then
    echo "Invalid environment name $1"
    echo "Available environments: $AvailableEnvironments"
    exit
fi

Env=$1

EnvDir=$FIG_HOME/env/$Env

if [ ! -d $EnvDir ] ; then
    echo "Environment directory $Env does not exist, exiting"
    exit
fi

#
# pull off the path to the base of the code installation
#

CodeInstallDir=$2

if [ ! -d $CodeInstallDir ] ; then
    echo "Code Installation Directory $CodeInstallDir does not exist, exiting"
    exit
fi
if [ ! -d $CodeInstallDir/FigKernelPackages ] ; then
    echo "No FigKernelPackages in $CodeInstallDir, exiting"
    exit
fi


#
# Define the tool_hdr locations.
#

ToolHeaderPerl=./tool_hdr
ToolHeaderPython=./tool_hdr_py


#
# Find python. It might be in the env dir, or it might be in the system.
#

if [ -x "$EnvDir/bin/python" ] ; then
    PythonPath=$EnvDir/bin/python
else
    PythonPath=`which python`
fi

if [ ! -x "$PythonPath" ] ; then
    echo "Could not find working python at $PythonPath"
    exit
fi

#
# Find perl. It might be in the env dir, or it might be in the system.
#

if [ -x "$EnvDir/bin/perl" ] ; then
    PerlPath=$EnvDir/bin/perl
else
    PerlPath=`which perl`
fi

if [ ! -x "$PerlPath" ] ; then
    echo "Could not find working perl at $PerlPath"
    exit
fi

#
# Compute python version.
#

PythonVersion=`$PythonPath -c 'import sys; print "%d.%d" % (sys.version_info[:2])'`

#
# Hostname information.
#

MyHostname=`hostname`
MyBaseURL="http://$MyHostname"

#
# Compute some paths.
#

UserPath="$CodeInstallDir/bin/$RTARCH:$FIG_HOME/FIG/bin:$FIG_HOME/bin:$EnvDir/bin"
BLASTMAT="$FIG_HOME/BLASTMAT"
OurPythonStuff="$CodeInstallDir/lib/$RTARCH:$EnvDir/lib/python$PythonVersion/site-packages"

#
# fig-user-env.sh
#

cat <<EOF >fig-user-env.sh
export FIG_HOME=$FIG_HOME
export FIG_ENVIRONMENT=$EnvDir
export FIG_PYTHON=$PythonPath
export FIG_PERL=$PerlPath

export PATH=\${PATH}:$UserPath

DELIM=
if [ -n "\$PYTHONPATH" ] ; then
    DELIM=:
fi
export PYTHONPATH=\${PYTHONPATH}\${DELIM}$OurPythonStuff

export BLASTMAT=$BLASTMAT

EOF

#
# fig-user-env.csh
#

cat <<EOF >fig-user-env.csh

#
# This file is automatically generated by configure-env
# Do not edit by hand, or changes may be lost.
#

setenv FIG_HOME $FIG_HOME
setenv FIG_ENVIRONMENT $EnvDir
setenv FIG_PYTHON $PythonPath
setenv FIG_PERL $PerlPath

setenv PATH \${PATH}:$UserPath

if (\$?PYTHONPATH) then
    setenv PYTHONPATH \${PYTHONPATH}:$OurPythonStuff
else
    setenv PYTHONPATH $OurPythonStuff
endif

if (\$?LD_LIBRARY_PATH) then
    setenv LD_LIBRARY_PATH \${LD_LIBRARY_PATH}:$EnvDir/lib
else
    setenv LD_LIBRARY_PATH $EnvDir/lib
endif

setenv BLASTMAT $BLASTMAT

EOF


#
# FIG_Config.pm
#

cat <<EOF > FIG_Config.pm
package FIG_Config;

# Each setting of a variable MUST be on a single line.  We use code during
# updates to salvage local settings, which will lead to a disaster if you
# do not conform to this rule.

\$fig_disk    = "$FIG_HOME";
\$blastmat    = "\$fig_disk/BLASTMAT";
\$fig         = "\$fig_disk/FIG";
\$bin         = "$CodeInstallDir/bin/$RTARCH";
\$ext_bin     = "$EnvDir/bin";
\$data        = "\$fig/Data";
\$global      = "\$data/Global";
\$organisms   = "\$data/Organisms";
\$RC          = "\$fig_disk/FIG/ResolutionCenter";
\$NR          = "\$fig_disk/FIG/NR";
\$temp        = "\$fig_disk/FIG/Tmp";
\$temp_url    = "$MyBaseURL/FIG-Tmp";
\$cgi_url     = "$MyBaseURL/FIG";

EOF

#
# FIG_Config.py
#

cat <<EOF > FIG_Config.py

import os.path

# Each setting of a variable MUST be on a single line.  We use code during
# updates to salvage local settings, which will lead to a disaster if you
# do not conform to this rule.

fig_disk    = "$FIG_HOME"
blastmat    = os.path.join(fig_disk, "BLASTMAT")
fig         = os.path.join(fig_disk, "FIG")
bin         = "$CodeInstallDir/bin/$RTARCH/"
ext_bin     = os.path.join("$EnvDir", "bin")
data        = os.path.join(fig, "Data")
global_dir      = os.path.join(data, "Global")
organisms   = os.path.join(data, "Organisms")
RC          = os.path.join(fig, "ResolutionCenter")
NR          = os.path.join(fig, "NR")
temp        = os.path.join(fig, "Tmp")
temp_url    = "$MyBaseURL/FIG-Tmp"
cgi_url     = "$MyBaseURL/FIG"

EOF

#
# Tool header.
#

cat <<EOF > $ToolHeaderPerl
#!$PerlPath

use Data::Dumper;
use Carp;

use lib "$CodeInstallDir/lib/$RTARCH/FigKernelPackages";

use FIG_Config;

EOF

cat <<EOF > $ToolHeaderPython
#!$PythonPath

import sys
sys.path.append("$CodeInstallDir/lib/$RTARCH/FigCommon")

EOF

#
# Start and stop servers scripts.
#

cat <<EOF > start-servers
#!/bin/sh

EOF
chmod +x start-servers

cat <<EOF > stop-servers
#!/bin/sh

EOF
chmod +x stop-servers


#
# Do environment-specific configurations.  We pass the path in
# which the config tools are to find the files to modify
# 

if [ -f $EnvDir/configure-env-specific ] ; then
    . $EnvDir/configure-env-specific $GenDir
fi


#
# Make sure this file ends properly for a perl module.
#
echo "1;" >> FIG_Config.pm


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3