+
+# we need explicit debian_revision values in the dependencies for ruamel.yaml, because we have a package iteration
+# greater than zero. So we parse setup.py, get the ruamel.yaml dependencies, tell fpm not to automatically include
+# them in the package being built, and re-add them manually with an appropriate debian_revision value.
+# See #14552 for the reason for this (nasty) workaround. We use ${ruamel_depends[@]} in a few places further down
+# in this script.
+# Ward, 2018-11-28
+IFS=', ' read -r -a deps <<< `grep ruamel.yaml $WORKSPACE/sdk/python/setup.py |cut -f 3 -dl |sed -e "s/'//g"`
+declare -a ruamel_depends=()
+for i in ${deps[@]}; do
+ i=`echo "$i" | sed -e 's!\([0-9]\)! \1!'`
+ if [[ $i =~ .*\>.* ]]; then
+ ruamel_depends+=(--depends "python-ruamel.yaml $i-1")
+ elif [[ $i =~ .*\<.* ]]; then
+ ruamel_depends+=(--depends "python-ruamel.yaml $i-9")
+ else
+ echo "Encountered ruamel dependency that I can't parse. Aborting..."
+ exit 1
+ fi
+done
+