Skip to content

Commit

Permalink
download wheel and wkhtmltopdf on exe build
Browse files Browse the repository at this point in the history
  • Loading branch information
dayesouza committed Apr 4, 2024
1 parent 63583ae commit 4d036a0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ For you to build locally, you will need to have pynsis intalled with `pip instal
**Tip**: Use Windows to build it, not Linux.

Run `.\installer_script.ps1` in the root of the app.
It will download wkhtmltox from the source, that's needed to generate reports. Then it will build an .exe into build\nsis, that will include wkhtmltox package installation.
It will download wkhtmltox from the source, that's needed to generate reports.
Then it will download python-louvain wheel, because it's not on pypi and it's needed for pynsist.
Then it will build an .exe into build\nsis.

It takes a while to finish, but then you can install it and open the shortcut to open intelligence-toolkit into http://localhost:8501

# Deploying

Expand Down
40 changes: 33 additions & 7 deletions installer_script.ps1
Original file line number Diff line number Diff line change
@@ -1,25 +1,51 @@
# Define the URL of the .exe file to download
$url = "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.msvc2015-win64.exe"
$exeUrl = "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.msvc2015-win64.exe"
$wheelUrl = "https://github.com/dayesouza/python-louvain/raw/4be44746eca195eadc97e794b40984fd47420aa4/wheel/python_louvain-0.16-py3-none-any.whl"

$folderPath = "app/wkhtmltox"
$outputFilePath = Join-Path -Path $folderPath -ChildPath "wkhtmltox-0.12.6-1.msvc2015-win64_.exe"
if (-not (Test-Path $folderPath)) {
New-Item -Path $folderPath -ItemType Directory
}
$outputFilePathExe = Join-Path -Path $folderPath -ChildPath "wkhtmltox-0.12.6-1.msvc2015-win64_.exe"


$wheelFolder = "wheels"
if (-not (Test-Path $wheelFolder)) {
New-Item -Path $wheelFolder -ItemType Directory
}
$wheelFilePath = Join-Path -Path $wheelFolder -ChildPath "python_louvain-0.16-py3-none-any.whl"
# Check if the file already exists in the folder
if (Test-Path $outputFilePath) {
if (Test-Path $outputFilePathExe) {
Write-Host "File already exists. Skipping download."
} else {

Write-Host "Downloading wkhtmltox from host: $url"
Write-Host "Downloading wkhtmltox from host: $exeUrl"

Invoke-WebRequest -Uri $url -OutFile $outputFilePath
Invoke-WebRequest -Uri $exeUrl -OutFile $outputFilePathExe

if (Test-Path $outputFilePath) {
Write-Host "Download successful."
if (Test-Path $outputFilePathExe) {
Write-Host "Download of exe successful."
# Call pynsist with the installer configuration file
} else {
Write-Host "Download failed. Exiting script."
exit 1
}
}

if (Test-Path $wheelFilePath) {
Write-Host "Wheel file already exists. Skipping download."
} else {

Write-Host "Downloading python-louvain wheel from host: $wheelUrl"

Invoke-WebRequest -Uri $wheelUrl -OutFile $wheelFilePath

if (Test-Path $wheelFilePath) {
Write-Host "Download of wheel successful."
} else {
Write-Host "Download failed. Exiting script."
exit 1
}
}

pynsist .\installer.cfg

0 comments on commit 4d036a0

Please sign in to comment.