local_setup.sh 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. # generated from ament_package/template/package_level/local_setup.sh.in
  2. # since this file is sourced use either the provided AMENT_CURRENT_PREFIX
  3. # or fall back to the destination set at configure time
  4. : ${AMENT_CURRENT_PREFIX:="/home/wub/work/1_nzzn/2_code/13_LG/install/g29_ros2_feedback"}
  5. if [ ! -d "$AMENT_CURRENT_PREFIX" ]; then
  6. if [ -z "$COLCON_CURRENT_PREFIX" ]; then
  7. echo "The compile time prefix path '$AMENT_CURRENT_PREFIX' doesn't " \
  8. "exist. Consider sourcing a different extension than '.sh'." 1>&2
  9. else
  10. AMENT_CURRENT_PREFIX="$COLCON_CURRENT_PREFIX"
  11. fi
  12. fi
  13. # function to append values to environment variables
  14. # using colons as separators and avoiding leading separators
  15. ament_append_value() {
  16. # arguments
  17. _listname="$1"
  18. _value="$2"
  19. #echo "listname $_listname"
  20. #eval echo "list value \$$_listname"
  21. #echo "value $_value"
  22. # avoid leading separator
  23. eval _values=\"\$$_listname\"
  24. if [ -z "$_values" ]; then
  25. eval export $_listname=\"$_value\"
  26. #eval echo "set list \$$_listname"
  27. else
  28. # field separator must not be a colon
  29. _ament_append_value_IFS=$IFS
  30. unset IFS
  31. eval export $_listname=\"\$$_listname:$_value\"
  32. #eval echo "append list \$$_listname"
  33. IFS=$_ament_append_value_IFS
  34. unset _ament_append_value_IFS
  35. fi
  36. unset _values
  37. unset _value
  38. unset _listname
  39. }
  40. # function to append non-duplicate values to environment variables
  41. # using colons as separators and avoiding leading separators
  42. ament_append_unique_value() {
  43. # arguments
  44. _listname=$1
  45. _value=$2
  46. #echo "listname $_listname"
  47. #eval echo "list value \$$_listname"
  48. #echo "value $_value"
  49. # check if the list contains the value
  50. eval _values=\$$_listname
  51. _duplicate=
  52. _ament_append_unique_value_IFS=$IFS
  53. IFS=":"
  54. if [ "$AMENT_SHELL" = "zsh" ]; then
  55. ament_zsh_to_array _values
  56. fi
  57. for _item in $_values; do
  58. # ignore empty strings
  59. if [ -z "$_item" ]; then
  60. continue
  61. fi
  62. if [ $_item = $_value ]; then
  63. _duplicate=1
  64. fi
  65. done
  66. unset _item
  67. # append only non-duplicates
  68. if [ -z "$_duplicate" ]; then
  69. # avoid leading separator
  70. if [ -z "$_values" ]; then
  71. eval $_listname=\"$_value\"
  72. #eval echo "set list \$$_listname"
  73. else
  74. # field separator must not be a colon
  75. unset IFS
  76. eval $_listname=\"\$$_listname:$_value\"
  77. #eval echo "append list \$$_listname"
  78. fi
  79. fi
  80. IFS=$_ament_append_unique_value_IFS
  81. unset _ament_append_unique_value_IFS
  82. unset _duplicate
  83. unset _values
  84. unset _value
  85. unset _listname
  86. }
  87. # function to prepend non-duplicate values to environment variables
  88. # using colons as separators and avoiding trailing separators
  89. ament_prepend_unique_value() {
  90. # arguments
  91. _listname="$1"
  92. _value="$2"
  93. #echo "listname $_listname"
  94. #eval echo "list value \$$_listname"
  95. #echo "value $_value"
  96. # check if the list contains the value
  97. eval _values=\"\$$_listname\"
  98. _duplicate=
  99. _ament_prepend_unique_value_IFS=$IFS
  100. IFS=":"
  101. if [ "$AMENT_SHELL" = "zsh" ]; then
  102. ament_zsh_to_array _values
  103. fi
  104. for _item in $_values; do
  105. # ignore empty strings
  106. if [ -z "$_item" ]; then
  107. continue
  108. fi
  109. if [ "$_item" = "$_value" ]; then
  110. _duplicate=1
  111. fi
  112. done
  113. unset _item
  114. # prepend only non-duplicates
  115. if [ -z "$_duplicate" ]; then
  116. # avoid trailing separator
  117. if [ -z "$_values" ]; then
  118. eval export $_listname=\"$_value\"
  119. #eval echo "set list \$$_listname"
  120. else
  121. # field separator must not be a colon
  122. unset IFS
  123. eval export $_listname=\"$_value:\$$_listname\"
  124. #eval echo "prepend list \$$_listname"
  125. fi
  126. fi
  127. IFS=$_ament_prepend_unique_value_IFS
  128. unset _ament_prepend_unique_value_IFS
  129. unset _duplicate
  130. unset _values
  131. unset _value
  132. unset _listname
  133. }
  134. # unset AMENT_ENVIRONMENT_HOOKS
  135. # if not appending to them for return
  136. if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
  137. unset AMENT_ENVIRONMENT_HOOKS
  138. fi
  139. # list all environment hooks of this package
  140. ament_append_value AMENT_ENVIRONMENT_HOOKS "$AMENT_CURRENT_PREFIX/share/g29_ros2_feedback/environment/ament_prefix_path.sh"
  141. ament_append_value AMENT_ENVIRONMENT_HOOKS "$AMENT_CURRENT_PREFIX/share/g29_ros2_feedback/environment/path.sh"
  142. # source all shell-specific environment hooks of this package
  143. # if not returning them
  144. if [ -z "$AMENT_RETURN_ENVIRONMENT_HOOKS" ]; then
  145. _package_local_setup_IFS=$IFS
  146. IFS=":"
  147. if [ "$AMENT_SHELL" = "zsh" ]; then
  148. ament_zsh_to_array AMENT_ENVIRONMENT_HOOKS
  149. fi
  150. for _hook in $AMENT_ENVIRONMENT_HOOKS; do
  151. if [ -f "$_hook" ]; then
  152. # restore IFS before sourcing other files
  153. IFS=$_package_local_setup_IFS
  154. # trace output
  155. if [ -n "$AMENT_TRACE_SETUP_FILES" ]; then
  156. echo "# . \"$_hook\""
  157. fi
  158. . "$_hook"
  159. fi
  160. done
  161. unset _hook
  162. IFS=$_package_local_setup_IFS
  163. unset _package_local_setup_IFS
  164. unset AMENT_ENVIRONMENT_HOOKS
  165. fi
  166. # reset AMENT_CURRENT_PREFIX after each package
  167. # allowing to source multiple package-level setup files
  168. unset AMENT_CURRENT_PREFIX