[Bio] / FigCommon / bootstrap.pl Repository:
ViewVC logotype

Diff of /FigCommon/bootstrap.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3, Tue Dec 23 17:56:32 2003 UTC revision 1.13, Thu Jun 3 19:45:57 2004 UTC
# Line 102  Line 102 
102    
103  our $fig_disk = $ENV{FIG_HOME};  our $fig_disk = $ENV{FIG_HOME};
104  our $env_name = $ENV{FIGCONFIG_ENV};  our $env_name = $ENV{FIGCONFIG_ENV};
105    our $env_dir = "$ENV{FIGCONFIG_ENV_DIR}";
106  our $env_bin = "$ENV{FIGCONFIG_ENV_DIR}/bin";  our $env_bin = "$ENV{FIGCONFIG_ENV_DIR}/bin";
107  our $env_lib = "$ENV{FIGCONFIG_ENV_DIR}/lib";  our $env_lib = "$ENV{FIGCONFIG_ENV_DIR}/lib";
108  #  #
# Line 111  Line 112 
112  #our $release_bin = "$ENV{FIGCONFIG_RELEASE_DIR}/bin/$ENV{FIGCONFIG_ENV}";  #our $release_bin = "$ENV{FIGCONFIG_RELEASE_DIR}/bin/$ENV{FIGCONFIG_ENV}";
113  #our $release_lib = "$ENV{FIGCONFIG_RELEASE_DIR}/lib/$ENV{FIGCONFIG_ENV}";  #our $release_lib = "$ENV{FIGCONFIG_RELEASE_DIR}/lib/$ENV{FIGCONFIG_ENV}";
114    
115  our $release_bin = "$fig_disk/dist/releases/current/bin/$ENV{FIGCONFIG_ENV}";  our $release_bin = "$fig_disk/dist/releases/current/$ENV{FIGCONFIG_ENV}/bin";
116  our $release_lib = "$fig_disk/dist/releases/current/lib/$ENV{FIGCONFIG_ENV}";  our $release_lib = "$fig_disk/dist/releases/current/$ENV{FIGCONFIG_ENV}/lib";
117    
118  our $fig_bin = "$fig_disk/FIG/bin";  our $fig_bin = "$fig_disk/FIG/bin";
119    
# Line 135  Line 136 
136      chomp $hostname;      chomp $hostname;
137    
138      push(@$Config, ["fig_disk", $fig_disk, 1]);      push(@$Config, ["fig_disk", $fig_disk, 1]);
139      push(@$Config, ["blastmast", "$fig_disk/BLASTMAT", 1]);      push(@$Config, ["blastmat", "$fig_disk/BLASTMAT", 1]);
140      push(@$Config, ["fig", $fig, 1]);      push(@$Config, ["fig", $fig, 1]);
141      push(@$Config, ["bin", $fig_bin, 1]);      push(@$Config, ["bin", $fig_bin, 1]);
142      push(@$Config, ["ext_bin", $env_bin, 1]);      push(@$Config, ["ext_bin", $env_bin, 1]);
# Line 145  Line 146 
146      push(@$Config, ["RC", "$fig_disk/FIG/ResolutionCenter", 1]);      push(@$Config, ["RC", "$fig_disk/FIG/ResolutionCenter", 1]);
147      push(@$Config, ["NR", "$fig_disk/FIG/NR", 1]);      push(@$Config, ["NR", "$fig_disk/FIG/NR", 1]);
148      push(@$Config, ["temp", "$fig_disk/FIG/Tmp", 1]);      push(@$Config, ["temp", "$fig_disk/FIG/Tmp", 1]);
149      push(@$Config, ["temp_url", "http://$hostname/FIG-Tmp", 1]);  
150      push(@$Config, ["cgi_url", "http://$hostname/FIG", 1]);      my $sandbox;
151        if ($ENV{FIGCONFIG_SANDBOX})
152        {
153            $sandbox = "/$ENV{FIGCONFIG_SANDBOX}";
154        }
155    
156        push(@$Config, ["temp_url", "http://$hostname$sandbox/FIG-Tmp", 1]);
157        push(@$Config, ["cgi_url", "http://$hostname$sandbox/FIG", 1]);
158    
159        #
160        # Add values for a relative base href of temp and CGI pages.  The latter
161        # is used by HHTP.pm to write common page start.  It would make the most
162        # sense to derive the above 2 values from these.  -- GJO
163        #
164    
165        push(@$Config, ["temp_base", "$sandbox/FIG-Tmp/", 1]);
166        push(@$Config, ["cgi_base", "$sandbox/FIG/", 1]);
167  }  }
168    
169  sub compute_environment  sub compute_environment
# Line 178  Line 195 
195      push(@$Env, ["PATH", join(":", @path), 1]);      push(@$Env, ["PATH", join(":", @path), 1]);
196    
197      push(@$Env, ["LD_LIBRARY_PATH", "${env_lib}", 1]);      push(@$Env, ["LD_LIBRARY_PATH", "${env_lib}", 1]);
198    
199        my @perllib = grep({ $_ ne "." } @INC, "$fig_disk/config", $release_lib);
200    
201        push(@$Env, ["PERL5LIB", join(":", @perllib), 1]);
202  }  }
203    
204  sub configure_python  sub configure_python
# Line 213  Line 234 
234    
235  sub find_in_path  sub find_in_path
236  {  {
237      my($file) = @_;      my($file, @extra) = @_;
238      my(@path) = split(":", $ENV{PATH});      my(@path) = split(":", $ENV{PATH});
239    
240      for my $p (@path)      for my $p (@path, @extra)
241      {      {
242          my $x = "$p/$file";          my $x = "$p/$file";
243          if (-x $x)          if (-x $x)
# Line 237  Line 258 
258      #      #
259      # Special case for the mac.      # Special case for the mac.
260      #      #
261        # RDO 20040603 - don't do this any more; we want to pick up
262        # the python we ship.
263        #
264    
265      if ($ENV{FIGCONFIG_ENV} eq "mac")      if (0 && $ENV{FIGCONFIG_ENV} eq "mac")
266      {      {
267          if ($python = find_in_path("pythonw"))          #
268            # We'd like to use the MacPython that is installed
269            # as pythonw.
270            #
271            if ($python = find_in_path("pythonw", "/usr/local/bin"))
272          {          {
273                $OtherConfig->{python_require_poundbang_env} = 1;
274              return $python;              return $python;
275          }          }
276    
277          #          #
278          # Didn't find it in the path; we require the          # Otherwise, we can live with the regular python.
279          # MacPython build, and that installs into          # Fall thru to the generic case.
         # /usr/local/bin/pythonw by default.  
280          #          #
   
         return "/usr/local/bin/pythonw";  
281      }      }
     else  
     {  
282          #          #
283          # Non-mac, just look in the env dir or the path.          # Non-mac, just look in the env dir or the path.
284          #          #
# Line 262  Line 286 
286          $python = "$ENV{FIGCONFIG_ENV_DIR}/bin/python";          $python = "$ENV{FIGCONFIG_ENV_DIR}/bin/python";
287          if (-x $python)          if (-x $python)
288          {          {
289            #
290            # The mac doesn't seem to like the long #! lines, so we'll use poundbang env.
291            #
292            if ($ENV{FIGCONFIG_ENV} eq "mac")
293            {
294                $OtherConfig->{python_require_poundbang_env} = 1;
295            }
296              return $python;              return $python;
297          }          }
298    
299          return find_in_path("python");          return find_in_path("python");
300      }      }
 }  
301    
302  #  #
303  # Find the name of the perl executable we are to use.  # Find the name of the perl executable we are to use.
# Line 305  Line 335 
335  if [ -n "\$$name" ] ; then  if [ -n "\$$name" ] ; then
336      DELIM=:      DELIM=:
337  fi  fi
338  $name=\${$name}\${DELIM}$value  $name=$value\${DELIM}\${$name}
339  export $name  export $name
340  END  END
341          }          }
# Line 333  Line 363 
363    
364              print $fh <<END;              print $fh <<END;
365  if (\$?$name) then  if (\$?$name) then
366      setenv $name \${$name}:$value      setenv $name $value:\${$name}
367  else  else
368      setenv $name $value      setenv $name $value
369  endif  endif
# Line 423  Line 453 
453    
454  }  }
455    
456    sub finalize_server_scripts
457    {
458        #
459        # After any environment-specific stuff, call start_services and stop_services.
460        #
461    
462        open(F, ">>$start_servers") or die "Cannot write $start_servers: $!";
463        print F "\n$fig_bin/start_services\n";
464        close(F);
465        chmod(0775, $start_servers);
466    
467        open(F, ">>$stop_servers") or die "Cannot write $stop_servers: $!";
468        print F "\n$fig_bin/stop_services\n";
469        close(F);
470        chmod(0775, $stop_servers);
471    
472    }
473    
474  sub write_config_pm  sub write_config_pm
475  {  {
476      my($fh, $config) = @_;      my($fh, $config) = @_;
# Line 507  Line 555 
555    
556      print $fh "use FIG_Config;\n";      print $fh "use FIG_Config;\n";
557      print $fh "\n";      print $fh "\n";
558        print $fh "#### END tool_hdr ####\n\n"
559  }  }
560    
561  sub write_tool_hdr_python  sub write_tool_hdr_python
# Line 515  Line 564 
564    
565      my $python = find_python();      my $python = find_python();
566    
567        if ($OtherConfig->{python_require_poundbang_env})
568        {
569            print $fh "#!/usr/bin/env $python\n";
570        }
571        else
572        {
573      print $fh "#!$python\n";      print $fh "#!$python\n";
574        }
575      print $fh "\n";      print $fh "\n";
576    
577      print $fh "import sys\n";      print $fh "import sys, os\n";
578    
579    
580      print $fh "sys.path.append('$OtherConfig->{python_site_path}')\n";      print $fh "sys.path.append('$OtherConfig->{python_site_path}')\n";
581    
582        #
583        # Append the perl path to the environment, for use later with CallPerl.
584        #
585    
586        my $perlpath = join(":", @INC, "$fig_disk/config", $release_lib);
587        print $fh <<END;
588    if os.getenv("PERL5LIB", "") != "":
589        _delim = ":"
590    else:
591        _delim = ""
592    os.environ["PERL5LIB"] = "$perlpath" + _delim + os.getenv("PERL5LIB", "")
593    
594    END
595    
596      print $fh "# Following block is expanded by switch_to_release to add use lib directives\n";      print $fh "# Following block is expanded by switch_to_release to add use lib directives\n";
597      print $fh "# to point at the correct locations in the release directory.\n";      print $fh "# to point at the correct locations in the release directory.\n";
598      print $fh "#BEGIN switch_to_release generated code\n";      print $fh "#BEGIN switch_to_release generated code\n";
# Line 533  Line 603 
603    
604      print $fh "import FIG_Config\n";      print $fh "import FIG_Config\n";
605      print $fh "\n";      print $fh "\n";
606        print $fh "#### END tool_hdr_py ####\n\n"
607  }  }
608    
609  setup_directories("$fig_disk/bin",  setup_directories("$fig_disk/bin",
# Line 548  Line 619 
619  configure_python();  configure_python();
620  configure_environment_specific();  configure_environment_specific();
621    
622    finalize_server_scripts();
623    
624  #  #
625  # Write the shell startup to the figdisk.  # Write the shell startup to the figdisk.
626  #  #

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.13

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3