installer - How to notify Python from an Inno Setup that the environment path has changed? -
So I am trying to create an installer who has the following steps:
- Check if the Python is installed
- Copy my app files
- Check if the Python installation directory has a Windows Environmental Path
- Check whether the Python script is in the folder Windows Environment Path
- If the script folders are not in env path, add it
- Install easy_install
- Run a python script that uses easy_install to install several libraries
The problem has to be faced in the last few steps. Here's the relevant code for these setups that I am currently using:
Starting the case: ssInstall's curst: // file transfer is starting to start // note: abort Use (); To finish installation during this step. End; SsPostInstall: // Start the file transfer has ended // Make sure that the Python path is in. SPythonInstallDir: = _PythonGetInstallDir (); _PathAddToSystem (sPythonInstallDir) _PathAddToSystem (sPythonInstallDir + 'Scripts;') // Play bundle Python script ExtractTemporaryFile ( 'build_setup_script.py'); ExtractTemporaryFile ('ez_setup.py'); _loncpp (Addkwotes (Spitoninstoldir + 'Paithan.akse'), Addkwotes (Akspendkonstant ( '{} Tmp \ Bild_setap_skriptkpi')), Akspendkonstant ( "Tmp {} '), Sw_so, Uvetuntiltermineted, 300, Ntime, Nrsultkde); End; SsDone: // After the finished dialogue. Initial end; End; Here is the Python script:
def main (argv): ## Easy Installed Print ("install easy_install") call (["Python" , "Ez_setup.py"]) ## Call the installation server.py dependency print ("\ nSqullchemy install") (["easy_install", "SQLAlchemy == 0.7.8"]) ...
I have the following instructions in this setup:
[setup] ... change environment = true ...
However, according to this, the instructions are effective only after the user expires.
Then adds the setup path:
... C: \ Program Files (x86) \ Git \ cmd ;; C: \ Python27 \; C: \ Python27 \ script;
But, then the script runs (which works because it detects that the path has changed and can execute Python files) the script will re-install easy_install, which Works for some reason, but when it tries to use easy_install (this is why C: Python \ scripts are in the path) it does not find a file, does not throw exceptions
However, When I run the installer a second time, Oi is without any changes, Easy_install phase then will work, because now runs Python, so it can detect the path of easy_install.
I get there, click on the finish, however a copy of the address mentioned above not compile Inno
SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, 0, lParam (before There is a way to inform the process of PCHAR ('environment'), SMTO_ABRIFIFHUNG, 5000, MMSRSLT);
A question has been asked to ask the user to install a second time because the installer should be automated in the first place ... any ideas?
If you want to notify all the windows about environmental changes, such as the following code (Inanosatup the internally used when the wizard is finished and;
SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, 0, lParam (PChar ( 'environment')), SMTO_ABORTIFHUNG, 5000, MsgResult):
Yes for instructions is set to
You can import the following (Testing with the most recent ANSI and Unicode versions of InnoSetup) You can use:
[code] #ifdef UNICODE #define AW "W" # Sfain AW "A" # Adiaiafaimti Smtio_adiattiaffudag = 2; WM_WININICHANGE = $ 001a; WM_SETTINGCHANGE = WM_WININICHANGE; Type LONG_PTR = LongInt; LRESULT = LONG_PTR; WPARAM = UINT_PTR; LPARAM = LONG_PTR; SendTextMessageTimeout manner (hWnd: HWND; Message: uint; wParam: wParam; lParam: string; fuFlags: uint; uTimeout: uint; var lpdwResult: DWORD_PTR): LRESULT; External 'SendmeTimeout {#AW}@user32.dll stdcall';
And call it when it appears in this pseudo code whenever you need it in your script:
var MsgResult: DWORD_PTR; If SendTextMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment', SMTO_ABORTIFHUNG, 5000, MsgResult) & lt; & Gt; 0 then MSBBC ('success!', MB intction, MBOK) Other MSBBCs (SIERRMMASARS (DLLGetList error), MBERR, MBOK); End;
- Install easy_install
Comments
Post a Comment