costales / gufw

Linux Firewall
GNU General Public License v3.0
129 stars 33 forks source link

22.04 /usr/share/gufw/gufw/gufw.py - missing #45

Open 0pLuS0 opened 2 years ago

0pLuS0 commented 2 years ago

Hello,

I'm trying to build 22.04.0 on Slackware 15.0

Just using python3 setup.py install --prefix=/usr --root=$PKG in a build script, when I try to run gufw, I get back at the term;

gufw python3: can't open file '/usr/share/gufw/gufw/gufw.py': [Errno 2] No such file or directory

With 21.04.0 I have this in my build script;

Point gufw-pkexec to the correct python3 location and version. sed -i "s|lib/python3.5|lib$LIBDIRSUFFIX/python3.7|g" bin/gufw-pkexec sed 's|/usr/share/gufw/gufw/gufw.py $1|/usr/lib64/python'"${PYTHONVERSION}"'/site-packages/gufw/gufw.py "$@"|' -i bin/gufw-pkexec

But it doesn't seem to be working now with the latest gufw, I hope you can please fix this build issue.

THANKS

0pLuS0 commented 2 years ago

If I also try to build gufw-21.04.0 with the sed options listed above, when I run it from the term I get this back;

~ >gufw python3: can't open file '/usr/lib64/python3.7/site-packages/gufw/gufw.py': [Errno 2] No such file or directory

I used before 21.04.0 in Slackware 14.2 but it doesn't compile properly either.

BUT, I want to use the latest version.

THANKS

0pLuS0 commented 2 years ago

Well, after posting this issue, I did added in a sed line in my slackbuild script and gufw is running.

I'm attaching the build script I used to compile 22.04.0.

Please tell me if Line 54 in this build script for the sed is ok?

THANKS

gufw.SlackBuild.txt

costales commented 2 years ago

Hi, Yes, your line 54 looks right. I had several problems with the python directory and that is the reason on this change. Thanks for you work adapting it!! Love it! Best regards.

0pLuS0 commented 2 years ago

Hi @costales

Do you think it possible in the future you can port this to either QT or GTK?

I love the app, I just hate the extra added needed for more deps, with webkitgtk...

Thanks for your time!

costales commented 2 years ago

Hi,

But it is already GTK :O

Best regards.

0pLuS0 commented 2 years ago

Only GTK, there is no need for Webkit2gtk, or python-distutils-extra?

I used this slackware build script as a guide, and according to it, gufw needs webkit2gtk;

https://slackbuilds.org/repository/15.0/network/gui-ufw/

Thanks

0pLuS0 commented 2 years ago

Hi @costales

I'm still not sure what you mean it is already GTK, gufw is not 100% a GTK only app, by my understanding.

Slackware and Arch both list webkit2gtk as a requirement to build.

Slackware https://slackbuilds.org/repository/15.0/network/gui-ufw/

Arch https://archlinux.org/packages/community/any/gufw/

In simple words, my understanding is that while webkit2gtk is used to render UI, I've seen other projects use this for creating the UI, I don't understand why this has to be requirement to build gufw?

https://webkitgtk.org/

I hope in the future you can remove the requirement for this, so it's 100% only GTK.

If gufw can be built without webkit2gtk, I would greatly appreciate it, if you would please reply to let me know?

THANKS

costales commented 2 years ago

Hi, I don't remember the needs of this library. I will check ot, but I will not have time soon. Thank you for the feedback! Best regards!

0pLuS0 commented 2 years ago

HI @costales

I just removed webkit2gtk and tried to run gfufw, but it fails to run now without it;

~ pts/0 rog ~ >gufw
Traceback (most recent call last):
  File "/usr/lib64/python3.9/site-packages/gufw/gufw.py", line 21, in <module>
    from gufw.view.gufw  import Gufw
  File "/usr/lib64/python3.9/site-packages/gufw/gufw/view/gufw.py", line 21, in <module>
    gi.require_version('WebKit2', '4.0')
  File "/usr/lib64/python3.9/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace WebKit2 not available

It would be really great if you can code gufw to not need webkit2gtk, as it needs 5 more additional dependencies to compile it.

THANKS

costales commented 2 years ago

Hi,

What is happening if you remove this line: "gi.require_version('WebKit2', '4.0')" in the file "/usr/lib64/python3.9/site-packages/gufw/gufw/view/gufw.py", line 21

Thanks in advance!

0pLuS0 commented 2 years ago

Ok the UI came up, but now it shows this message;

~ pts/1 foo ~ >gufw /usr/lib64/python3.9/site-packages/gufw/gufw/view/gufw.py:21: PyGIWarning: WebKit2 was imported without specifying a version first. Use gi.require_version('WebKit2', '4.0') before import to ensure that the right version gets loaded. from gi.repository import Gtk, Gdk, WebKit2

costales commented 2 years ago

Hi,

Please, try then to change:

gi.repository import Gtk, Gdk, WebKit2

for:

import gi
gi.require_version('WebKit2', '4.0')
gi.repository import Gtk, Gdk, WebKit2
0pLuS0 commented 2 years ago

I don't understand leaving in Webkit2? It is what I am asking to remove the support for. So to remove WebKit2, shouldn't the lines look like this now?

import gi gi.require_version('Gtk', '3.0') gi.require_version('Gdk', '3.0') gi.repository import Gtk, Gdk

If I make the lines like above this is the terminal output.

~ >gufw Traceback (most recent call last): File "/usr/lib64/python3.9/site-packages/gufw/gufw.py", line 30, in gufw = Gufw(controler.get_frontend()) File "/usr/lib64/python3.9/site-packages/gufw/gufw/view/gufw.py", line 78, in init self._set_objects_name() File "/usr/lib64/python3.9/site-packages/gufw/gufw/view/gufw.py", line 116, in _set_objects_name self.web_content = WebKit2.WebView() NameError: name 'WebKit2' is not defined

I don't undestand why I am testing this, aren't you the developer? Gufw requires Webkit2 to run, I can't change any of the lines you are asking and make it run, because it wants Webkit2.

I showed you before a link for gufw for Arch Linux and Slackware, that shows Webkit2 as a dependancy.

THANKS

0pLuS0 commented 2 years ago

If I make it look like this, if I understand correctly;

import gi gi.require_version('Gtk', '3.0') gi.require_version('Gdk', '3.0') gi.require_version('WebKit2', '4.0') gi.repository import Gtk, Gdk, WebKit2

I get this at the terminal, it doesn't run;

~ >gufw Traceback (most recent call last): File "/usr/lib64/python3.9/site-packages/gufw/gufw.py", line 21, in from gufw.view.gufw import Gufw File "/usr/lib64/python3.9/site-packages/gufw/gufw/view/gufw.py", line 22 gi.repository import Gtk, Gdk, WebKit2 ^ SyntaxError: invalid syntax

costales commented 2 years ago

Hi,

I think you are not working with the last commits?

I don't find any gi.repository import Gtk, Gdk, WebKit2.

Best regards.

costales commented 2 years ago

Only GTK, there is no need for Webkit2gtk, or python-distutils-extra?

Hi, sorry, I just remembered, the webkit is necessary for the main Gufw tutorial. Best regards.

0pLuS0 commented 2 years ago

What do you mean tutorial, the Home button section?

I thought webkit was needed for the entire UI?

Can you please consider getting rid of this webkit dependency and having this work with just GTK?

Or maybe a simpler solution, if webkit is only for the tutorial section under the Home, could you please make the Home/Tutorial section a compiling option, so if users want, they can choose to disable/remove the Home button tutorial section?

So if the Home button is this Tutorial section you are talking about, and this is all that requires webkit, I'd greatly appreciate you please considering having a compile option to disable/remove the tutorial section in gufw.

THANKS

costales commented 2 years ago

Hi, yes that tutorial in 1st screen. If someone can develop it, it is welcome! Best regards

0pLuS0 commented 2 years ago

Hi,

I thought you are the developer of GUFW, and you coded this for webkit?

So I assumed you could change it in time from webkit to gtk.

But as I was mentioning before, if the simplest thing to do for you is making a compile option to enable/disable this, that is all I am asking for, an option to disable this at compile time.

Or, just remove the Tutorial section, and have the tutorial online and in the man pages. I would of assumed, this makes the coding easier for you in the future.

I really appreciate your time, and considering all of this.

Thank you very much!

0pLuS0 commented 2 years ago

You're the developer, or you don't have the time to do this?

THANKS

costales commented 2 years ago

Hello, I'm sorry, but I don't work on demand. All the software I developed I developed for myself, but as a believer in free software, I released it under a free license. The main tutorial is a key feature and I want it. Anyway, I don't have the time or knowledge for migrating from webkit to GTK. A hug.

0pLuS0 commented 2 years ago

Ok, if things might change in the future to change this, I'm sure a lot of the Linux community out there will also greatly appreciate this, because this takes 5 additional dependencies to compile, for webkit.

If it were GTK only, it wouldn't need all these extra dependencies to compile.

Don't we all hate bloat? LOL :)

THANKS

udpcachefix commented 5 months ago

I don't really see the hustle or problem about this.

Here is the fix for the "non-existing file" you're trying to execute:

  1. Move the cloned repo to a folder where you're not going to touch or delete it
  2. Go to the actual install folder, which should be /usr/bin and here should be a file named gufw-pkexec
  3. Open it with nano, vim, or whatever text editor your choice
  4. Edit the location to the file where you saved the repo:
#!/bin/bash
python3 /home/your_user_name/Documents/gufw/gufw/gufw.py $1
  1. Either start it via the menu, or via the console/terminal

What it does is simple: It refers to the file in the original repo to start it. I am not the dev, I didn't have a look at the code, and I am not sure I will, thus I also don't know why it installs the shortcut somewhere else, when it's simply being lunched anyways from the source repo (?), but whatever, it works and that is what counts for me.

Ironically, going by the logic of the "fix", you don't even have to install it, you just clone the repo, secure it somewhere else and simply lunch the gufw.py (existing in /home/your_user_name/Documents/gufw/) file from there.

Hope that helps, cheers!

Edit: Note that I use Fedora 39 Workstation and did have all dependencies installed before.

2024-04-18_08-16

0pLuS0 commented 5 months ago

@udpcachefix You're like almost 2 years late to the party LOL...

This issue has been long ago fixed in the latest version.

udpcachefix commented 5 months ago

Weird. Why did I still receive the bug/error then? Thus I looked it up and commented here.. anyways, disregard it then.

Cheers