setup.fish 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #!/usr/bin/env fish
  2. # generated from catkin/cmake/template/setup.fish.in
  3. # Sets various environment variables and sources additional environment hooks.
  4. # It tries it's best to undo changes from a previously sourced setup file before.
  5. # Supported command line options:
  6. # --extend: skips the undoing of changes from a previously sourced setup file
  7. # --local: only considers this workspace but not the chained ones
  8. # In plain sh shell which doesn't support arguments for sourced scripts you can
  9. # set the environment variable `CATKIN_SETUP_UTIL_ARGS=--extend/--local` instead.
  10. # since this file is sourced either use the provided _CATKIN_SETUP_DIR
  11. # or fall back to the destination set at configure time
  12. if not type -q bass
  13. echo "Missing required fish plugin: bass. See https://github.com/edc/bass"
  14. exit 22
  15. end
  16. if test -z $_CATKIN_SETUP_DIR
  17. set _CATKIN_SETUP_DIR /home/nzzn/Marin_code/Marin_1/install
  18. end
  19. set _SETUP_UTIL "$_CATKIN_SETUP_DIR/_setup_util.py"
  20. set -e _CATKIN_SETUP_DIR
  21. if not test -f "$_SETUP_UTIL"
  22. echo "Missing Python script: $_SETUP_UTIL"
  23. exit 22
  24. end
  25. # detect if running on Darwin platform
  26. set _UNAME (uname -s)
  27. set _IS_DARWIN 0
  28. if test "$_UNAME" = Darwin
  29. set _IS_DARWIN 1
  30. end
  31. set -e _UNAME
  32. # make sure to export all environment variables
  33. set -x CMAKE_PREFIX_PATH $CMAKE_PREFIX_PATH
  34. if test $_IS_DARWIN -eq 0
  35. set -x LD_LIBRARY_PATH $LD_LIBRARY_PATH
  36. else
  37. set -x DYLD_LIBRARY_PATH $DYLD_LIBRARY_PATH
  38. end
  39. set -e _IS_DARWIN
  40. set -x PATH $PATH
  41. set -x PKG_CONFIG_PATH $PKG_CONFIG_PATH
  42. set -x PYTHONPATH $PYTHONPATH
  43. # remember type of shell if not already set
  44. if test -z "$CATKIN_SHELL"
  45. set CATKIN_SHELL fish
  46. end
  47. # invoke Python script to generate necessary exports of environment variables
  48. # use TMPDIR if it exists, otherwise fall back to /tmp
  49. if test -d "$TMPDIR"
  50. set _TMPDIR "$TMPDIR"
  51. else
  52. set _TMPDIR /tmp
  53. end
  54. set _SETUP_TMP (mktemp "$_TMPDIR/setup.fish.XXXXXXXXXX")
  55. set -e _TMPDIR
  56. if test $status -ne 0 -o ! -f "$_SETUP_TMP"
  57. echo "Could not create temporary file: $_SETUP_TMP"
  58. exit 1
  59. end
  60. CATKIN_SHELL=$CATKIN_SHELL "$_SETUP_UTIL" "$argv" "$CATKIN_SETUP_UTIL_ARGS" >> "$_SETUP_TMP"
  61. set _RC $status
  62. if test $_RC -ne 0
  63. if test $_RC -eq 2
  64. then
  65. echo "Could not write the output of '$_SETUP_UTIL' to temporary file '$_SETUP_TMP': maybe the disk is full?"
  66. else
  67. echo "Failed to run '\"$_SETUP_UTIL\" $argv': return code $_RC"
  68. end
  69. set -e _RC
  70. set -e _SETUP_UTIL
  71. rm -f "$_SETUP_TMP"
  72. set -e _SETUP_TMP
  73. exit 1
  74. end
  75. set -e _RC
  76. set -e _SETUP_UTIL
  77. source "$_SETUP_TMP"
  78. rm -f "$_SETUP_TMP"
  79. set -e _SETUP_TMP
  80. # source all environment hooks
  81. set _i 0
  82. while test $_i -lt $_CATKIN_ENVIRONMENT_HOOKS_COUNT
  83. # fish doesn't allow use of ${} to delimit variables within a string
  84. set _i_WORKSPACE (string join "" "$i" "_WORKSPACE")
  85. eval set _envfile \$_CATKIN_ENVIRONMENT_HOOKS_$_i
  86. set -e _CATKIN_ENVIRONMENT_HOOKS_$_i
  87. eval set _envfile_workspace \$_CATKIN_ENVIRONMENT_HOOKS_$_i_WORKSPACE
  88. set -e _CATKIN_ENVIRONMENT_HOOKS_$_i_WORKSPACE
  89. # set workspace for environment hook
  90. set CATKIN_ENV_HOOK_WORKSPACE $_envfile_workspace
  91. # non ideal: some packages register bash scripts as fish env hooks
  92. # it is needed to perform an extension check for backwards compatibility
  93. # if the script ends with .sh, .bash or .zsh, run it with bass
  94. set IS_SH_SCRIPT (string match -r '\.(sh|bash|zsh)$' "$_envfile")
  95. if test -n "$IS_SH_SCRIPT"
  96. bass source "$_envfile"
  97. else
  98. source "$_envfile"
  99. end
  100. set -e IS_SH_SCRIPT
  101. set -e CATKIN_ENV_HOOK_WORKSPACE
  102. set _i (math $_i + 1)
  103. end
  104. set -e _i
  105. set -e _CATKIN_ENVIRONMENT_HOOKS_COUNT