python3 support

Bug #1770630 reported by Davidovitch
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
nautilus-compare
Fix Released
High
Märt Põder

Bug Description

I realized that simply running 2to3 is the only thing required for having nautilus-compare use the python3 bindings for nautilus. In Arch Linux both the python2 and python3 nautilus python bindings are available, but you can only have one of them installed. Since other nautilus extensions (folder-color-nautilus in this specific case) depend on the python3 bindings, it would be handy to have python3 support for nautilus-compare. I am not sure if you would like to keep python2 support, but I am sure you can have both (although that requires a little more work probably).

I can provide patches and make additional tests on my system of that would help.

Related branches

Revision history for this message
Davidovitch (david-verelst) wrote :

Note that this is also mentioned on the discussion page of the Arch Linux AUR package of nautilus-compare: https://aur.archlinux.org/packages/nautilus-compare/#news

Märt Põder (boamaod)
Changed in nautilus-compare:
status: New → Fix Committed
assignee: nobody → Märt Põder (boamaod)
importance: Undecided → High
Revision history for this message
Märt Põder (boamaod) wrote :

I committed a fix for this in revision 53 and I intend to create a source release 0.0.6 to provide the Python 3 version needed for current and upcoming distributions:

* https://bazaar.launchpad.net/~nautilus-compare/nautilus-compare/trunk/revision/53

The code is in the "seems to work" status and although there were not many changes needed, I would indeed appreciate some additional testing and feedback. There might be some changes needed that I am not currently aware of.

To smoothen the process I created a pre-release package for upcoming Focal Fossa in the PPA:

* https://launchpad.net/~boamaod/+archive/ubuntu/nautilus-compare/+packages

If I get a confirmation that "seems to work" is not only "works for me", I will release an updated source package.

Changed in nautilus-compare:
milestone: none → 0.0.6
Revision history for this message
Davidovitch (david-verelst) wrote :

Not sure what is going, but I get the following on my machine (Arch Linux, nautilus 3.36.1) with revision 53:

Traceback (most recent call last):
  File "/usr/share/nautilus-python/extensions/nautilus-compare.py", line 40, in __init__
    self.config = utils.NautilusCompareConfig()
AttributeError: module 'utils' has no attribute 'NautilusCompareConfig'

the file utils.py does contain NautilusCompareConfig() so maybe it is importing another utils module?

Revision history for this message
Davidovitch (david-verelst) wrote :

My bad, I am not installing it correctly. I'll make sure that's correctly done first.

Revision history for this message
Davidovitch (david-verelst) wrote :

When byte compiling the python module util.py it works (python -m compileall src/utils.py). I do get a bunch of RuntimmeError's:

RuntimeError: object at 0x7f813bfb7e40 of type NautilusCompareExtension is not initialized

but other than that it just works fine for me. Also changing the default diff tool worked when using nautilus-compare-preferences (but only after restarting nautilus).

Revision history for this message
Märt Põder (boamaod) wrote :

I also fixed the syslog/RuntimeRrror bug #1825063 in revision 56 now.

There might be a way to make the extension reload configuration on changes. Any ideas how? Adding a warning message on the need to restart or restarting Nautilus after asking confirmation to do it seems bit too unintelligent for me.

Revision history for this message
Davidovitch (david-verelst) wrote :

I can confirm no more RuntimeError's with revision 56.

Not sure what to do about reloading the configuration, I have never really developed Nautilus extensions in Python so I don't have a lot of experience to share. I naively tried to add "self.config.load()" to "save_event()" in "nautilus-compare-preferences.py" but that doesn't do anything. I assume this is because the "self.config.load()" in "nautilus-compare.py" is tied to a running Nautilus session of which the preference dialogue is not aware?

You could load the config "self.config.load()" every time the user executes a comparison in "menu_activate_cb()"? That is of course a little wasteful.

Revision history for this message
Davidovitch (david-verelst) wrote :

Alternatively, what if you add "Compare configure" option in the context menu that calls the "nautilus-compare-preferences.py" and upon closing triggers a re-load of the properties within "nautilus-compare.py"?

Märt Põder (boamaod)
Changed in nautilus-compare:
status: Fix Committed → Fix Released
Revision history for this message
fprietog (fprietog) wrote :

Märt Põder, thanks for the fix. Also works in groovy.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.