Commit b9f227a8 authored by Thibault Saunier's avatar Thibault Saunier

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.
parent 8745ccc5
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment