*OLD-THREAD - SEE NEW* [Unofficial] Deluge 2.0.x installer

Specific support for Deluge on Microsoft Windows OS
echelon
New User
New User
Posts: 8
Joined: Mon Feb 10, 2020 3:26 am

Re: [Unofficial] Deluge 2.0.x installer.

Post by echelon »

Can you please share your modifications/patches for all of those listed above?, another question is how to make the installer?, because bbfreeze doesn't exist for python 3.7? I have fallen in love in deluge, after tested bitcomet and qbittorrent and also tixati, it's the best throughput that i can get from torrents.
mhertz
Moderator
Moderator
Posts: 2331
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Unofficial] Deluge 2.0.x installer.

Post by mhertz »

I can zip up patches and batch files to you if wanted, but I made it only for myself so you will not be able to use it without changing file paths and I use git and patch from cygwin + specific version of msvc build tools which is 3gb installed etc. Also you need same folder-setup as me where my scripts copy files from and to, so I doubt you can use it for much except inspiration, e.g I have a folder with unpacked gtk3 with crap removed which my script copies over etc. Let me know if you want it anyway and I'll zip it up and upload when having time, though not today as middle of night here and I'll late for sleep as is :)

As for installer, then doadin is working on it and pretty close to finished making pyinstaller work instead of bbfreeze.

I spend alot of time making it work without a freezing solution available i.e patching exe's to not include hard-coded paths to python(w).exe and abuse pth files for adding needed entries to PATH env-dir just for the running session etc. Then changing NSIS installer script to install instead of from bbfreeze then a folder I specified and it's subfolders and call makensis.exe to build it, instead of using deluge's script.
echelon
New User
New User
Posts: 8
Joined: Mon Feb 10, 2020 3:26 am

Re: [Unofficial] Deluge 2.0.x installer.

Post by echelon »

@mhertz
Yes please, do upload it, it might be helpful for my struggle, btw how to debug deluge-gtk.exe log?, when my deluge-gtk.exe started it just close itself. Also how our self-compiled PyGObject able to load the gtk-3-vs16.dll library?, it might that's why my compiled deluge-gtk.exe doesn't do anything.

EDIT:
Ah, so we need to add the C:\gtk-build\gtk\x64\release\bin to %PATH%, now it works!!!
I spend alot of time making it work without a freezing solution available i.e patching exe's to not include hard-coded paths to python(w).exe and abuse pth files for adding needed entries to PATH env-dir just for the running session etc. Then changing NSIS installer script to install instead of from bbfreeze then a folder I specified and it's subfolders and call makensis.exe to build it, instead of using deluge's script.
Can you share above mentioned howto or patches also?
mhertz
Moderator
Moderator
Posts: 2331
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Unofficial] Deluge 2.0.x installer.

Post by mhertz »

I've zip'ed up the patches and batchfiles for deluge and libtorrent and NSIS install-script + the folders I use.

I just added all folders into the zip even though they where in different places.

The NSIS script is some folders down in the nsis folder and the deluge-build and libtorrent-build are the main folders for building - one batchfile for deluge-stable and one for deluge-git and one for libtorrent 1.1.x and another for 1.2.x.

Some of the filepaths have little strange names and can be named after older versions of components which I didn't cared to change since everything was automated and worked fine anyways and was from earlier times where I had to do things manually and rename folders etc.

Also a folder in batchfiles I reference alot is 7zsfx, and that was also from earlier times where the installer where in 7z sfx format, but nothing to do with 7z now though.

The zip is little big, 121mb or so, because I included a folder named overlay which my build-scripts copy over when deluge is build, and in there are stripped gtk3, libtorrent, PTH file, openssl, runtimes and various other files fixing stuff, eg for localisation or geoip etc.

I run in batchfiles an extra git clone and plugin-build of deluge, because fix a bug with not installing plugins for some reason when build, so I build them seperately afterwards and copy over to correct place in a second run.

Please ask specific questions about something you wanna know more about and i'll answer, as documenting the whole thing would take me way to long sorry.

Ohh, my batchfiles patch exe's twise, using two different py files, because one fixes hardcoded paths and the other fixes something else i.e. even though the first patching also fixes another bug with changing python.exe to pythonw.exe(in addition to stripping filepaths to python), then a cmd window opens when running daemon regardless, same as if changing files with vim or notepad++ or whatever, so the second patching fixes that.

Last, the default theme is win32 in my installer, but to fix a bug in that theme which is built-into gtk3 at compile-time, then I checked the files out from git and ran the small bugfix and added the files to installer as win32x theme, as had to use other name, as win32 is reserved name and wouldn't pick up the fix - the fix I found in gtk3 bugtracker btw. Just a small fix stopping printing error on console multiple times during runtime. Forgot list that in my "changelog", but is also not important at all.

(Also, I run rd commands twice often because windows bug sometimes leaves dir still if not - workaround suggested on stackexchange/superuser, which I tested working - found issue by chance back when I provided install and uninstall batch files for deluge2)

https://1drv.ms/u/s!Ajl1yq0BfB-d7BQO3yM ... 3?e=NeP0sy
echelon
New User
New User
Posts: 8
Joined: Mon Feb 10, 2020 3:26 am

Re: [Unofficial] Deluge 2.0.x installer.

Post by echelon »

Thanks a lot, much appreciated it, currently trying to understand your steps, but could you please tell me your steps on how to build deluge develop branch?
mhertz
Moderator
Moderator
Posts: 2331
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Unofficial] Deluge 2.0.x installer.

Post by mhertz »

Pretty much same as stable deluge, just using other branch for building i.e. develop vs master(master branch points to latest stable version).

My batch file does following:

Downloads latest available python 3.7.x available at current time and installs it.

Installs all deps and deluge with pip and for deluge then pip is just pointed at develop git branch instead of master branch for stable deluge. This needs obviously git installed, and I had to run it in batchfile from cygwin instead of cmd, because gave error when run from cmd(patch from cygwin didn't have such behaviour, so use cmd to run that).

Just in case deletes any possible deluge left-over folder if available in my cygwin homedir, and then from cygwin clones deluge's git-develop branch, which is the default branch, so no need to specify branch there. Again I do it in batch file from cygwin as git fails when run from cmd. Just install git for windows and change batchfile to just run 'git clone xxxx' and find patch from gnuwin32 or something - possibly you can use 'git apply' from git for windows, instead of patch(I checked before in it's docs it supports local files also, and not just git-repo's, and same flags too, but I anyway had cygwin installed, so I could start VM headless from command-line in linux and ssh into and run commands - I know win10 also has ssh server now, but prefered cygwin for linux terminal and vi, grep, sed, patch, diff etc.).

CD into cloned folder and run some commands to get develop-version-number into variable so as to know what to name the finished folder as, after everything is finished and copied over to where built releases are stored, but you don't need that i'd say - I just use that also from script when building installers later on so they are also named and listing correct version number there.

Command run to build plugins only, as they are missing from previous deluge install because some bug. Then build plugins are copied over to built deluge and the clone just made/built for plugins are deleted again.

Patches applied and deluge exe's are moved out of Scripts folder and into deluge main folder. Scripts folder deleted as useless now and then all exe's patched twise to fix bug with calling python.exe instead of pythonw.exe and deleting path to that, so it's not referencing deluge2 folder under %programfiles% anymore, but just "pythonw.exe", so can be used in an installer now and distributed(though needs my pth file which in addition to add to PATH then also changes current dir to the deluge dir, as else you'd need to CD to deluge dir first to run deluge and a shortcut wouldn't work, but does with this in place).

Contents of overlay folder are copied into deluge folder, so gtk3, libtorrent, openssl, runtimes and PATH/cd pth hack etc are in place propperly.

Unused crap deleted.

Old built deluge folder is deleted from it's stored place and new built deluge is copied over instead and named after it's version-release.

Python and deluge is uninstalled again from it's original place under %programfiles% and it's left-over folder there also deleted afterwards, and initially downloaded python installer deleted.

That should be it :)
pwhodges
New User
New User
Posts: 9
Joined: Sat Sep 28, 2013 8:19 pm

Re: [Unofficial] Deluge 2.0.x installer.

Post by pwhodges »

I've just installed using your v2.0.3 installer (I don't know whether the 2.0.4 is considered good to go), and it has installed very smoothly. I uninstalled the old version first, just to be clean.

Everything seems fine - all my torrents are seeding as before, and I am seeing uploads going on. But one thing I cannot find an explanation for: all my trackers are being shown in an error state: "Error: The system cannot open the device or file specified". I can't see any reason for this, and the only change in the system is the installation of the new version of Deluge, which is why I've mentioned it here; I can't see what is not happening as a result of this, either. The server has good Internet access, as it also runs my web and mail servers.

Any ideas?
mhertz
Moderator
Moderator
Posts: 2331
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Unofficial] Deluge 2.0.x installer.

Post by mhertz »

... Just wanted to explain, just in case, that the NSIS script I setup to when right clicking and select build with NSIS, then it builds very quickly and is just 1 mb big installer - that was because I spend alot of time making the NSIS code for the added checkboxes where checking one should unchech another etc + the portable mode, and ran alot of tests with that and didn't want to wait so long each time on the building of the big deluge installer, when I just needed check the installer worked and nothing else, so I changed it to just install some small files from random folder by default when right clicking it to build installer, which was what I did when testing, and then when building the actual installers I start that from another batch file instead, makensis.cmd, which defines to here use the actual big deluge files there as not testing here and also finds out which version of deluge currently is, and adds that to installer both as file-name and for the installer to display correctly during install. Seems little confusing but works great for me :)

Ohh, there are a section of descriptions for the checkboxes, which has little outdated contents, and I forgot to delete that, but is from older times and currently is overridden by another function disabling descriptions and making dialog bigger to hold all the new checkboxes.

Last, I use an extra third-party NSIS plugin nsprocess to kill deluge* processes silently if found when installing starts, instead of as before quit with error later, plus I added another function I needed for something else, sorry cannot remember and not home now to check, but you can check in the include defines in the NSIS script.

Edit: don't remember function name, but remember I used it for adding some code making sure you couldn't select to install in system32 or direct in programfiles without deluge folder etc, also because I added code to delete that folder first so direct upgrades where same as clean install.
echelon
New User
New User
Posts: 8
Joined: Mon Feb 10, 2020 3:26 am

Re: [Unofficial] Deluge 2.0.x installer.

Post by echelon »

Managed to compiled and run :-), thanks a lot to you for the files and examples, but i have got some quirks, for example

I need to add all deluge*.py and deluge*.pyw from the %PYTHON37_PATH%\Scripts into my Deluge2 built root dir, unless it complained about "Cannot open C:\Program Files\Deluge2\deluge-console-script.py", also on searching inside for example deluge-gtk.exe, i cannot found any reference at all regarding either "python.exe" or "pythonw.exe" inside of all deluge built executables.

So these commands are cannot found the references into either "python.exe" or "pythonw.exe" inside the executables

Code: Select all

python portable.py -f "%programfiles%\Deluge2\deluged.exe" -s "c:\program files\deluge2\python.exe" -r pythonw.exe
python portable.py -f "%programfiles%\Deluge2\deluged-debug.exe" -s "c:\program files\deluge2\python.exe" -r pythonw.exe
python portable.py -f "%programfiles%\Deluge2\deluge-web.exe" -s "c:\program files\deluge2\python.exe" -r pythonw.exe
python portable.py -f "%programfiles%\Deluge2\deluge-web-debug.exe" -s "c:\program files\deluge2\python.exe" -r pythonw.exe
python portable.py -f "%programfiles%\Deluge2\deluge.exe" -s "c:\program files\deluge2\pythonw.exe" -r pythonw.exe
python portable.py -f "%programfiles%\Deluge2\deluge-debug.exe" -s "c:\program files\deluge2\python.exe" -r pythonw.exe
python portable.py -f "%programfiles%\Deluge2\deluge-gtk.exe" -s "c:\program files\deluge2\pythonw.exe" -r pythonw.exe
python portable.py -f "%programfiles%\Deluge2\deluge-console.exe" -s "c:\program files\deluge2\python.exe" -r python.exe
Also another differences are, all of deluge2 built executables are in range of ~70 KB, while yours are in ~100 KB, so i assume your built executables is embedding those deluge*.py and deluge*.pyw from Scripts folder?, if so how to embedded these files?, so i don't need to copies all those deluge*.py and deluge*.pyw from Scripts folder?

my deluge2 build commands was pretty simple :

Code: Select all

python setup.py build
python setup.py install
mhertz
Moderator
Moderator
Posts: 2331
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Unofficial] Deluge 2.0.x installer.

Post by mhertz »

Yeah sorry, I must admit I don't know what the issue is and have experienced it also myself i.e. not exe's only py files in scripts folder for the deluge files, which is exactly why I after lots of testings decided to resort to install deluge using pip,exe which supports installing from both git and I believe also tarball/zip or extracted tarball/zip. I honestly cannot remember if I have tried to install with pip.exe from a source archive, or unpacked archieve, so maybe that will work too(though I believe I tried and got errors there too, but unsure honestly, long time ago - note the whl wheel files installed with pip.exe from script isn't source files but directly compiled, so this is different from source-archives as talked about here), but after I found it worked with pip.exe and git, then I hold on to that working solution, which does resort in correct exe's and not py's for the deluge binaries. The only issue there is no plugins made, though I can build them in second run anyway. Of course for deluge 2.0,3 you could install the package from pipy Cas uploaded, though no debug exe's there, since why I ditched that, possibly more reasons cannot remember fully now.

Here's a quick thread I found about installing through pip.exe from downloaded source archive, which you can download from github.

Sorry I couldn't help with the main building command and issue, and if others know what the issue is then please chime in - not that I need it myself as prefer using git anyway, but would like to know regardless + would help echelon :)

Good luck!

Edit: Forgot link, sorry: https://stackoverflow.com/questions/360 ... ip-install
Post Reply