runPythonEmacs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #! /bin/bash
  2. # This script is designed to de-Cygwinify the project variables set by
  3. # the ctattach scripts. If you aren't using ctattach (and you almost
  4. # certainly won't be, unless you're a member of the VR Studio),
  5. # there's no reason to use this script.
  6. # First, de-Cygwinify the HOME variable. Since this variable is
  7. # hardcoded, we can just do it.
  8. HOME=`cygpath -w $HOME`
  9. export HOME
  10. # Now de-Cygwinify the package variables for all of the trees we are
  11. # attached to, e.g. $DTOOL, $PANDA, $DIRECT, etc. These variable
  12. # names are discovered by parsing the $CTPROJS variable, which is made
  13. # up of a series of words like "DIRECT:personal PANDA:personal
  14. # DTOOL:install"; we simply pull off each word and get the part
  15. # preceding the colon.
  16. # That gives us an indirect reference: we end up with a variable that
  17. # contains, e.g., the string "DTOOL": the name of the variable we want
  18. # to modify. Bash provides a way to read the value of an indirect
  19. # reference: ${!varname} returns the variable named by the contents of
  20. # $varname.
  21. # However, bash doesn't provide a way to set the variable named by an
  22. # indirect reference. But we can achieve this by using the env
  23. # command, which accepts as a parameter a list of variables that
  24. # should be reassigned, in the form "var1=value1 var2=value2 ...". So
  25. # we just have to build up this string and pass it to the env command.
  26. assign=""
  27. for packageDef in $CTPROJS; do
  28. packageVar=`echo $packageDef | sed 's/:.*$//'`
  29. decyg=`cygpath -w ${!packageVar}`
  30. assign="$assign $packageVar=$decyg"
  31. done
  32. # Now use the env command to pass all these assignments to emacs.
  33. exec env $assign runemacs "$@"