#3201: Create Windows package (Py3-GTK3)
------------------------------+---------------------
  Reporter:  Cas              |      Owner:
      Type:  feature-request  |     Status:  new
  Priority:  major            |  Milestone:  2.1.x
 Component:  Packaging        |    Version:  develop
Resolution:                   |   Keywords:
------------------------------+---------------------
Changes (by tobbez):

 * cc: tobbez@… (added)


Comment:

 Issues I noticed while trying to run Deluge 2 on Windows:

   1. `start_daemon` mixes `bytes` and `str` when calling
 `subprocess.Popen`: https://dev.deluge-torrent.org/ticket/3313#comment:2

   2. The GdkPixbuf (from gvsbuild) seems to have a problem that causes
 deluge to exit with an access violation¹ after attempting to loading a few
 .ico files (some of which are invalid). There are no messages in the debug
 log, but if running in a console it produces the following output:
 {{{
 c:\apps\deluge2\venv\lib\site-packages\deluge\ui\gtk3\common.py:75:
 Warning: cannot register existing type 'GdkPixbufGdipAnim'
   return Pixbuf.new_from_file_at_size(filename, size, size)
 c:\apps\deluge2\venv\lib\site-packages\deluge\ui\gtk3\common.py:75:
 Warning: g_once_init_leave: assertion 'result != 0' failed
   return Pixbuf.new_from_file_at_size(filename, size, size)
 c:\apps\deluge2\venv\lib\site-packages\deluge\ui\gtk3\common.py:75:
 Warning: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT
 (object_type)' failed
   return Pixbuf.new_from_file_at_size(filename, size, size)
 }}}
   For now I just patched deluge's `get_pixbuf_at_size` (in
 `deluge\ui\gtk3\common.py`) and prepended the 4 lines to it:
 {{{
 #!python
 def get_pixbuf_at_size(filename, size):
     # current GdkPixbuf is broken somehow and crashes after loading some
 number of ico files
     if filename.endswith('.ico'):
         log.warning('Returning blank pixbuf instead of loading file:
 {}'.format(filename))
         return create_blank_pixbuf(size)
 }}}
   That prevents the crash, but obviously means you won't see icons for
 trackers that use .ico.

 3. The twisted `simulate` issue that has been mentioned previously.

 4. Deluge 2 fails to load a state file from Deluge 1.3.x:
 {{{
 Traceback (most recent call last):
   File "c:\apps\deluge2\venv\lib\site-packages\twisted\internet\base.py",
 line 1292, in mainLoop
     self.runUntilCurrent()
   File "c:\apps\deluge2\venv\lib\site-packages\twisted\internet\base.py",
 line 913, in runUntilCurrent
     call.func(*call.args, **call.kw)
   File "c:\apps\deluge2\venv\lib\site-packages\twisted\internet\defer.py",
 line 460, in callback
     self._startRunCallbacks(result)
   File "c:\apps\deluge2\venv\lib\site-packages\twisted\internet\defer.py",
 line 568, in _startRunCallbacks
     self._runCallbacks()
 --- <exception caught here> ---
   File "c:\apps\deluge2\venv\lib\site-packages\twisted\internet\defer.py",
 line 654, in _runCallbacks
     current.result = callback(current.result, *args, **kw)
   File "c:\apps\deluge2\venv\lib\site-packages\twisted\internet\task.py",
 line 866, in <lambda>
     d.addCallback(lambda ignored: callable(*args, **kw))
   File "c:\apps\deluge2\venv\lib\site-
 packages\deluge\core\torrentmanager.py", line 239, in start
     self.load_state()
   File "c:\apps\deluge2\venv\lib\site-
 packages\deluge\core\torrentmanager.py", line 832, in load_state
     state = self.open_state()
   File "c:\apps\deluge2\venv\lib\site-
 packages\deluge\core\torrentmanager.py", line 812, in open_state
     state = pickle.load(_file)
 builtins.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
 position 19: ordinal not in range(128)
 }}}
   This is likely only a problem when the state files contains non-ASCII,
 and can be worked around by manually converting the state file by opening
 a Python interpreter and running:
 {{{
 #!python
 import pickle
 with open('torrents.state', 'rb') as f:
     d = pickle.load(f, encoding='latin1')

 with open('torrents.state', 'wb') as f2:
     pickle.dump(d, f2)
 }}}

 5. When starting the daemon (deluged) when using the thin client, the
 daemon spawns a console window.

   That happens because it's started by `python` instead of `pythonw`,
 which could be solved upstream by moving the `deluged` entry point in
 `setup.py` to `gui_scripts`².

   It also seems like the extra entry point executables (`deluge-debug.exe
 `/`deluged-debug.exe`/`deluge-web-debug.exe`) specified in `setup.py` do
 not get installed.

   As workaround (for users who just want to get this working locally)
 running something like the following to convert the executable should
 work:
 {{{
 #!python
 # replace PYTHONDIR with the root of your Python installation
 with open(r'PYTHONDIR\Lib\site-packages\pip\_vendor\distlib\w64.exe',
 'rb') as f:
     launcher = f.read()
 with open(r'...\path\to\deluged.exe', 'rb') as f:
     d = f.read()
 with open(r'...\path\to\deluged.exe', 'wb') as f:
     f.write(launcher)
     f.write(d[d.rindex(b'#!'):])
 }}}

   But make a backup copy of deluged.exe first.


 ¹: `echo %errorlevel%` after it exits yields `-1073741819` (=
 `0xc0000005`)

 ²: Non-windows platforms should not be affected since `gui_scripts` are
 handled just like `console_scripts` there

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3201#comment:32>
Deluge <https://deluge-torrent.org/>
Deluge Project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/deluge-dev/057.96868456e991b83c037894e47b2c539b%40deluge-torrent.org.

Reply via email to