From f1e55fc15e9cb98b935149503ed13074ce86ea91 Mon Sep 17 00:00:00 2001 From: Daniel Hershcovich Date: Tue, 2 Jun 2020 11:09:16 +0200 Subject: [PATCH] Fix for SSL ceritficate verification failure on Travis CI Report exception when failed downloading files during install --- ci/test.sh | 6 +++--- setup.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ci/test.sh b/ci/test.sh index 01a5e43..de17ae2 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -13,12 +13,12 @@ if ! [[ "$ACTION" =~ ^(toy|unit)$ ]]; then case "$FORMAT" in ucca) mkdir pickle - curl -L https://github.com/UniversalConceptualCognitiveAnnotation/UCCA_English-Wiki/releases/download/v1.2.4/ucca-sample.tar.gz | tar xz -C pickle + curl -L --insecure https://github.com/UniversalConceptualCognitiveAnnotation/UCCA_English-Wiki/releases/download/v1.2.4/ucca-sample.tar.gz | tar xz -C pickle TRAIN_DATA="pickle/train/*" DEV_DATA="pickle/dev/*" ;; amr) - curl --remote-name-all https://amr.isi.edu/download/2016-03-14/alignment-release-{training,dev,test}-bio.txt + curl --insecure --remote-name-all https://amr.isi.edu/download/2016-03-14/alignment-release-{training,dev,test}-bio.txt rename 's/.txt/.amr/' alignment-release-*-bio.txt python -m semstr.scripts.split -q alignment-release-training-bio.amr -o alignment-release-training-bio CONVERT_DATA=alignment-release-dev-bio.amr @@ -27,7 +27,7 @@ if ! [[ "$ACTION" =~ ^(toy|unit)$ ]]; then ;; sdp) mkdir data - curl -L http://svn.delph-in.net/sdp/public/2015/trial/current.tgz | tar xz -C data + curl -L --insecure http://svn.delph-in.net/sdp/public/2015/trial/current.tgz | tar xz -C data python -m semstr.scripts.split -q data/sdp/trial/dm.sdp -o data/sdp/trial/dm python -m scripts.split_corpus -q data/sdp/trial/dm -t 120 -d 36 -l CONVERT_DATA=data/sdp/trial/*.sdp diff --git a/setup.py b/setup.py index 150f567..933ce75 100644 --- a/setup.py +++ b/setup.py @@ -55,10 +55,14 @@ def run(self): out_file = os.path.join("semstr", "util", "resources", filename) if not os.path.exists(out_file): self.announce("Getting '%s'..." % filename) - try: - urllib.request.urlretrieve("https://amr.isi.edu/download/lists/" + filename, out_file) - except: - self.warn("Failed downloading https://amr.isi.edu/download/lists/" + filename + " to " + out_file) + for attempt in 1, 2: + try: + urllib.request.urlretrieve("https://amr.isi.edu/download/lists/" + filename, out_file) + except Exception as e: + self.warn("Failed downloading https://amr.isi.edu/download/lists/" + filename + " to " + out_file + ": " + str(e)) + import ssl + if getattr(ssl, '_create_unverified_context', None): + ssl._create_default_https_context = ssl._create_unverified_context # Install actual package _install.run(self)