Skip to content

Commit

Permalink
scripts are now launched in separate terminals
Browse files Browse the repository at this point in the history
  • Loading branch information
CTCycle committed Jan 20, 2025
1 parent 036239b commit bafbe93
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
39 changes: 28 additions & 11 deletions EMADB/start_on_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ for /f "delims=" %%i in ("%~dp0..") do set "project_folder=%%~fi"
set "env_name=EMADB"
set "project_name=EMADB"
set "env_path=%project_folder%\setup\environment\%env_name%"
set "app_path=%project_folder%\%project_name%"
set "conda_path=%project_folder%\setup\miniconda"
set "setup_path=%project_folder%\setup"

Expand Down Expand Up @@ -82,15 +83,14 @@ if "%choice%"=="1" goto :main
if "%choice%"=="2" goto :setup_menu
if "%choice%"=="3" goto exit
echo Invalid option, try again.
pause
goto :main_menu

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Run main app
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:main
cls
call conda activate "%env_path%" && python .\commons\main.py
start cmd /k "call conda activate "%env_path%" && python "%app_path%"\commons\main.py"
pause
goto :main_menu

Expand All @@ -103,26 +103,43 @@ echo =======================================
echo Setup and Maintenance
echo =======================================
echo 1. Install project in editable mode
echo 2. Remove logs
echo 3. Back to main menu
echo 2. Update project
echo 3. Remove logs
echo 4. Back to main menu
echo.
set /p sub_choice="Select an option (1-3): "
set /p sub_choice="Select an option (1-4): "

if "%sub_choice%"=="1" goto :eggs
if "%sub_choice%"=="2" goto :logs
if "%sub_choice%"=="3" goto :main_menu
if "%sub_choice%"=="2" goto :update
if "%sub_choice%"=="3" goto :logs
if "%sub_choice%"=="4" goto :main_menu
echo Invalid option, try again.
pause
goto :setup_menu

:eggs
call conda activate "%env_path%" && cd .. && pip install -e . --use-pep517 && cd "%project_name%"
call conda activate "%env_path%" && cd "%project_folder%" && pip install -e . --use-pep517
pause
goto :setup_menu

:update
cd "%project_folder%"
call git pull
if errorlevel 1 (
echo Error: Git pull failed.
pause
goto :setup_menu
)
pause
goto :setup_menu

:logs
cd "%project_folder%\%project_name%\resources\logs"
cd "%app_path%\resources\logs"
if not exist *.log (
echo No log files found.
pause
goto :setup_menu
)
del *.log /q
cd "%project_name%"
echo Log files deleted.
pause
goto :setup_menu
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ On Windows, run *start_on_windows.bat* to launch the main navigation menu and br

**1) Run EMAutoPilot:** run the main application and start the start the automated browser. Since the script is based on Chromedriver, your need to have Google Chrome browser installed in your system! The correct driver version will be automatically installed, or loaded from the cache if present (default location is home/.wdm).

**2) Setup and Maintenance:** allows running some options command such as *install project in editable mode* to run the developer model project installation, and *remove logs* to remove all logs saved in *resources/logs*.
**2) Setup and Maintenance:** execute optional commands such as *Install project into environment* to run the developer model project installation, *update project* to pull the last updates from github, and *remove logs* to remove all logs saved in *resources/logs*.

**3) Exit:** close the program immediately

Expand Down
6 changes: 3 additions & 3 deletions setup/install_on_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ for /f "delims=" %%i in ("%~dp0..") do set "project_folder=%%~fi"
set "env_name=EMADB"
set "project_name=EMADB"
set "env_path=%project_folder%\setup\environment\%env_name%"
set "app_path=%project_folder%\%project_name%"
set "conda_path=%project_folder%\setup\miniconda"
set "setup_path=%project_folder%\setup"

Expand Down Expand Up @@ -54,15 +55,14 @@ goto :dependencies
:dependencies
echo.
echo Install python libraries and packages
call pip install numpy==2.1.0 pandas==2.2.3 tqdm==4.66.4
call pip install selenium==4.23.0 webdriver-manager==4.0.1 beautifulsoup4==4.12.3
call pip install tqdm==4.67.1 selenium==4.23.0 webdriver-manager==4.0.1 beautifulsoup4==4.12.3

:: [INSTALL PROJECT IN EDITABLE MODE]
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Install project in developer mode
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo Install utils packages in editable mode
call cd "%project_folder%" && pip install -e . --use-pep517 && cd "%setup_path%"
call cd "%project_folder%" && pip install -e . --use-pep517

:: [CLEAN CACHE]
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Expand Down

0 comments on commit bafbe93

Please sign in to comment.