Skip to content

Commit

Permalink
feat(scripts linux): wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienChampagnol committed Nov 7, 2024
1 parent 15679b4 commit 7ac7413
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 44 deletions.
10 changes: 8 additions & 2 deletions electron-server/back/build.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
echo "Building back microservice"
$back_path=".\electron-server\back"
$dist_path="$back_path\dist"
$venv_path="$back_path\venv"
"$venv_path\Scripts\Activate.ps1"
$site_packages_path="$venv_path\Lib\site-packages"
pip install pyinstaller
pyinstaller --onefile --collect-data opengeodeweb_back --collect-data vease_back $bin_folder\app.py --distpath .\electron-server\back\dist -n vease-back --clean
Copy-Item .\electron-server\back\dist\vease-back.exe .\
pyinstaller --onefile --collect-data opengeodeweb_back --collect-data vease_back "$site_packages_path\vease_back\app.py" --distpath $dist_path -n vease-back --clean
Copy-Item $dist_path\vease-back.exe .\
3 changes: 0 additions & 3 deletions electron-server/back/compile.ps1

This file was deleted.

10 changes: 0 additions & 10 deletions electron-server/back/install.ps1

This file was deleted.

11 changes: 6 additions & 5 deletions electron-server/back/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile ./electron-server/back/requirements.in
# pip-compile '.\electron-server\back\requirements.in'
#
asgiref==3.8.1
# via
Expand All @@ -26,7 +26,9 @@ click==8.1.7
# opengeodeweb-back
# vease-back
colorama==0.4.6
# via vease-back
# via
# click
# vease-back
flask[async]==3.0.3
# via
# flask-cors
Expand Down Expand Up @@ -167,11 +169,10 @@ rpds-py==0.20.0
# vease-back
typing-extensions==4.12.2
# via
# asgiref
# opengeodeweb-back
# vease-back
vease-back==1.0.0
# via -r ./electron-server/back/requirements.in
# via -r .\electron-server\back\requirements.in
werkzeug==3.0.4
# via
# flask
Expand Down
9 changes: 9 additions & 0 deletions electron-server/compile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$microservice_name=$args[0]
echo "Compiling $args requirements"
$microservice_path=".\electron-server\$microservice_name"
$venv_path="$microservice_path\venv"
python -m venv $venv_path
Remove-Item -Recurse -Force "$microservice_path\requirements.txt" -ErrorAction:SilentlyContinue
"$venv_path\Scripts\Activate"
pip install pip-tools
pip-compile "$microservice_path\requirements.in"
13 changes: 13 additions & 0 deletions electron-server/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$microservice_name=$args[0]
echo "Installing $args requirements"

$microservice_path=".\electron-server\$microservice_name"
$venv_path="$microservice_path\venv"
echo "Removing old virtual environment $venv_path"
Remove-Item -Recurse -Force $venv_path -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force "$microservice_path\dist\" -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force "$microservice_path\build\" -ErrorAction:SilentlyContinue
echo "Activating virtual environment $venv_path\Scripts\Activate.ps1"
python -m venv $venv_path
"$venv_path\Scripts\Activate.ps1"
pip install -r "$microservice_path\requirements.txt"
2 changes: 1 addition & 1 deletion electron-server/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
microservice_name=$1
echo "Installing $microservice_name"
echo "Installing $microservice_name requirements"
microservice_path="./electron-server/$microservice_name"
venv_path=$microservice_path/venv
rm -rf $venv_path $microservice_path/dist $microservice_path/build
Expand Down
9 changes: 9 additions & 0 deletions electron-server/viewer/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
echo "Building viewer microservice"
$back_path=".\electron-server\viewer"
$dist_path="$back_path\dist"
$venv_path="$back_path\venv"
"$venv_path\Scripts\Activate.ps1"
$site_packages_path="$venv_path\Lib\site-packages"
pip install pyinstaller
pyinstaller --onefile --collect-data opengeodeweb_viewer --collect-all vtkmodules $site_packages_path/vease_viewer/app.py --distpath $dist_path -n vease-viewer --clean
Copy-Item $dist_path\vease-back.exe .\
5 changes: 0 additions & 5 deletions electron-server/viewer/compile.ps1

This file was deleted.

13 changes: 0 additions & 13 deletions electron-server/viewer/install.ps1

This file was deleted.

7 changes: 3 additions & 4 deletions electron-server/viewer/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile ./electron-server/viewer/requirements.in
# pip-compile '.\electron-server\viewer\requirements.in'
#
aiohttp==3.9.3
# via
Expand All @@ -16,7 +16,6 @@ aiosignal==1.3.1
# vease-viewer
async-timeout==4.0.3
# via
# aiohttp
# opengeodeweb-viewer
# vease-viewer
attrs==23.2.0
Expand Down Expand Up @@ -116,7 +115,7 @@ six==1.16.0
# python-dateutil
# vease-viewer
vease-viewer[gpu]==1.0.1
# via -r ./electron-server/viewer/requirements.in
# via -r .\electron-server\viewer\requirements.in
vtk==9.3.1
# via
# opengeodeweb-viewer
Expand Down
2 changes: 1 addition & 1 deletion node_scripts/run_script_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ console.log("script_name", script_name);

var child;
if (process.platform === "win32") {
child = spawn("powershell.exe", [`./electron-server/${script_name}.ps1`]);
child = spawn("powershell.exe", [`./electron-server/${script_name}.ps1`, process.argv[3]]);
} else if (process.platform === "linux") {
child = spawn(`./electron-server/${script_name}.sh`, [process.argv[3]]);
}
Expand Down

0 comments on commit 7ac7413

Please sign in to comment.