-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:Add the bat file for building the APP
- Loading branch information
Showing
4 changed files
with
312 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
::[Bat To Exe Converter] | ||
:: | ||
::YAwzoRdxOk+EWAjk | ||
::fBw5plQjdCyDJGyX8VAjFDFdQjimOXixEroM1M7y4++7hV0Ea967omNcM1wI3Cwvy1DwerEo2XlSncYFHw9KZwKiUTg9p1ES5TbSC+aJpwDGT0eK7k49EnZglXrAhRQMad1XsMoN7HDnrh7DvrAE3l/6UaoGEG7o0rh6IdkJwj29Znbik71qGq+8OIHuBjnLK2wShWPXmZp6l78vVi5JSQhDxbBv7ks= | ||
::YAwzuBVtJxjWCl3EqQJgSA== | ||
::ZR4luwNxJguZRRnk | ||
::Yhs/ulQjdF+5 | ||
::cxAkpRVqdFKZSjk= | ||
::cBs/ulQjdF+5 | ||
::ZR41oxFsdFKZSDk= | ||
::eBoioBt6dFKZSDk= | ||
::cRo6pxp7LAbNWATEpCI= | ||
::egkzugNsPRvcWATEpCI= | ||
::dAsiuh18IRvcCxnZtBJQ | ||
::cRYluBh/LU+EWAnk | ||
::YxY4rhs+aU+IeA== | ||
::cxY6rQJ7JhzQF1fEqQJgZk0aHGQ= | ||
::ZQ05rAF9IBncCkqN+0xwdVs0 | ||
::ZQ05rAF9IAHYFVzEqQIXLRRXRAGPNXiuFKwM4Yg= | ||
::eg0/rx1wNQPfEVWB+kM9LVsJDGQ= | ||
::fBEirQZwNQPfEVWB+kM9LVsJDGQ= | ||
::cRolqwZ3JBvQF1fEqQJQ | ||
::dhA7uBVwLU+EWGOuwX0VKQlARDumPX+7Zg== | ||
::YQ03rBFzNR3SWATElA== | ||
::dhAmsQZ3MwfNWATElA== | ||
::ZQ0/vhVqMQ3MEVWAtB9wSA== | ||
::Zg8zqx1/OA3MEVWAtB9wSA== | ||
::dhA7pRFwIByZRRnk | ||
::Zh4grVQjdCyDJGyX8VAjFDFdQjimOXixEroM1M7y4++7hV0Ea967omNcM1wI3Cwvy1DwerEo2XlSncYFHw9KZwKiUTg9p1ES5TbSC+aJpwDGT0eK7k49EnZglXrAhRQMad1XsMoN7HDnrh7DvrAE3l/6UaoGEG7o0rh6IdkJwj29Znbik71qGq+8OIHuBjnLK2wShWPXmZp6l78qWi92Rh1Xgqp48zLoSty+xHIh | ||
::YB416Ek+ZG8= | ||
:: | ||
:: | ||
::978f952a14a936cc963da21a135fa983 | ||
@echo off | ||
|
||
chcp 65001 >nul | ||
|
||
set current_dir = %~dp0 | ||
|
||
call %~dp0\bin\Geochemistrypi\geochemistrypi\data_mining\bat\pre-installer.bat | ||
|
||
call %~dp0\bin\Geochemistrypi\geochemistrypi\data_mining\bat\setup_env.bat | ||
|
||
echo Geochemistrypi is loading ...... | ||
|
||
setlocal enabledelayedexpansion | ||
|
||
set ENVIRONMENT_NAME=GeoUI | ||
|
||
|
||
call conda activate %ENVIRONMENT_NAME% | ||
|
||
@REM for /f "delims=" %%a in ('where python') do ( | ||
@REM if "%%a" == "%CONDA_PREFIX%\python.exe" ( | ||
@REM set PYTHON_EXE=%%a | ||
@REM goto :found | ||
@REM ) | ||
@REM ) | ||
@REM :found | ||
@REM echo The path of python.exe in the %ENVIRONMENT_NAME% environment is: | ||
@REM echo %PYTHON_EXE% | ||
|
||
REM 杩愯 Launcher 鑴氭湰 | ||
python .\bin\Geochemistrypi\geochemistrypi\start_cli_pipeline.py | ||
if %errorlevel% neq 0 ( | ||
echo Error: Failed to run Launcher.py script. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
|
||
echo Launcher executed successfully. | ||
|
||
endlocal | ||
pause | ||
|
65 changes: 65 additions & 0 deletions
65
geochemistrypi/data_mining/bat/latestversion_installer.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@echo off | ||
setlocal enabledelayedexpansion | ||
|
||
chcp 65001 >nul | ||
|
||
:: 获取参数 | ||
set param=%1 | ||
if "%param%"=="" ( | ||
echo Usage: %~nx0 [version] | ||
exit /b 1 | ||
) | ||
|
||
:: 设置下载链接和文件名 | ||
set download_url="https://github.com/ZJUEarthData/Geochemistrypi/releases/download/%param%/geochemistrypi.exe" | ||
set output_file="%UserProfile%\Downloads\geochemistrypi.exe" | ||
|
||
echo Getting the download file: %download_url% | ||
echo Saved address: %output_file% | ||
|
||
:: 检查文件是否已经存在 | ||
if exist "%output_file%" ( | ||
echo File "%output_file%" already exists. Skipping download... | ||
) else ( | ||
echo Downloading software... | ||
curl -L -o "%output_file%" "%download_url%" | ||
|
||
:: 检查下载是否成功 | ||
if %errorlevel% neq 0 ( | ||
echo Download failed. Exiting... | ||
exit /b 1 | ||
) | ||
|
||
:: 检查下载的文件是否存在 | ||
if not exist "%output_file%" ( | ||
echo Downloaded file not found. Exiting... | ||
exit /b 1 | ||
) | ||
) | ||
|
||
|
||
:: 安装更新的文件 | ||
echo Installing software... | ||
set destination="%ProgramFiles(x86)%\geochemistrypi" | ||
|
||
:: 检查目标目录是否存在,如果不存在则创建 | ||
if not exist "%destination%\" ( | ||
echo Creating directory: %destination% | ||
mkdir %destination% | ||
) else ( | ||
echo Directory already exists: %destination% | ||
) | ||
rem start "" "%output_file%" | ||
|
||
start "" /wait %output_file% /D %destination% | ||
|
||
if exist "%destination%\geochemistrypi.exe" ( | ||
echo File installed successfully. | ||
) else ( | ||
echo Failed to install geochemistrypi.exe | ||
) | ||
|
||
echo Installation completed successfully. | ||
|
||
endlocal | ||
exit /b 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@echo off | ||
|
||
chcp 65001 >nul | ||
|
||
setlocal | ||
|
||
REM 检查系统中是否安装了 conda | ||
where conda >nul 2>&1 | ||
if %errorlevel% equ 0 ( | ||
echo Conda is already installed. | ||
) else ( | ||
echo Conda is not installed. Installing now... | ||
|
||
REM 检查是否提供了下载 URL 和安装路径参数 | ||
if "%~1"=="" ( | ||
echo Usage: %~nx0 https://repo.anaconda.com/archive/Anaconda3-2023.07-1-Windows-x86_64.exe %UserProfile%/geochemistrypi/Anaconda3-2023.07-1-Windows-x86_64.exe | ||
goto end | ||
) | ||
|
||
REM 设置下载 URL 和安装路径 | ||
set url=%~1 | ||
set install_path=%~2 | ||
|
||
REM 提取文件名 | ||
for /f "tokens=*" %%i in ("%url%") do set installer=%%~nxi | ||
|
||
REM 检查并创建 %ProgramFiles(x86)%\geochemistrypi 文件夹 | ||
if not exist "%ProgramFiles(x86)%\geochemistrypi" ( | ||
echo Creating directory: "%ProgramFiles(x86)%\geochemistrypi" | ||
mkdir "%ProgramFiles(x86)%\geochemistrypi" | ||
) | ||
|
||
echo Downloading Anaconda installer... | ||
powershell -Command "Invoke-WebRequest -Uri %url% -OutFile %install_path% | ||
/%installer%" | ||
|
||
REM 安装 Anaconda | ||
echo Installing Anaconda... | ||
start /wait "%installer%" /S /D=%install_path% | ||
|
||
REM 删除安装程序 | ||
del %installer% | ||
|
||
echo Anaconda installation complete. | ||
) | ||
|
||
:end | ||
endlocal | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
@echo off | ||
|
||
chcp 65001 > nul | ||
|
||
setlocal enabledelayedexpansion | ||
|
||
set ENVIRONMENT_NAME=GeoUI | ||
|
||
:: 检查 activate 命令是否存在 | ||
where activate >nul 2>&1 | ||
if %errorlevel% neq 0 ( | ||
echo activate is not installed or not in the PATH. | ||
exit /b 1 | ||
) else ( | ||
echo Activate is available. | ||
for /f "tokens=*" %%i in ('where activate') do set ActivatePATH=%%i | ||
echo ActivatePATH is !ActivatePATH! | ||
) | ||
|
||
:: 检查环境是否已经存在 | ||
call conda info --envs | findstr /C:"%ENVIRONMENT_NAME% " >nul | ||
if %errorlevel% equ 0 ( | ||
echo Environment %ENVIRONMENT_NAME% already exists. | ||
goto :eof | ||
) else ( | ||
echo Environment %ENVIRONMENT_NAME% does not exist. Creating... | ||
call conda create -n %ENVIRONMENT_NAME% python=3.9 -y | ||
if %errorlevel% neq 0 ( | ||
echo Error: Failed to create conda environment. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
) | ||
|
||
|
||
:: 激活新创建的 conda 虚拟环境 | ||
call conda activate %ENVIRONMENT_NAME% | ||
if %errorlevel% equ 0 ( | ||
echo Environment %ENVIRONMENT_NAME% activated successfully. | ||
) else ( | ||
echo Error: Failed to activate conda environment. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
|
||
echo Choice: 【1】Online installation 【2】Local installation | ||
choice /C:12 /N | ||
set _erl=%errorlevel% | ||
|
||
:: 检查用户选择 | ||
if %_erl%==1 goto PipGeo | ||
if %_erl%==2 goto InstallDependencies | ||
|
||
endlocal | ||
|
||
:: 在激活的环境中安装 geochemistrypi | ||
:PipGeo | ||
echo Online installation is underway... | ||
pip install geochemistrypi==0.5.0 | ||
if %errorlevel% equ 0 ( | ||
echo geochemistrypi installed successfully. | ||
) else ( | ||
echo Error: Failed to install geochemistrypi. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
|
||
pip install tkinterdnd2 | ||
if %errorlevel% equ 0 ( | ||
echo tkinterdnd2 installed successfully. | ||
) else ( | ||
echo Error: Failed to install tkinterdnd2. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
|
||
:: 检查 geochemistrypi 和 tkinterdnd2 是否安装成功 | ||
python -c "import geochemistrypi" | ||
if %errorlevel% equ 0 ( | ||
echo geochemistrypi is installed. | ||
) else ( | ||
echo Error: geochemistrypi is not installed. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
|
||
python -c "import tkinterdnd2" | ||
if %errorlevel% equ 0 ( | ||
echo tkinterdnd2 is installed. | ||
) else ( | ||
echo Error: tkinterdnd2 is not installed. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
pause | ||
goto :eof | ||
|
||
:InstallDependencies | ||
echo Local installation is underway... | ||
:: 获取当前路径地址 | ||
set "CurrentFolder=%~dp0" | ||
echo The current folder path: %cd% | ||
|
||
:: 安装库 | ||
cd %cd% | ||
echo Dependency package is downloading... | ||
|
||
call pip install --no-index --find-links=wheels -r %CurrentFolder%requirements.txt | ||
if %errorlevel% equ 0 ( | ||
echo Dependencies installed successfully. | ||
) else ( | ||
echo Error: Failed to install dependencies. | ||
pause | ||
exit /b %errorlevel% | ||
) | ||
|
||
call pip install geochemistrypi | ||
pause | ||
goto :eof | ||
|
||
|
||
|
||
pause |