Merge lp://qastaging/~cjwatson/update-manager/python-apt-0.8 into lp://qastaging/~canonical-foundations/update-manager/py3

Proposed by Colin Watson
Status: Merged
Merged at revision: 2452
Proposed branch: lp://qastaging/~cjwatson/update-manager/python-apt-0.8
Merge into: lp://qastaging/~canonical-foundations/update-manager/py3
Diff against target: 1450 lines (+233/-198)
25 files modified
AutoUpgradeTester/auto-install-tester.py (+12/-9)
AutoUpgradeTester/install_all.py (+1/-1)
AutoUpgradeTester/install_all_main.py (+10/-8)
AutoUpgradeTester/install_universe (+1/-1)
AutoUpgradeTester/post_upgrade_tests/kernel_test.py (+1/-1)
DistUpgrade/DistUpgradeAptCdrom.py (+5/-5)
DistUpgrade/DistUpgradeCache.py (+52/-52)
DistUpgrade/DistUpgradeController.py (+25/-25)
DistUpgrade/DistUpgradeQuirks.py (+15/-13)
DistUpgrade/DistUpgradeView.py (+5/-5)
DistUpgrade/DistUpgradeViewGtk.py (+1/-1)
DistUpgrade/DistUpgradeViewGtk3.py (+1/-1)
DistUpgrade/DistUpgradeViewKDE.py (+1/-1)
DistUpgrade/DistUpgradeViewNonInteractive.py (+1/-1)
DistUpgrade/apt-autoinst-fixup.py (+10/-12)
UpdateManager/Core/MyCache.py (+17/-17)
UpdateManager/Core/UpdateList.py (+3/-3)
UpdateManager/DistUpgradeFetcherKDE.py (+1/-1)
UpdateManager/GtkProgress.py (+3/-3)
UpdateManager/UpdateManager.py (+21/-18)
UpdateManagerText/UpdateManagerText.py (+10/-10)
debian/changelog (+26/-0)
debian/control (+2/-2)
tests/test_update_origin.py (+8/-7)
utils/est_kernel_size.py (+1/-1)
To merge this branch: bzr merge lp://qastaging/~cjwatson/update-manager/python-apt-0.8
Reviewer Review Type Date Requested Status
Evan (community) Approve
Review via email: mp+109619@code.qastaging.launchpad.net

Description of the change

Completely porting to the python-apt 0.8 API is a prerequisite for a Python 3 port of update-manager.

Bits and pieces of this work have been haphazardly done up to now. This branch should, I think, finish the job; at any rate all the remaining messages emitted by /usr/share/python-apt/migrate-0.8.py are false positives.

To post a comment you must log in.
Revision history for this message
Evan (ev) wrote :
Download full text (5.6 KiB)

The API changes look sane.

I imagine you want to tackle further changes in a separate branch, as you mentioned to Oliver on IRC. pyflakes outputs a lot, some of which being actual errors (typos, though unrelated to the API changes):

  % find -name '*.py' | xargs pyflakes
./DistUpgrade/DistUpgradeCache.py:37: redefinition of unused 'configparser' from
 line 35
./DistUpgrade/MetaRelease.py:28: redefinition of unused 'configparser' from line
 26
./DistUpgrade/MetaRelease.py:32: redefinition of unused 'BadStatusLine' from lin
e 30
./DistUpgrade/MetaRelease.py:43: redefinition of unused 'HTTPError' from line 41

./DistUpgrade/MetaRelease.py:43: redefinition of unused 'Request' from line 40
./DistUpgrade/MetaRelease.py:43: redefinition of unused 'URLError' from line 41
./DistUpgrade/MetaRelease.py:43: redefinition of unused 'urlopen' from line 40
./DistUpgrade/DistUpgradeViewNonInteractive.py:39: redefinition of unused 'NoSec
tionError' from line 37
./DistUpgrade/DistUpgradeViewNonInteractive.py:39: redefinition of unused 'NoOpt
ionError' from line 37
./DistUpgrade/utils.py:50: redefinition of unused 'ProxyHandler' from line 41
./DistUpgrade/utils.py:50: redefinition of unused 'Request' from line 41
./DistUpgrade/utils.py:50: redefinition of unused 'build_opener' from line 41
./DistUpgrade/utils.py:50: redefinition of unused 'install_opener' from line 41
./DistUpgrade/utils.py:50: redefinition of unused 'urlopen' from line 41
./DistUpgrade/utils.py:57: redefinition of unused 'urlsplit' from line 48
./DistUpgrade/utils.py:218: undefined name 'dist'
./DistUpgrade/DistUpgradeController.py:44: redefinition of unused 'SafeConfigPar
ser' from line 42
./DistUpgrade/DistUpgradeController.py:47: redefinition of unused 'SafeConfigPar
ser' from line 44
./DistUpgrade/DistUpgradeController.py:47: redefinition of unused 'NoOptionError
' from line 40
./DistUpgrade/DistUpgradeController.py:60: redefinition of unused 'urlsplit' fro
m line 58
./DistUpgrade/DistUpgradeConfigParser.py:10: redefinition of unused 'SafeConfigP
arser' from line 8
./DistUpgrade/DistUpgradeConfigParser.py:13: redefinition of unused 'SafeConfigP
arser' from line 10
./DistUpgrade/DistUpgradeConfigParser.py:13: redefinition of unused 'NoOptionErr
or' from line 6
./DistUpgrade/DistUpgradeConfigParser.py:13: redefinition of unused 'NoSectionEr
ror' from line 6
./AutoUpgradeTester/post_upgrade_tests/test_lts_upgrade_system.py:21: redefiniti
on of unused 'configparser' from line 19
./AutoUpgradeTester/UpgradeTestBackendQemu.py:11: redefinition of unused 'config
parser' from line 9
./AutoUpgradeTester/UpgradeTestBackendChroot.py:17: redefinition of unused 'conf
igparser' from line 15
./AutoUpgradeTester/UpgradeTestBackendEC2.py:15: redefinition of unused 'configp
arser' from line 13
./AutoUpgradeTester/UpgradeTestBackend.py:11: redefinition of unused 'configpars
er' from line 9
./UpdateManager/Core/MyCache.py:35: redefinition of unused 'HTTPError' from line
 31
./UpdateManager/Core/MyCache.py:35: redefinition of unused 'urlopen' from line 3
2
./UpdateManager/Core/MyCache.py:36: redefinition of unused 'urlsplit' from line
33
./UpdateManager/Core/MyCache.py:40: redefinition of unused 'BadStatusLi...

Read more...

Revision history for this message
Colin Watson (cjwatson) wrote :

On Mon, Jun 11, 2012 at 01:00:27PM -0000, Evan Dandrea wrote:
> I imagine you want to tackle further changes in a separate branch, as
> you mentioned to Oliver on IRC. pyflakes outputs a lot, some of which
> being actual errors (typos, though unrelated to the API changes):

The redefinitions are AFAICS all due to pyflakes not understanding the
try/except ImportError: pattern. We should add an exclusion file for
them at some point.

> ./DistUpgrade/utils.py:218: undefined name 'dist'
> ./UpdateManager/Core/utils.py:218: undefined name 'dist'

Indeed unrelated to this branch; it's trivial, so I fixed it directly in
the py3 branch.

> You'll also want to remove the computer janitor references from POTFILES and debian/*.{dirs,install} before releasing.

I'm going to leave this for Barry, because the c-j refactoring had
nothing to do with me.

> I've installed this (with the aforementioned fixes) and tried running it, but it crashes on changes seemingly unrelated to this branch:
>
> % update-manager
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/UpdateManager/ChangelogViewer.py", line
> 185, in on_insert_text
> self.tag_link(match_start, match_end, url)
> File "/usr/lib/python2.7/dist-packages/UpdateManager/ChangelogViewer.py", line
> 112, in tag_link
> tag.set_data("url", url)
> AttributeError: 'TextTag' object has no attribute 'set_data'

Odd. API change in GTK+ maybe? As you say, though, unrelated to this
branch.

Revision history for this message
Brian Murray (brian-murray) wrote :

On Mon, Jun 11, 2012 at 06:49:25PM -0000, Colin Watson wrote:
> On Mon, Jun 11, 2012 at 01:00:27PM -0000, Evan Dandrea wrote:
> > I imagine you want to tackle further changes in a separate branch, as
> > you mentioned to Oliver on IRC. pyflakes outputs a lot, some of which
> > being actual errors (typos, though unrelated to the API changes):
>
> The redefinitions are AFAICS all due to pyflakes not understanding the
> try/except ImportError: pattern. We should add an exclusion file for
> them at some point.
>
> > ./DistUpgrade/utils.py:218: undefined name 'dist'
> > ./UpdateManager/Core/utils.py:218: undefined name 'dist'
>
> Indeed unrelated to this branch; it's trivial, so I fixed it directly in
> the py3 branch.
>
> > You'll also want to remove the computer janitor references from POTFILES and debian/*.{dirs,install} before releasing.
>
> I'm going to leave this for Barry, because the c-j refactoring had
> nothing to do with me.
>
> > I've installed this (with the aforementioned fixes) and tried running it, but it crashes on changes seemingly unrelated to this branch:
> >
> > % update-manager
> > Traceback (most recent call last):
> > File "/usr/lib/python2.7/dist-packages/UpdateManager/ChangelogViewer.py", line
> > 185, in on_insert_text
> > self.tag_link(match_start, match_end, url)
> > File "/usr/lib/python2.7/dist-packages/UpdateManager/ChangelogViewer.py", line
> > 112, in tag_link
> > tag.set_data("url", url)
> > AttributeError: 'TextTag' object has no attribute 'set_data'
>
> Odd. API change in GTK+ maybe? As you say, though, unrelated to this
> branch.

For what its worth that's bug 1001917.

Revision history for this message
Evan (ev) wrote :

On Mon, Jun 11, 2012 at 7:49 PM, Colin Watson <email address hidden> wrote:
> On Mon, Jun 11, 2012 at 01:00:27PM -0000, Evan Dandrea wrote:
>> I imagine you want to tackle further changes in a separate branch, as
>> you mentioned to Oliver on IRC. pyflakes outputs a lot, some of which
>> being actual errors (typos, though unrelated to the API changes):
>
> The redefinitions are AFAICS all due to pyflakes not understanding the
> try/except ImportError: pattern.  We should add an exclusion file for
> them at some point.

I'm all for exclusion files and pyflakes being part of make check for
every Python application we touch.

You can also silence the pyflakes errors by doing something like:

foomodule = None
try:
    import foomodule
except ImportError:
    pass
if not foomodule:
    import otherfoomodule as foomodule

Revision history for this message
Colin Watson (cjwatson) wrote :

On Tue, Jun 12, 2012 at 09:38:23AM -0000, Evan Dandrea wrote:
> On Mon, Jun 11, 2012 at 7:49 PM, Colin Watson <email address hidden> wrote:
> > The redefinitions are AFAICS all due to pyflakes not understanding the
> > try/except ImportError: pattern.  We should add an exclusion file for
> > them at some point.
>
> I'm all for exclusion files and pyflakes being part of make check for
> every Python application we touch.

(This is done now.)

> You can also silence the pyflakes errors by doing something like:
>
> foomodule = None
> try:
> import foomodule
> except ImportError:
> pass
> if not foomodule:
> import otherfoomodule as foomodule

True. That feels rather ugly to me, though, and since it's just to work
around what I consider a pyflakes bug, I'm reluctant to uglify the code
:-)

Revision history for this message
Evan (ev) wrote :

On Tue, Jun 12, 2012 at 11:37 AM, Colin Watson <email address hidden> wrote:
> True.  That feels rather ugly to me, though, and since it's just to work
> around what I consider a pyflakes bug, I'm reluctant to uglify the code
> :-)

Sure :)

Revision history for this message
Evan (ev) :
review: Approve
Revision history for this message
Barry Warsaw (barry) wrote :

On Jun 12, 2012, at 10:37 AM, Colin Watson wrote:

>On Tue, Jun 12, 2012 at 09:38:23AM -0000, Evan Dandrea wrote:
>> On Mon, Jun 11, 2012 at 7:49 PM, Colin Watson <email address hidden> wrote:
>> > The redefinitions are AFAICS all due to pyflakes not understanding the
>> > try/except ImportError: pattern.  We should add an exclusion file for
>> > them at some point.
>>
>> I'm all for exclusion files and pyflakes being part of make check for
>> every Python application we touch.
>
>(This is done now.)
>
>> You can also silence the pyflakes errors by doing something like:
>>
>> foomodule = None
>> try:
>> import foomodule
>> except ImportError:
>> pass
>> if not foomodule:
>> import otherfoomodule as foomodule
>
>True. That feels rather ugly to me, though, and since it's just to work
>around what I consider a pyflakes bug, I'm reluctant to uglify the code
>:-)

Agreed. One of these days I vow to fix pyflakes. :)

-B

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches