[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.19, Mon Nov 1 20:26:12 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]);
143        push(@$Config, ["common_runtime", $env_dir, 1]);
144        push(@$Config, ["arch", $ENV{FIGCONFIG_ENV}, 1]);
145      push(@$Config, ["data", $data, 1]);      push(@$Config, ["data", $data, 1]);
146      push(@$Config, ["global", "$data/Global", 1]);      push(@$Config, ["global", "$data/Global", 1]);
147      push(@$Config, ["organisms", "$data/Organisms", 1]);      push(@$Config, ["organisms", "$data/Organisms", 1]);
148      push(@$Config, ["RC", "$fig_disk/FIG/ResolutionCenter", 1]);      push(@$Config, ["RC", "$fig_disk/FIG/ResolutionCenter", 1]);
149      push(@$Config, ["NR", "$fig_disk/FIG/NR", 1]);      push(@$Config, ["NR", "$fig_disk/FIG/NR", 1]);
150      push(@$Config, ["temp", "$fig_disk/FIG/Tmp", 1]);      push(@$Config, ["temp", "$fig_disk/FIG/Tmp", 1]);
151      push(@$Config, ["temp_url", "http://$hostname/FIG-Tmp", 1]);  
152      push(@$Config, ["cgi_url", "http://$hostname/FIG", 1]);      my $sandbox;
153        if ($ENV{FIGCONFIG_SANDBOX})
154        {
155            $sandbox = "/$ENV{FIGCONFIG_SANDBOX}";
156        }
157    
158        push(@$Config, ["temp_url", "http://$hostname$sandbox/FIG-Tmp", 1]);
159        push(@$Config, ["cgi_url", "http://$hostname$sandbox/FIG", 1]);
160    
161        #
162        # Add values for a relative base href of temp and CGI pages.  The latter
163        # is used by HHTP.pm to write common page start.  It would make the most
164        # sense to derive the above 2 values from these.  -- GJO
165        #
166    
167        push(@$Config, ["temp_base", "$sandbox/FIG-Tmp/", 1]);
168        push(@$Config, ["cgi_base", "$sandbox/FIG/", 1]);
169  }  }
170    
171  sub compute_environment  sub compute_environment
# Line 178  Line 197 
197      push(@$Env, ["PATH", join(":", @path), 1]);      push(@$Env, ["PATH", join(":", @path), 1]);
198    
199      push(@$Env, ["LD_LIBRARY_PATH", "${env_lib}", 1]);      push(@$Env, ["LD_LIBRARY_PATH", "${env_lib}", 1]);
200    
201        my @perllib = grep({ $_ ne "." } @INC, "$fig_disk/config", $release_lib,
202                          "$release_lib/FigKernelPackages");
203    
204        push(@$Env, ["PERL5LIB", join(":", @perllib), 1]);
205  }  }
206    
207  sub configure_python  sub configure_python
# Line 213  Line 237 
237    
238  sub find_in_path  sub find_in_path
239  {  {
240      my($file) = @_;      my($file, @extra) = @_;
241      my(@path) = split(":", $ENV{PATH});      my(@path) = split(":", $ENV{PATH});
242    
243      for my $p (@path)      for my $p (@path, @extra)
244      {      {
245          my $x = "$p/$file";          my $x = "$p/$file";
246          if (-x $x)          if (-x $x)
# Line 237  Line 261 
261      #      #
262      # Special case for the mac.      # Special case for the mac.
263      #      #
264        # RDO 20040603 - don't do this any more; we want to pick up
265        # the python we ship.
266        #
267    
268      if ($ENV{FIGCONFIG_ENV} eq "mac")      if (0 && $ENV{FIGCONFIG_ENV} eq "mac")
269      {      {
270          if ($python = find_in_path("pythonw"))          #
271            # We'd like to use the MacPython that is installed
272            # as pythonw.
273            #
274            if ($python = find_in_path("pythonw", "/usr/local/bin"))
275          {          {
276                $OtherConfig->{python_require_poundbang_env} = 1;
277              return $python;              return $python;
278          }          }
279    
280          #          #
281          # Didn't find it in the path; we require the          # Otherwise, we can live with the regular python.
282          # MacPython build, and that installs into          # Fall thru to the generic case.
         # /usr/local/bin/pythonw by default.  
283          #          #
   
         return "/usr/local/bin/pythonw";  
284      }      }
     else  
     {  
285          #          #
286          # Non-mac, just look in the env dir or the path.          # Non-mac, just look in the env dir or the path.
287          #          #
# Line 262  Line 289 
289          $python = "$ENV{FIGCONFIG_ENV_DIR}/bin/python";          $python = "$ENV{FIGCONFIG_ENV_DIR}/bin/python";
290          if (-x $python)          if (-x $python)
291          {          {
292            #
293            # The mac doesn't seem to like the long #! lines, so we'll use poundbang env.
294            #
295            if ($ENV{FIGCONFIG_ENV} =~ /^mac/)
296            {
297                $OtherConfig->{python_require_poundbang_env} = 1;
298            }
299              return $python;              return $python;
300          }          }
301    
302          return find_in_path("python");          return find_in_path("python");
303      }      }
 }  
304    
305  #  #
306  # 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 338 
338  if [ -n "\$$name" ] ; then  if [ -n "\$$name" ] ; then
339      DELIM=:      DELIM=:
340  fi  fi
341  $name=\${$name}\${DELIM}$value  $name=$value\${DELIM}\${$name}
342  export $name  export $name
343  END  END
344          }          }
# Line 333  Line 366 
366    
367              print $fh <<END;              print $fh <<END;
368  if (\$?$name) then  if (\$?$name) then
369      setenv $name \${$name}:$value      setenv $name $value:\${$name}
370  else  else
371      setenv $name $value      setenv $name $value
372  endif  endif
# Line 423  Line 456 
456    
457  }  }
458    
459    sub finalize_server_scripts
460    {
461        #
462        # After any environment-specific stuff, call start_services and stop_services.
463        #
464    
465        open(F, ">>$start_servers") or die "Cannot write $start_servers: $!";
466        print F "\n$fig_bin/start_services\n";
467        close(F);
468        chmod(0775, $start_servers);
469    
470        open(F, ">>$stop_servers") or die "Cannot write $stop_servers: $!";
471        print F "\n$fig_bin/stop_services\n";
472        close(F);
473        chmod(0775, $stop_servers);
474    
475    }
476    
477  sub write_config_pm  sub write_config_pm
478  {  {
479      my($fh, $config) = @_;      my($fh, $config) = @_;
# Line 507  Line 558 
558    
559      print $fh "use FIG_Config;\n";      print $fh "use FIG_Config;\n";
560      print $fh "\n";      print $fh "\n";
561        print $fh "#### END tool_hdr ####\n\n"
562  }  }
563    
564  sub write_tool_hdr_python  sub write_tool_hdr_python
# Line 515  Line 567 
567    
568      my $python = find_python();      my $python = find_python();
569    
570        if ($OtherConfig->{python_require_poundbang_env})
571        {
572            print $fh "#!/usr/bin/env $python\n";
573        }
574        else
575        {
576      print $fh "#!$python\n";      print $fh "#!$python\n";
577        }
578      print $fh "\n";      print $fh "\n";
579    
580      print $fh "import sys\n";      print $fh "import sys, os\n";
581    
582    
583      print $fh "sys.path.append('$OtherConfig->{python_site_path}')\n";      print $fh "sys.path.append('$OtherConfig->{python_site_path}')\n";
584    
585        #
586        # Append the perl path to the environment, for use later with CallPerl.
587        #
588    
589        my $perlpath = join(":", @INC, "$fig_disk/config", $release_lib, "$release_lib/FigKernelPackages");
590        print $fh <<END;
591    if os.getenv("PERL5LIB", "") != "":
592        _delim = ":"
593    else:
594        _delim = ""
595    os.environ["PERL5LIB"] = "$perlpath" + _delim + os.getenv("PERL5LIB", "")
596    
597    END
598    
599      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";
600      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";
601      print $fh "#BEGIN switch_to_release generated code\n";      print $fh "#BEGIN switch_to_release generated code\n";
# Line 533  Line 606 
606    
607      print $fh "import FIG_Config\n";      print $fh "import FIG_Config\n";
608      print $fh "\n";      print $fh "\n";
609        print $fh "#### END tool_hdr_py ####\n\n"
610  }  }
611    
612  setup_directories("$fig_disk/bin",  setup_directories("$fig_disk/bin",
# Line 547  Line 621 
621  configure_std_fig_environment();  configure_std_fig_environment();
622  configure_python();  configure_python();
623  configure_environment_specific();  configure_environment_specific();
624    # configure_database();
625    
626    finalize_server_scripts();
627    
628  #  #
629  # Write the shell startup to the figdisk.  # Write the shell startup to the figdisk.
# Line 587  Line 664 
664    
665  require FigCommon::SwitchRelease;  require FigCommon::SwitchRelease;
666    
667    #
668    # We need to tweak the current path and PERL5LIB environment to get bootstrapping to
669    # work correctly.
670    #
671    
672    $ENV{PATH} = "$ENV{FIGCONFIG_ENVDIR}/bin:$ENV{PATH}";
673    
674    $ENV{PERL5LIB} = (map { $_->[1] } grep { $_->[0] eq "PERL5LIB"} @$Env)[0];
675    
676  &FigCommon::SwitchRelease::switch_to_release($fig_disk, $ENV{FIGCONFIG_ENV}, $ENV{FIGCONFIG_RELEASE});  &FigCommon::SwitchRelease::switch_to_release($fig_disk, $ENV{FIGCONFIG_ENV}, $ENV{FIGCONFIG_RELEASE});

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3