generated from dopt-python/py311
fix startup script
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "wce-crm"
|
name = "wce-crm"
|
||||||
version = "0.1.1dev2"
|
version = "0.1.1dev4"
|
||||||
description = "GUI for CRM of NAFKA project with WCE"
|
description = "GUI for CRM of NAFKA project with WCE"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "d-opt GmbH, resp. Florian Förster", email = "f.foerster@d-opt.com"},
|
{name = "d-opt GmbH, resp. Florian Förster", email = "f.foerster@d-opt.com"},
|
||||||
@@ -71,7 +71,7 @@ directory = "reports/coverage"
|
|||||||
|
|
||||||
|
|
||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.1.1dev2"
|
current_version = "0.1.1dev4"
|
||||||
parse = """(?x)
|
parse = """(?x)
|
||||||
(?P<major>0|[1-9]\\d*)\\.
|
(?P<major>0|[1-9]\\d*)\\.
|
||||||
(?P<minor>0|[1-9]\\d*)\\.
|
(?P<minor>0|[1-9]\\d*)\\.
|
||||||
|
|||||||
6
scripts/Launch_App_Fallback.bat
Normal file
6
scripts/Launch_App_Fallback.bat
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@echo off
|
||||||
|
:: 1. Safely navigate to the exact folder this batch file is sitting in
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
:: 2. Launch the app in the background and instantly close the command prompt
|
||||||
|
start "" "python\pythonw.exe" -m my_package.gui
|
||||||
@@ -19,6 +19,20 @@ if ($? -eq $false){
|
|||||||
}
|
}
|
||||||
Write-Output "Deleted outstanding artifacts successfully"
|
Write-Output "Deleted outstanding artifacts successfully"
|
||||||
|
|
||||||
|
|
||||||
|
Write-Output "Create data folder..."
|
||||||
|
$pattern = "dopt_nafka_wce-crm_v*"
|
||||||
|
$data_folder = Join-Path -Path $ENV_PATH -ChildPath 'data'
|
||||||
|
|
||||||
|
if (-not (Test-Path -Path $data_folder)){
|
||||||
|
Write-Output "[PWSH] Data path not existing. Create..."
|
||||||
|
New-Item -Path $data_folder -ItemType Directory
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Output "Data path already exists."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Write-Output "Building package..."
|
Write-Output "Building package..."
|
||||||
.\scripts\publish.ps1
|
.\scripts\publish.ps1
|
||||||
if ($? -eq $false){
|
if ($? -eq $false){
|
||||||
@@ -56,17 +70,6 @@ if ($? -eq $false){
|
|||||||
}
|
}
|
||||||
Write-Output "Successfully installed package"
|
Write-Output "Successfully installed package"
|
||||||
|
|
||||||
# copy CLI file
|
|
||||||
# TODO add startup file
|
|
||||||
# Write-Output "Copying CLI script file..."
|
|
||||||
# $cli_path = Join-Path -Path $SRC_PATH -ChildPath 'cli.py'
|
|
||||||
# Copy-Item -Path $cli_path -Destination $PY_PATH -Force
|
|
||||||
# if ($? -eq $false){
|
|
||||||
# Write-Output "[PWSH] Exiting script because there were errors while copying the CLI script file"
|
|
||||||
# Exit
|
|
||||||
# }
|
|
||||||
# Write-Output "Copied CLI script file successfully"
|
|
||||||
|
|
||||||
# copy database file
|
# copy database file
|
||||||
Write-Output "Copying database files..."
|
Write-Output "Copying database files..."
|
||||||
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'data/db/wce_grunderfassung.db'
|
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'data/db/wce_grunderfassung.db'
|
||||||
@@ -97,18 +100,12 @@ Write-Output "Copied ENV file successfully"
|
|||||||
|
|
||||||
# copy startup script files
|
# copy startup script files
|
||||||
Write-Output "Copying startup scripts..."
|
Write-Output "Copying startup scripts..."
|
||||||
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'scripts/start.*'
|
$copy_file = Join-Path -Path $SRC_PATH -ChildPath 'scripts/start.bat'
|
||||||
Copy-Item -Path $copy_file -Destination $ENV_PATH -Force
|
Copy-Item -Path $copy_file -Destination $ENV_PATH -Force
|
||||||
if ($? -eq $false){
|
if ($? -eq $false){
|
||||||
Write-Output "[PWSH] Exiting script because there were errors while copying startup scripts"
|
Write-Output "[PWSH] Exiting script because there were errors while copying startup scripts"
|
||||||
Exit
|
Exit
|
||||||
}
|
}
|
||||||
# $copy_file = Join-Path -Path $SRC_PATH -ChildPath 'data/db/wce_crm.db'
|
|
||||||
# Copy-Item -Path $copy_file -Destination $dest_file -Force
|
|
||||||
# if ($? -eq $false){
|
|
||||||
# Write-Output "[PWSH] Exiting script because there were errors while copying database 'CRM'"
|
|
||||||
# Exit
|
|
||||||
# }
|
|
||||||
Write-Output "Copied startup scripts successfully"
|
Write-Output "Copied startup scripts successfully"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
@echo off
|
@echo off
|
||||||
cd /d "%~dp0"
|
:: 1. Navigate directly into the python environment folder
|
||||||
start "" "python\pythonw.exe" -m wce_crm.gui
|
cd /d "%~dp0python"
|
||||||
|
@REM cd /d "python"
|
||||||
|
@REM python.exe -m my_package.gui
|
||||||
|
:: 2. Launch pythonw silently
|
||||||
|
start "" "pythonw.exe" -m wce_crm.gui
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
Set WshShell = CreateObject("WScript.Shell")
|
Set WshShell = CreateObject("WScript.Shell")
|
||||||
Set FSO = CreateObject("Scripting.FileSystemObject")
|
Set FSO = CreateObject("Scripting.FileSystemObject")
|
||||||
|
|
||||||
strScriptDir = FSO.GetParentFolderName(WScript.ScriptFullName)
|
' 1. Get the exact path to the python_env folder
|
||||||
WshShell.CurrentDirectory = strScriptDir
|
strEnvDir = FSO.GetParentFolderName(WScript.ScriptFullName) & "\python"
|
||||||
|
|
||||||
pythonExe = strScriptDir & "\python\python.exe"
|
' 2. Set the working directory (crucial so pythonw.exe finds its DLLs)
|
||||||
|
WshShell.CurrentDirectory = strEnvDir
|
||||||
|
|
||||||
' Use cmd.exe /c (close when done) as a trusted bridge to launch the module
|
' 3. Get the ABSOLUTE path to the executable, not just the file name
|
||||||
runCommand = "cmd.exe /c " & Chr(34) & pythonExe & Chr(34) & " -m wce_crm.gui"
|
pythonExe = strEnvDir & "\pythonw.exe"
|
||||||
|
|
||||||
' Set back to 0 (Hidden).
|
' 4. Build the command using the absolute path
|
||||||
|
runCommand = Chr(34) & pythonExe & Chr(34) & " -m wce_crm.gui"
|
||||||
|
|
||||||
|
' 5. Run it completely hidden
|
||||||
WshShell.Run runCommand, 0, False
|
WshShell.Run runCommand, 0, False
|
||||||
Reference in New Issue
Block a user