Невозможно создать MSI и EXE-файл из определенного пути Python - PullRequest
0 голосов
/ 26 февраля 2019

Я не могу собрать exe и msi из pyinstaller, который присутствует в рабочей области моего проекта.

когда я запускаю файл make.bat, он идет в мой локальный путь к python и генерирует exe и msi файлно мне нужно сгенерировать MSI и EXE-файл из моего Python пространства проекта.

Вот структура пространства проекта:

myproject
   |
   tools
     |
     PyInstaller
     python

Вот make.bat:

@echo off

call "%~dp0path_env_setup.bat"

call echo Version 0.28.3.6 > version.txt

call python versionParser.py

cd "%~dp0tools\PyInstaller"
call python setup.py install
cd "%~dp0"

SET WORK_PATH_DIR=.\installer\simulator
SET SIMUALTOR_EXE=.\installer\simulator.exe
SET STATIC_DIR=.\installer\static
SET TEMPLATE_DIR=.\installer\templates
SET SIMULATOR_MSI=.\DeviceSimulator.msi
SET SIMULATOR_WIXOBJ=.\DeviceSimulator.wixobj
SET SIMULATOR_WIXPDB=.\DeviceSimulator.wixpdb

REM Delete files
if exist "%WORK_PATH_DIR%" rmdir /S /Q "%WORK_PATH_DIR%"
if exist "%SIMUALTOR_EXE%" del "%SIMUALTOR_EXE%"
if exist "%SIMULATOR_MSI%" del "%SIMULATOR_MSI%"
if exist "%SIMULATOR_WIXOBJ%" del "%SIMULATOR_WIXOBJ%"
if exist "%SIMULATOR_WIXPDB%" del "%SIMULATOR_WIXPDB%"
if exist "%STATIC_DIR%" rmdir /S /Q "%STATIC_DIR%"
if exist "%TEMPLATE_DIR%" rmdir /S /Q "%TEMPLATE_DIR%"


REM PyInstaller
call "tools\python\Scripts\pyinstaller.exe" --onefile "simulator\simulator.py" -p "simulator" --icon="installer\images\favicon.ico" --distpath "installer" --workpath "installer" --hiddenimport email.mime.message --hiddenimport email.mime.image --hiddenimport email.mime.multipart --hiddenimport email.mime.nonmultipart --hiddenimport email.mime.text --hiddenimport email.mime.base --hiddenimport email.mime.audio --hiddenimport email.mime.application

REM Copy Static & Templates
call xcopy "simulator\static" "installer\static\" /S
call xcopy "simulator\templates" "installer\templates\" /S

REM WIX MSI creation

cd installer

call "..\tools\WixToolset3\candle.exe" "DeviceSimulator.wxs"
call "..\tools\WixToolset3\light.exe" -cultures:en-US -ext WixUIExtension.dll "DeviceSimulator.wixobj"

cd ..

Вот файл env_setup.bat:

echo setting PATH
SET PYTHON_HOME=%~dp0tools\python
SET NMAP_HOME=%~dp0tools\nmap
SET PATH=%~dp0\tools;%SystemRoot%;%SystemRoot%\system32;%PYTHON_HOME%;%NMAP_HOME%
set FLASK_APP=simulator
set FLASK_ENV=development
...