Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Python 3 #28

Merged
merged 4 commits into from
Mar 25, 2019
Merged

Port to Python 3 #28

merged 4 commits into from
Mar 25, 2019

Conversation

vkareh
Copy link
Member

@vkareh vkareh commented Aug 1, 2017

This port depends on libmate-menu being compiled with Python 3 support (which is possible after merging mate-desktop/mate-menus#54)
Fixes #27

@vkareh
Copy link
Member Author

vkareh commented Nov 9, 2017

@raveit65 - here, I've fixed the merge conflict. You should be able to build this with python3 and it will automatically use mate-desktop/mate-menus#54

@raveit65
Copy link
Contributor

Mate-menu doesn't start here.

[rave@mother ~]$ mate-menu 
Traceback (most recent call last):
  File "/usr/lib/mate-menu/mate-menu.py", line 33, in <module>
    import setproctitle
ModuleNotFoundError: No module named 'setproctitle'

It is really a lot of work/time to test this. As of latest commit in master i was forced to create a new tarball, where i can use this PR as patch for my rpm https://patch-diff.githubusercontent.com/raw/ubuntu-mate/mate-menu/pull/28.diff
Sorry, i don't complie /install packages by hand on my box. I always use a package-manager.
I suggest to create/tag a new tarball first from master to exclude issues by testers because of creation of own tarballs.

Well, compiling did work well.

@vkareh
Copy link
Member Author

vkareh commented Nov 10, 2017

@raveit65 - seems like you need the python3-setproctitle library (that's what it's called in the ubuntu repos at least).

@vkareh
Copy link
Member Author

vkareh commented Nov 10, 2017

@raveit65 - these seem to be the dependencies in ubuntu, just in case it's helpful for you. Note that this is for the python2 version, so most likely replace python-foo to python3-foo:

vkareh@lemu4:~ $ apt show mate-menu | grep ^Depends | sed -e s/,/\\n/g 
Depends: python-pkg-resources
 python:any (<< 2.8)
 python:any (>= 2.7.5-5~)
 dconf-gsettings-backend | gsettings-backend
 gir1.2-mate-desktop (>= 1.18.0)
 gir1.2-mate-panel (>= 1.18)
 gir1.2-gtk-3.0
 gvfs-bin
 mate-menus (>= 1.18)
 mozo | menulibre
 python (>= 2.4)
 python (<< 3)
 python-configobj
 python-mate-menu
 python-setproctitle
 python-xdg
 python-xlib
 xdg-utils
 libglib2.0-bin

@raveit65
Copy link
Contributor

Ok, i changed runtime requires to
Requires: mate-menus
Requires: mozo
Requires: python3-configobj
Requires: python3-gobject
Requires: pyxdg
Requires: python3-xlib
Requires: python3-setproctitle
Requires: beesu
Requires: mate-panel

Not sure if pyxdg the right package for pyton3.
Now i got this error:
[rave@mother ~]$ mate-menu
Unable to load places plugin :-(
Unable to load system_management plugin :-(
Unable to load applications plugin :-(
Binding to Hot Key: Super_L

In app itself it complains about missing modul
No modul named uniddecode

what ever this is...?

@raveit65
Copy link
Contributor

Ok, i need python3-pyxdg package but this is already installed.

@raveit65
Copy link
Contributor

\o/ python3-unidecode was missing.
Now gui looks again complete and i can test.
For this reason i don't like python as i don't know to find out which runtime requires are needed in a SPEC file.

@raveit65
Copy link
Contributor

Omg, mozo needs ported to python3 too :-)
If i execute 'edit menus' from right-click menu i get another modul error.

[rave@mother ~]$ mate-menu
Removing file : /home/rave/.config/mate-menu/-usr-share-git-gui-lib-git-gui.ico
Binding to Hot Key: Super_L
/usr/lib/mate-menu/mate-menu-config.py
mozo
Traceback (most recent call last):
  File "/usr/bin/mozo", line 22, in <module>
    from Mozo.MainWindow import MainWindow
  File "/usr/lib/python2.7/site-packages/Mozo/MainWindow.py", line 19, in <module>
    import matemenu
ImportError: No module named matemenu
[rave@mother ~]$ mozo
Traceback (most recent call last):
  File "/usr/bin/mozo", line 22, in <module>
    from Mozo.MainWindow import MainWindow
  File "/usr/lib/python2.7/site-packages/Mozo/MainWindow.py", line 19, in <module>
    import matemenu
ImportError: No module named matemenu

@vkareh
Copy link
Member Author

vkareh commented Nov 10, 2017

yeah I don't understand a lot of how python manages dependencies. The setup.py file lists unidecode as a dependency, but it only fails during runtime, rather than during build. Also, I don't even have that package installed, so I don't know which other library is providing it 😕❗️❓

I'm glad you got it working! 😄

@vkareh
Copy link
Member Author

vkareh commented Nov 10, 2017

Yeah, I expected that... no fun having to run both python versions of matemenu alongside each other... I'm forking mozo now :)

@monsta monsta mentioned this pull request May 27, 2018
@raveit65
Copy link
Contributor

@vkareh
I have your python3 port running with #38
Only minimal adjustments is needed.
I dropped those lines from your patch and everything works. This is already done in other PR.

--- mate_menu/plugins/applications.py
+++ mate_menu/plugins/applications.py
@@ -1570,7 +1570,7 @@ def buildApplicationList( self ):
         def find_applications_recursively(app_list, directory, catName):
             for item in directory.get_contents():
                 if item.get_type() == matemenu.TYPE_ENTRY:
-                    #print "=======>>> " + str(item.name) + " = " + str(catName)
+                    #print("=======>>> " + str(item.name) + " = " + str(catName))
                     app_list.append( { "entry": item, "category": catName } )
                 elif item.get_type() == matemenu.TYPE_DIRECTORY:
                     find_applications_recursively(app_list, item, catName)
@@ -1591,7 +1591,7 @@ def find_applications_recursively(app_list, directory, catName):
                             newApplicationsList.append( { "entry": item, "category": entry.name } )
                 #elif entry.get_type() == matemenu.TYPE_ENTRY:
                 #       if not (entry.get_is_excluded() or entry.get_is_nodisplay()):
-                #               print "=======>>> " + item.name + " = top level"
+                #               print("=======>>> " + item.name + " = top level")
                 #               newApplicationsList.append( { "entry": item, "category": "" } )
 
         return newApplicationsList

@raveit65
Copy link
Contributor

@vkareh
Can you rebase against master please?
Or should we use #36 for python3 support?

@vkareh
Copy link
Member Author

vkareh commented Dec 27, 2018

@raveit65 - I just rebased against master. I compared the conflicted diff and this new one and it looks fine now from my side, but please test to make sure I didn't override anything here.

@raveit65
Copy link
Contributor

yeap, it works fine in a quick test.

@flexiondotorg
Can this be reviewed please?

@flexiondotorg
Copy link
Member

Thanks for working on this! ❤️

@flexiondotorg flexiondotorg merged commit a64888c into ubuntu-mate:master Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants