我无法从项目工作区中存在的pyinstaller构建exe和msi。
当我运行make.bat文件时,它将转到我的本地python路径并生成exe和msi文件,但是我需要从我的项目空间python中生成msi和exe文件。
这是项目空间结构:
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