Code review comment for lp://staging/~vorlon/python-apt/pre-release-py3-ubuntu

Revision history for this message
Barry Warsaw (barry) wrote :

On Jun 11, 2012, at 08:53 PM, Steve Langasek wrote:

>Steve Langasek has proposed merging lp:~vorlon/python-apt/pre-release-py3-ubuntu into lp:~ubuntu-core-dev/python-apt/ubuntu.
>
>Requested reviews:
> Canonical Foundations Team (canonical-foundations)
>
>For more details, see:
>https://code.launchpad.net/~vorlon/python-apt/pre-release-py3-ubuntu/+merge/109733
>
>branch to port pre-build.sh to python3 (at least half of it - the other half
>needs python3-debian), and to make pre-build.sh behave more sensibly when
>source-build-deps are missing

=== modified file 'utils/get_ubuntu_mirrors_from_lp.py'
--- utils/get_ubuntu_mirrors_from_lp.py 2011-08-11 13:38:04 +0000
+++ utils/get_ubuntu_mirrors_from_lp.py 2012-06-11 20:52:18 +0000
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python3
> #
> # get_ubuntu_lp_mirrors.py
> #
> @@ -40,9 +40,8 @@
> countries[countrycode].add(link.href)
>
>
> -keys = countries.keys()
> -keys.sort()
> -print "mirror://mirrors.ubuntu.com/mirrors.txt"
> +keys = sorted(countries.keys())

Actually, you don't need the .keys() here since iteration over a dictionary by
definition iterates over its keys. So

    keys = sorted(countries)

is the standard idiom.

> +print("mirror://mirrors.ubuntu.com/mirrors.txt")
> for country in keys:
> - print "#LOC:%s" % country
> - print "\n".join(sorted(countries[country]))
> + print("#LOC:%s" % country)
> + print("\n".join(sorted(countries[country])))

« Back to merge proposal