[Gruppo-web] [Git][ubuntu-it-web/www][develop] 6 commits: pep8-ify download.py

Mattia Rizzolo gitlab a code.ubuntu-it.org
Dom 26 Apr 2020 20:56:21 BST



Mattia Rizzolo pushed to branch develop at Gruppo Web / Nuovo sito


Commits:
ab1b07ac by Mattia Rizzolo at 2020-04-26T20:54:19+02:00
pep8-ify download.py

Signed-off-by: Mattia Rizzolo <mapreri a ubuntu.com>

- - - - -
3fa3bb9a by Mattia Rizzolo at 2020-04-26T21:41:04+02:00
download: raise a more obvious errors if no mirrors can be found

Signed-off-by: Mattia Rizzolo <mapreri a ubuntu.com>

- - - - -
be8188b4 by Mattia Rizzolo at 2020-04-26T21:54:03+02:00
downloads: bump versions to 20.04, set lts_only, drop i386

Signed-off-by: Mattia Rizzolo <mapreri a ubuntu.com>

- - - - -
b5a49978 by Mattia Rizzolo at 2020-04-26T21:54:29+02:00
downloads: ubuntu server changed filename to live-server

Signed-off-by: Mattia Rizzolo <mapreri a ubuntu.com>

- - - - -
e9c33474 by Mattia Rizzolo at 2020-04-26T21:54:48+02:00
downloads: there are no more Italian mirrors, go find some in Germany

Signed-off-by: Mattia Rizzolo <mapreri a ubuntu.com>

- - - - -
2d35cb13 by Mattia Rizzolo at 2020-04-26T21:55:14+02:00
downloads: drom now unused overriding code

Signed-off-by: Mattia Rizzolo <mapreri a ubuntu.com>

- - - - -


2 changed files:

- uitwww/data/downloads.toml
- uitwww/download.py


Changes:

=====================================
uitwww/data/downloads.toml
=====================================
@@ -3,13 +3,13 @@
 # necessario aggiornare questa sezione.
 
 [releases.latest]
-version = "18.04.4"
-codename = "bionic"
+version = "20.04"
+codename = "focal"
 lts = true
 
 [releases.lts]
-version = "16.04.6"
-codename = "xenial"
+version = "20.04"
+codename = "focal"
 lts = true
 
 
@@ -35,28 +35,21 @@ name = "Ubuntu"
 description = "L'originale, con GNOME"
 lts-support-years = 5
 
-lts-only = false
+lts-only = true
 releases = ["latest", "lts"]
 archs = { amd64 = "releases-ubuntu" }
 
 
-[distros.server]
+[distros.live-server]
 name = "Ubuntu Server"
 description = "Tutta la potenza di Ubuntu nel tuo server"
 lts-support-years = 5
 
-lts-only = false
+lts-only = true
 releases = ["lts", "latest"]  # Invertiti intenzionalmente
 
-# La live di 18.04 LTS su releases.u.c usa un installer che non supporta una
-# valanga di sistemi, quindi faccio scaricare l'alternate
-source-override-latest-amd64 = "cdimages-ubuntu"
-
 # amd64 č su releases.u.c, mentre arm64 e ppc64el sono su cdimages.u.c
-[distros.server.archs]
-amd64 = "releases-ubuntu"
-arm64 = "cdimages-ubuntu"
-ppc64el = "cdimages-ubuntu"
+archs = { amd64 = "releases-ubuntu", arm64 = "cdimages-ubuntu", ppc64el = "cdimages-ubuntu" }
 
 
 [distros.kubuntu]
@@ -64,9 +57,9 @@ name = "Kubuntu"
 description = "L'esperienza Ubuntu con desktop KDE"
 lts-support-years = 3
 
-lts-only = false
+lts-only = true
 releases = ["latest", "lts"]
-archs = { amd64 = "cdimages-derivatives", i386 = "cdimages-derivatives" }
+archs = { amd64 = "cdimages-derivatives" }
 
 
 [distros.xubuntu]
@@ -74,9 +67,9 @@ name = "Xubuntu"
 description = "La derivata di Ubuntu leggera ma personalizzabile, con desktop XFCE"
 lts-support-years = 3
 
-lts-only = false
+lts-only = true
 releases = ["latest", "lts"]
-archs = { amd64 = "cdimages-derivatives", i386 = "cdimages-derivatives" }
+archs = { amd64 = "cdimages-derivatives" }
 
 
 [distros.lubuntu]
@@ -84,9 +77,9 @@ name = "Lubuntu"
 description = "La derivata pių leggera, con LXDE"
 lts-support-years = 3
 
-lts-only = false
+lts-only = true
 releases = ["latest", "lts"]
-archs = { amd64 = "cdimages-derivatives", i386 = "cdimages-derivatives" }
+archs = { amd64 = "cdimages-derivatives" }
 
 
 [distros.ubuntu-mate]
@@ -94,9 +87,9 @@ name = "Ubuntu MATE"
 description = "Ubuntu si unisce a MATE"
 lts-support-years = 3
 
-lts-only = false
+lts-only = true
 releases = ["latest", "lts"]
-archs = { amd64 = "cdimages-derivatives", i386 = "cdimages-derivatives" }
+archs = { amd64 = "cdimages-derivatives" }
 
 
 [distros.ubuntu-budgie]
@@ -104,9 +97,9 @@ name = "Ubuntu Budgie"
 description = "La potenza di Ubuntu e la leggerezza di Budgie"
 lts-support-years = 3
 
-lts-only = false
+lts-only = true
 releases = ["latest"]
-archs = { amd64 = "cdimages-derivatives", i386 = "cdimages-derivatives" }
+archs = { amd64 = "cdimages-derivatives" }
 
 
 #[distros.ubuntustudio]
@@ -125,7 +118,7 @@ archs = { amd64 = "cdimages-derivatives", i386 = "cdimages-derivatives" }
 
 [archs]
 amd64 = "64bit"
-i386 = "32bit (computer pių datati)"
+#i386 = "32bit (computer pių datati)"
 arm64 = "ARM 64bit"
 ppc64el = "POWER"
 
@@ -156,6 +149,7 @@ torrent = "http://cdimages.ubuntu.com/{distro}/releases/{codename}/release/{dist
 # I mirror vengono caricati da Launchpad in automatico
 
 [mirrors]
-country = "IT"
+# apparentemente non ci sono più mirror ufficiali in Italia ☹
+country = "DE"
 for = ["ubuntu"]
 


=====================================
uitwww/download.py
=====================================
@@ -66,12 +66,18 @@ class Downloads:
             if self._cache is not None:
                 self._mirrors = self._cache["mirrors"]
             else:
-                self._mirrors = {
-                    distro: list(sorted(launchpad.get_cdimage_mirrors(
+                self._mirrors = {}
+                for distro in self.config["mirrors"]["for"]:
+                    found_mirrors = list(sorted(launchpad.get_cdimage_mirrors(
                          distro, self.config["mirrors"]["country"]
-                    ))) for distro in self.config["mirrors"]["for"]
-                }
-
+                    )))
+                    if found_mirrors:
+                        self._mirrors[distro] = found_mirrors
+                if not self._mirrors:
+                    raise ValueError(
+                        "No available mirrors found for %(for)s in %(country)s"
+                        % self.config["mirrors"]
+                    )
         return self._mirrors
 
     @property
@@ -115,7 +121,7 @@ class Downloads:
                         response = requests.get("%s/MD5SUMS" % path)
                         if response.status_code == 404:
                             raise RuntimeError(
-                                "Missing {} {} on {}".format(distro, release, source),
+                                "Missing {} {} on {}".format(distro, release, url),
                             )
 
                         for line in response.text.split("\n"):
@@ -194,11 +200,7 @@ class Downloads:
                 replaces["mirror:%s" % name] = choices[0]
 
         # Get the right source
-        override_key = "source-override-%s-%s" % (release, arch)
-        if override_key in self.config["distros"][distro]:
-            source_name = self.config["distros"][distro][override_key]
-        else:
-            source_name = self.config["distros"][distro]["archs"][arch]
+        source_name = self.config["distros"][distro]["archs"][arch]
         source = self.config["sources"][source_name]
 
         # Download URLs are different for torrent and HTTP
@@ -223,7 +225,7 @@ class Downloads:
         def index():
             return flask.render_template(
                 "download/index.html",
-                distros = self.config["distros"],
+                distros=self.config["distros"],
             )
 
         @bp.route("/<distro>")
@@ -234,10 +236,10 @@ class Downloads:
 
             return flask.render_template(
                 "download/landing.html",
-                distro_name = distro,
-                distro = self.config["distros"][distro],
-                releases = self.config["releases"],
-                archs = self.config["archs"],
+                distro_name=distro,
+                distro=self.config["distros"][distro],
+                releases=self.config["releases"],
+                archs=self.config["archs"],
             )
 
         @bp.route("/+redirect", methods=["POST"])



View it on GitLab: http://code.ubuntu-it.org/ubuntu-it-web/www/compare/73e60439e468a0c06d1086233b1105ae7a1738ac...2d35cb1314602c5acb421bd0a412485ce6547db2

-- 
View it on GitLab: http://code.ubuntu-it.org/ubuntu-it-web/www/compare/73e60439e468a0c06d1086233b1105ae7a1738ac...2d35cb1314602c5acb421bd0a412485ce6547db2
You're receiving this email because of your account on code.ubuntu-it.org.


-------------- parte successiva --------------
Un allegato HTML č stato rimosso...
URL: <http://liste.ubuntu-it.org/pipermail/gruppo-web/attachments/20200426/170aa646/attachment-0001.htm>


Maggiori informazioni sulla lista Gruppo-web