From e3f12df03b56a2a617ec7456f8f5b5be5848d72e Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Tue, 21 Jul 2020 14:09:04 -0700 Subject: [PATCH] switch to using packaging.version.parse instead of LooseVersion --- certbot-dns-dnsimple/snap/hooks/post-refresh | 5 +++-- certbot-dns-dnsimple/snap/snapcraft.yaml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/certbot-dns-dnsimple/snap/hooks/post-refresh b/certbot-dns-dnsimple/snap/hooks/post-refresh index 3ae7ef9c7..dd15794a4 100644 --- a/certbot-dns-dnsimple/snap/hooks/post-refresh +++ b/certbot-dns-dnsimple/snap/hooks/post-refresh @@ -10,8 +10,9 @@ cb_installed=$(cat $SNAP/certbot-shared/certbot-version.txt) # get required certbot version for plugin cb_required=$(grep -oP "certbot>=\K.*(?=')" $SNAP/setup.py) -python3 -c "from distutils.version import LooseVersion; import sys; sys.exit(1) if\ - LooseVersion('$cb_installed') < LooseVersion('$cb_required') else sys.exit(0)" || exit_code=$? + +python3 -c "import sys; from packaging import version; sys.exit(1) if\ + version.parse('$cb_installed') < version.parse('$cb_required') else sys.exit(0)" || exit_code=$? if [ "$exit_code" -eq 1 ]; then echo "Certbot is version $cb_installed but needs to be at least $cb_required before" \ "this plugin can be updated; will try again on next refresh." diff --git a/certbot-dns-dnsimple/snap/snapcraft.yaml b/certbot-dns-dnsimple/snap/snapcraft.yaml index ebbafd432..a8b630bfe 100644 --- a/certbot-dns-dnsimple/snap/snapcraft.yaml +++ b/certbot-dns-dnsimple/snap/snapcraft.yaml @@ -20,6 +20,7 @@ parts: plugin: dump source: . stage: [setup.py, certbot-shared] + stage-packages: [python3-packaging] override-pull: | snapcraftctl pull mkdir -p $SNAPCRAFT_PART_SRC/certbot-shared