Skip to content

Commit

Permalink
Update Windows Packaging
Browse files Browse the repository at this point in the history
* Rename instances of win32 to generic win or the appropriate bit where applicable
* Remove files used in GTK2
* Add spec file for use with PyInstaller
* Remove Python bbfreeze Script
* Add Github Action To Build Releases
* Add Modified script to make files used by NSIS
* Update Readme
  • Loading branch information
doadin committed Jan 4, 2022
1 parent 44dcbee commit 884c8e7
Show file tree
Hide file tree
Showing 41 changed files with 1,007 additions and 1,290 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/cd.yml
@@ -0,0 +1,114 @@
name: CD

on:
push:
tags:
- '*'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
Build-Windows-x64:
runs-on: windows-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: 'x64'

- name: Cache pip
uses: actions/cache@v2
with:
path: '%LOCALAPPDATA%\pip\Cache'
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('tox.ini', 'setup.py', 'requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://ci.appveyor.com/api/buildjobs/wgsvc79ov8jsy8dc/artifacts/gvsbuild-vs16-x86.zip","C:\GTK.zip")
7z x GTK.zip.zip -oc:\GTK
$env:Path = "C:\GTK\release;$env:Path"
python -m pip install --upgrade pip wheel
python -m pip install libtorrent==1.2.*
pip install -r requirements.txt
pip install pyinstaller
- name: Install Deluge
run: |
python setup.py clean
python setup.py build
python setup.py install
- name: Freeze Deluge
run: |
pyinstaller --clean C:\deluge\packaging\win\delugewin64.spec --distpath C:\deluge\packaging\win\freeze
- name: Make Deluge Installer
run: |
Set-Location -Path 'C:\deluge\packaging\win'
python delugensis.py
makensis deluge-win64-installer.nsi
Build-Windows-x86:
runs-on: windows-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: 'x86'

- name: Cache pip
uses: actions/cache@v2
with:
path: '%LOCALAPPDATA%\pip\Cache'
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('tox.ini', 'setup.py', 'requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://ci.appveyor.com/api/buildjobs/wgsvc79ov8jsy8dc/artifacts/gvsbuild-vs16-x86.zip","C:\GTK.zip")
7z x GTK.zip.zip -oc:\GTK
$env:Path = "C:\GTK\release;$env:Path"
python -m pip install --upgrade pip wheel
python -m pip install libtorrent==1.2.*
pip install -r requirements.txt
pip install pyinstaller
- name: Install Deluge
run: |
python setup.py clean
python setup.py build
python setup.py install
- name: Freeze Deluge
run: |
pyinstaller --clean C:\deluge\packaging\win\delugewin32.spec --distpath C:\deluge\packaging\win\freeze
- name: Make Deluge Installer
run: |
Set-Location -Path 'C:\deluge\packaging\win'
python delugensis.py
makensis deluge-win32-installer.nsi
22 changes: 22 additions & 0 deletions packaging/win/README.txt
@@ -0,0 +1,22 @@
= Deluge Installer for Windows =

Instructions for building the Deluge NSIS Installer for Windows Vista/7/8/8.1/10/11.

== Dependencies ==
* Deluge build: http://dev.deluge-torrent.org/wiki/Installing/Source#WindowsDependencies
* PyInstaller: https://pypi.org/project/pyinstaller/
* NSIS: http://nsis.sourceforge.net/Download

== Build Steps ==

1. Build and Install Deluge on Windows.

2. Run the pyinstaller from the deluge\packaging\win directory with delugewin64.spec if you built deluge with 64-bit python or delugewin32.spec with 32-bit python:

pyinstaller --clean delugewin64.spec --distpath .\packaging\win32\freeze

The result is a PyInstaller version of Deluge in `packaging\win32\freeze`.

3. Run the NSIS script (right-click and choose `Compile with NSIS`)

The result is a standalone installer in the `packaging\win32` directory.
Expand Up @@ -9,7 +9,7 @@
#

# Script version; displayed when running the installer
!define DELUGE_INSTALLER_VERSION "1.0"
!define DELUGE_INSTALLER_VERSION "2.0"

# Deluge program information
!define PROGRAM_NAME "Deluge"
Expand All @@ -22,8 +22,6 @@
!define LICENSE_FILEPATH "..\..\LICENSE"

# Python files generated with bbfreeze
!define BUILD_DIR "build-win32"
!define BBFREEZE_DIR "${BUILD_DIR}\deluge-bbfreeze-${PROGRAM_VERSION}"
!define INSTALLER_FILENAME "deluge-${PROGRAM_VERSION}-win32-setup.exe"

# Set default compressor
Expand Down Expand Up @@ -69,8 +67,6 @@ Var StartMenuFolder
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
# Run installation
!insertmacro MUI_PAGE_INSTFILES
# Popup Message if VC Redist missing
Page Custom VCRedistMessage
# Display 'finished' page
!insertmacro MUI_PAGE_FINISH
# Uninstaller pages
Expand Down Expand Up @@ -105,54 +101,15 @@ Function finishpageaction
CreateShortCut "$DESKTOP\Deluge.lnk" "$INSTDIR\deluge.exe"
FunctionEnd

# Test if Visual Studio Redistributables 2008 SP1 installed and returns -1 if none installed
Function CheckVCRedist2008
Push $R0
ClearErrors
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}" "Version"
IfErrors 0 +2
StrCpy $R0 "-1"

Push $R1
ClearErrors
ReadRegDword $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9BE518E6-ECC6-35A9-88E4-87755C07200F}" "Version"
IfErrors 0 VSRedistInstalled
StrCpy $R1 "-1"

StrCmp $R0 "-1" +3 0
Exch $R0
Goto VSRedistInstalled
StrCmp $R1 "-1" +3 0
Exch $R1
Goto VSRedistInstalled
# else
Push "-1"
VSRedistInstalled:
FunctionEnd

Function VCRedistMessage
Call CheckVCRedist2008
Pop $R0
StrCmp $R0 "-1" 0 end
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Deluge requires an MSVC package to run \
but the recommended package does not appear to be installed:$\r$\n$\r$\n\
Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)$\r$\n$\r$\n\
Would you like to download it now?" /SD IDNO IDYES clickyes
Goto end
clickyes:
ExecShell open "https://www.microsoft.com/en-us/download/details.aspx?id=26368"
end:
FunctionEnd

# --- Installation sections ---
!define PROGRAM_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}"
!define PROGRAM_UNINST_ROOT_KEY "HKLM"
!define PROGRAM_UNINST_FILENAME "$INSTDIR\deluge-uninst.exe"

BrandingText "${PROGRAM_NAME} Windows Installer v${DELUGE_INSTALLER_VERSION}"
Name "${PROGRAM_NAME} ${PROGRAM_VERSION}"
OutFile "${BUILD_DIR}\${INSTALLER_FILENAME}"
InstallDir "$PROGRAMFILES\Deluge"
OutFile "${INSTALLER_FILENAME}"
InstallDir "$PROGRAMFILES32\Deluge"

ShowInstDetails show
ShowUnInstDetails show
Expand Down

0 comments on commit 884c8e7

Please sign in to comment.