mirror of
				https://git.launchpad.net/~ubuntu-qt-code/+git/calamares-settings-ubuntu
				synced 2025-11-04 10:04:02 +00:00 
			
		
		
		
	Clean up automirror module
Summary: * Improve naming of variables * Add comments Test Plan: No test plan Reviewers: wxl, tsimonq2, kc2bez Reviewed By: wxl, tsimonq2, kc2bez Differential Revision: https://phab.lubuntu.me/D44
This commit is contained in:
		
							parent
							
								
									e647964386
								
							
						
					
					
						commit
						72240d9fa0
					
				@ -108,13 +108,13 @@ def getcountrycode():
 | 
			
		||||
    if libcalamares.globalstorage.value("hasInternet"):
 | 
			
		||||
        geoipurl = libcalamares.job.configuration["geoip"]["url"]
 | 
			
		||||
        try:
 | 
			
		||||
            with urllib.request.urlopen(geoipurl, timeout=75) as url:
 | 
			
		||||
                localedata = json.loads(url.read().decode())
 | 
			
		||||
        except HTTPError as error:
 | 
			
		||||
            logging.error("Data not retrieved because %s - URL: %s",
 | 
			
		||||
                          error, geoipurl)
 | 
			
		||||
        except URLError as error:
 | 
			
		||||
            if isinstance(error.reason, socket.timeout):
 | 
			
		||||
            with urllib.request.urlopen(geoipurl, timeout=75) as http_response:
 | 
			
		||||
                localedata = json.loads(http_response.read().decode())
 | 
			
		||||
        except HTTPError as http_error:
 | 
			
		||||
            logging.http_error("Data not retrieved because %s - URL: %s",
 | 
			
		||||
                               http_error, geoipurl)
 | 
			
		||||
        except URLError as url_error:
 | 
			
		||||
            if isinstance(url_error.reason, socket.timeout):
 | 
			
		||||
                logging.error("Socket timed out - URL %s", geoipurl)
 | 
			
		||||
            else:
 | 
			
		||||
                logging.error("Non-timeout protocol error.")
 | 
			
		||||
@ -126,6 +126,9 @@ def getcountrycode():
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_subdomain_by_country(countrycode):
 | 
			
		||||
    """Return the subdomain for the given countrycode
 | 
			
		||||
    or an empty string.
 | 
			
		||||
    """
 | 
			
		||||
    if countrycode in SUBDOMAINS_BY_COUNTRY_CODE.keys():
 | 
			
		||||
        return SUBDOMAINS_BY_COUNTRY_CODE[countrycode]
 | 
			
		||||
    else:
 | 
			
		||||
@ -133,10 +136,12 @@ def get_subdomain_by_country(countrycode):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def getcodename():
 | 
			
		||||
    """Return the codename of the distribution, similar to lsb_release -cs"""
 | 
			
		||||
    return get_distro_information()["CODENAME"]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def changesources(subdomain):
 | 
			
		||||
    """Replace the placeholders and then create the sources.list"""
 | 
			
		||||
    distro = libcalamares.job.configuration["distribution"]
 | 
			
		||||
    url = "http://{}{}".format(subdomain,
 | 
			
		||||
                               libcalamares.job.configuration["baseUrl"])
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@ -1,3 +1,11 @@
 | 
			
		||||
calamares-settings-ubuntu (1:19.10.6) eoan; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * Clean up automirror module:
 | 
			
		||||
    - Improve naming of variables
 | 
			
		||||
    - Add comments
 | 
			
		||||
 | 
			
		||||
 -- apt-ghetto <apt-ghetto@lubuntu.me>  Fri, 13 Sep 2019 16:51:05 +0200
 | 
			
		||||
 | 
			
		||||
calamares-settings-ubuntu (1:19.10.5) eoan; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * Fix UnboundLocalError in automirror module.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user