[wpkg-users] Double quoting and Python
Rainer Meier
r.meier at wpkg.org
Tue Dec 16 00:32:03 CET 2008
Hi Brian,
Brian Reese wrote:
> I have some questions about double quoting and python in WPKG:
>
> 1. How does WPKG handle double quoting. Are there any priorities between ' and " ?
> 2. Are there any escape characters? Like a /" or // to get the real character?
> 3. Does WPKG handle .py scripts? I assume it does.
>
> My problem stems from trying to pass variables into my python script after I call the script. for instance 'python.exe scriptname.py "variable 1" "variable 2" "variable 3"' That is how I would like my WPKG install commmand to look, it works in cmd.exe. I get an exit code 1 saying the install command failed.
>
> Any thoughts or ideas? Thanks,
OK. You can run python.exe from wpkg.js via package definition. However
this depends on some pre-conditions (python.exe within the path...) and
it's hard to debug if something goes wrong. In such cases I strongly
recommend to go for an "unattended-install-script" method.
Place a simple CMD script within the installation folder and tell WPKG
to run it. The script can be very simple...
unattended.cmd:
@echo off
set VARIABLE1=variable 1
set VARIABLE2=variable 2
set VARIABLE3=variable 3
set SCRIPT_PATH=%~dp0
set SCRIPT_NAME=scriptname.py
echo Installing
start /wait "app-install" %SCRIPT_PATH%%SCRIPT_NAME% "%VARIABLE1%"
"%VARIABLE1%" "%VARIABLE1%"
set EXIT_CODE=%ERRORLEVEL%
exit /B %EXIT_CODE%
Ths allows you to insert any kind of processing (pre-checks,
post-checks...) and return an exit code as desired.
br,
Rainer
More information about the wpkg-users
mailing list