[pitivi/ci_always_test_results: 23/23] flatpak: Allow using env when no network avalaible
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ci_always_test_results: 23/23] flatpak: Allow using env when no network avalaible
- Date: Wed, 5 Sep 2018 19:55:27 +0000 (UTC)
commit 9ebd42cd845944254bbcbe3c5dc2906fd093f595
Author: Thibault Saunier <tsaunier igalia com>
Date: Sun Jul 29 20:57:21 2018 -0400
flatpak: Allow using env when no network avalaible
I just got a power cut... and without internet access the
pitivi-flatpak script was not usable. Just assume everything is all
right if we could not retrieve repo infos.
build/flatpak/pitivi-flatpak | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/build/flatpak/pitivi-flatpak b/build/flatpak/pitivi-flatpak
index e1798a26..407b846e 100755
--- a/build/flatpak/pitivi-flatpak
+++ b/build/flatpak/pitivi-flatpak
@@ -28,6 +28,7 @@ import subprocess
import sys
import tempfile
import venv
+from urllib.error import URLError
from urllib.parse import urlparse
from urllib.request import urlretrieve
@@ -256,14 +257,19 @@ class FlatpakRepos(FlatpakObject):
def add(self, name, flatpakrepo_url, override=True):
flatpakrepo = tempfile.NamedTemporaryFile(mode="w")
- urlretrieve(flatpakrepo_url, flatpakrepo.name)
- repo = configparser.ConfigParser()
- repo.read(flatpakrepo.name)
- url = repo["Flatpak Repo"]["Url"]
+ try:
+ urlretrieve(flatpakrepo_url, flatpakrepo.name)
+ repo = configparser.ConfigParser()
+ repo.read(flatpakrepo.name)
+ url = repo["Flatpak Repo"]["Url"]
+ except URLError:
+ url = None
same_name = None
for tmpname, tmprepo in self.repos.items():
- if url == tmprepo.url:
+ # If the URL is None (meaning we couldn't retrieve Repo infos)
+ # just check if the repo names match.
+ if url == tmprepo.url or url is None and name == tmpname:
return tmprepo
if name == tmpname:
same_name = tmprepo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]