Skip to content

Commit

Permalink
Make check_pieman_version complain if there is any problem
Browse files Browse the repository at this point in the history
More sophisticated solution.
  • Loading branch information
eugulixes committed Jul 24, 2020
1 parent 779b412 commit d16d3cd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions essentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ check_pieman_version() {
# have to provide for backwards compatibility.
if output=$("${PYTHON}" -c "import pieman; print(pieman.__version__)" 2>&1); then
IFS='.' read -ra pieman_version <<< "${output}"
else
case "${output}" in
# When the script is run from the root of the source directory, it
# considers the pieman directory as a package. In turn, if the pieman
# package is not installed either globally or to a virtual environment,
# AttributeError will be raised.
*"AttributeError:"*)
;;
*"ModuleNotFoundError:"*)
;;
*)
fatal "${output}"
exit 1
esac
fi

if (("${pieman_version[0]}" >= "${PIEMAN_MAJOR_VER}")) && (("${pieman_version[1]}" >= "${PIEMAN_MINOR_VER}")); then
Expand Down

0 comments on commit d16d3cd

Please sign in to comment.