Opened 10 months ago

Last modified 14 hours ago

#3201 new feature-request

Create Windows package (Py3-GTK3)

Reported by: Cas Owned by:
Priority: major Milestone: 2.1.x
Component: Packaging Version: develop
Keywords: Cc:

Description (last modified by Cas)

With the move to a GTK3 UI we need a way to easily create the Windows package.

I am not sure what the best route is going to be but we need something that can always get the latest versions of GTK3 as we had to use outdated PyGTK versions as no other builds existed.

It would be good to drop the usage of MSVC and go with msys2 but there are hurdles to doing that with regards to Twisted and pywin32 (see #3181). These are the steps for another GTK3 project building with msys2:

https://www.gramps-project.org/wiki/index.php/Gramps_for_Windows_with_MSYS2

Alternatively we continue with MSVC and roll our own GTK3 builds:

https://github.com/wingtk/gvsbuild

We will also need to move from bbfreeze to most likely pyinstaller but that is further down the road: Freezing comparison

Help or suggestions with this would be appreciated as primary development is on Ubuntu.

Change History (18)

comment:1 Changed 10 months ago by Cas

  • Description modified (diff)

comment:2 Changed 10 months ago by Cas

  • Description modified (diff)

comment:3 Changed 10 months ago by Doadin

Not sure if it will make a difference but back when I was first starting to make GTK3 changes to deluge I did some work updating bbfreeze to have better module finding and python 3 support. I got all of the python code to python 3 but the python c api portion I could not fix.(it doesnt need much) The code is on my github under ccfreeze if you want to try it out.

comment:4 Changed 10 months ago by Cas

Yeah thanks, I remember I was impressed you got that working. However bbfreeze is a dead project now and doesn't officially support Python 3 or GTK3 so we need to move on, despite it serving us well.

Last edited 10 months ago by Cas (previous) (diff)

comment:5 Changed 8 months ago by Cas

So I have had some success testing out building with gvsbuild scripts and I have created a fork of gvsbuild so the job artifacts can be downloaded from appveyor:

https://ci.appveyor.com/project/cas--/gvsbuild

Currently there are a few windows specific issues with the deluge code:

  • Remove py2-ipaddress lines from setup.py and requirements.txt.
  • Comment out the entire last try..except in deluge.common.set_env_variable.

Extract the gvsbuild tarball and add to path. From console in deluge source dir:

set PATH=C:\gvsbuild\release;%PATH%
pip install C:\gvsbuild\release\python\pycairo-1.17.1-cp36-cp36m-win_amd64.whl
pip install C:\gvsbuild\release\python\PyGObject-3.28.3-py3.6-win-amd64.whl
pip install -r requirements.txt
pip install -e .

lt RC_1_1: https://ci.appveyor.com/project/cas--/libtorrent/builds/20516558/artifacts

Last edited 4 months ago by Cas (previous) (diff)

comment:6 Changed 8 months ago by Cas

To get a nicer theme create a file: C:\gvsbuild\release\etc\gtk-3.0\settings.ini with the following:

[Settings]
gtk-theme-name=win32

comment:7 Changed 8 weeks ago by Cas

  • Summary changed from GTK3 Windows build to Create Windows package (Py3-GTK3)

comment:8 Changed 6 weeks ago by Cas

  • Milestone changed from 2.0.0 to 2.1.x

Ticket retargeted after milestone closed

comment:9 follow-up: Changed 6 weeks ago by Cas

An update to the above steps:

  1. Download latest GTK 3.24 gvsbuild tarball and extract to C:\gvsbuild:

https://ci.appveyor.com/project/cas--/gvsbuild/build/artifacts

  1. Download and install latest Python 3.6:

https://www.python.org/downloads/release/python-368/

  1. Install python dependencies
pip.exe install C:\gvsbuild\release\python\pycairo-1.18.0-cp36-cp36m-win_amd64.whl
pip.exe install C:\gvsbuild\release\python\PyGObject-3.32.0-cp36-cp36m-win_amd64.whl
pip.exe install https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/Twisted-19.2.1-cp36-cp36m-win_amd64.whl
pip.exe install https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/setproctitle-1.1.10-cp36-cp36m-win_amd64.whl

  1. Install deluge
    pip.exe install deluge deluge-libtorrent
    
  1. deluge-libtorrent wheel currently needs OpenSSL 1.1.0 installed:

https://slproweb.com/download/Win64OpenSSL_Light-1_1_0k.exe

  1. Install MC VC Runtime:

https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

  1. Check that libtorrent definitely imports with:
    python -c "import libtorrent; print(libtorrent.__version__)"
    
  1. Run deluge:
set PATH=C:\gvsbuild\release\bin;%PATH%
deluge.exe

The gvsbuild path can be added to global env vars to save setting each time.

Last edited 5 weeks ago by Cas (previous) (diff)

comment:10 Changed 5 weeks ago by DjLegolas

Windows 10, python3.7, lt-1.2.1 confirmed working.

comment:11 Changed 5 weeks ago by Doadin

I just restarted remaking my build systems to update for gtk3 testing again and pretty much same setup 64-bit and it works except still the libintl name change. https://github.com/deluge-torrent/deluge/pull/226/commits/34d24ebe0579fd0cde6934e5460762bb60152224 is that just me or? gtk 3.24? idk.

Last edited 5 weeks ago by Doadin (previous) (diff)

comment:12 follow-up: Changed 5 weeks ago by Doadin

Also still getting an error with the simulate() workaround in connection manager

  File "C:\Python\Python37\lib\site-packages\deluge-2.0b2.dev302-py3.7.egg\deluge\ui\gtk3\connectionmanager.py", line 144, in show
    reactor.simulate()
  File "C:\Python\Python37\lib\site-packages\twisted\internet\_glibbase.py", line 385, in simulate
    timeout = min(self.timeout(), 0.01)
TypeError: '<' not supported between instances of 'float' and 'NoneType'

it seems a timeout is not set. seems like it would be better if the twisted code checked to see if timeout is set before calling it.

        if timeout is None:
            timeout = 0.01
        timeout = min(self.timeout(), 0.01)

instead of 

        timeout = min(self.timeout(), 0.01)
        if timeout is None:
            timeout = 0.01

but is there something we are missing?

comment:13 in reply to: ↑ 12 Changed 5 weeks ago by Cas

Replying to Doadin:

Also still getting an error with the simulate() workaround in connection manager

  File "C:\Python\Python37\lib\site-packages\deluge-2.0b2.dev302-py3.7.egg\deluge\ui\gtk3\connectionmanager.py", line 144, in show
    reactor.simulate()
  File "C:\Python\Python37\lib\site-packages\twisted\internet\_glibbase.py", line 385, in simulate
    timeout = min(self.timeout(), 0.01)
TypeError: '<' not supported between instances of 'float' and 'NoneType'

Create a new upstream ticket: https://twistedmatrix.com/trac/newticket

It is an issue with migrating Twisted to Python 3. Python 2 was happy to compare different types but Python 3 is stricter and raises a TypeError.

Your suggested fix needs tweaked:

-        timeout = min(self.timeout(), 0.01)
-        if timeout is None:
-            timeout = 0.01
+        timeout = self.timeout()
+        if timeout is None:
+            timeout = 0.01
+        timeout = min(timeout, 0.01)

In Deluge probably just catch the error and pass or remove it, if it does nothing anymore. The associated comment is not so helpful:

# XXX: We need to call a simulate() here, but this could be a bug in twisted

comment:14 Changed 4 weeks ago by Doadin

ok so i have reported up. and yea seems like we need something to change in deluge, though doesn't seem like we have too many options other than just ignore it as in python 3 this error stops the connection manager from opening at least the first few times you hit it.(i find if i open preferences then connection manager it opens first time). However this is almost as annoying as the issue simulate solves.

comment:16 Changed 12 days ago by Jay-C

  • Cc niklas.holm.271@… added

comment:17 Changed 12 days ago by Jay-C

  • Cc niklas.holm.271@… removed

Apparently I can't figure out how to just follow an issue. Hopefully leaving a comment will do the trick.

Keep up the good work :)

comment:18 in reply to: ↑ 9 Changed 14 hours ago by OishikR

Replying to Cas:

An update to the above steps:

...

  1. Install python dependencies
pip.exe install https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/Twisted-19.2.1-cp36-cp36m-win_amd64.whl
pip.exe install https://download.lfd.uci.edu/pythonlibs/t4jqbe6o/setproctitle-1.1.10-cp36-cp36m-win_amd64.whl

...

Hey all, thanks for the great work you do (that goes straight over my head!). I'm just commenting to point out that these two links that I've pointed out in this reply are no longer valid, and will throw 404 errors. It seems the LFD website has been restructured, and there's not an easily apparent way to get to these modules. I'm trying to install Twisted and setproctitle via pip, and I'll update you guys if it goes wrong.

Note: See TracTickets for help on using tickets.