diff --git a/electron-server/back/build.ps1 b/electron-server/back/build.ps1 index e9f709e..7cde613 100644 --- a/electron-server/back/build.ps1 +++ b/electron-server/back/build.ps1 @@ -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 .\ \ No newline at end of file +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 .\ \ No newline at end of file diff --git a/electron-server/back/compile.ps1 b/electron-server/back/compile.ps1 deleted file mode 100644 index f6dc0cf..0000000 --- a/electron-server/back/compile.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -Remove-Item -Recurse -Force /electron-server/back/requirements.txt -ErrorAction:SilentlyContinue -pip install pip-tools -pip-compile electron-server/back/requirements.in \ No newline at end of file diff --git a/electron-server/back/install.ps1 b/electron-server/back/install.ps1 deleted file mode 100644 index db12da8..0000000 --- a/electron-server/back/install.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -Remove-Item -Recurse -Force .\electron-server\back\venv\ -ErrorAction:SilentlyContinue -Remove-Item -Recurse -Force .\electron-server\back\dist\ -ErrorAction:SilentlyContinue -Remove-Item -Recurse -Force .\electron-server\build\ -ErrorAction:SilentlyContinue -$folder=".\electron-server\back\venv" -python -m venv $folder - -$bin_folder = $folder + "\Lib\site-packages\vease_back" -$folder\Scripts\Activate - -pip install -r .\electron-server\back\requirements.txt diff --git a/electron-server/back/requirements.txt b/electron-server/back/requirements.txt index 045cb84..2e8688a 100644 --- a/electron-server/back/requirements.txt +++ b/electron-server/back/requirements.txt @@ -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 @@ -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 @@ -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 diff --git a/electron-server/compile.ps1 b/electron-server/compile.ps1 new file mode 100644 index 0000000..ce15010 --- /dev/null +++ b/electron-server/compile.ps1 @@ -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" \ No newline at end of file diff --git a/electron-server/install.ps1 b/electron-server/install.ps1 new file mode 100644 index 0000000..999edda --- /dev/null +++ b/electron-server/install.ps1 @@ -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" diff --git a/electron-server/install.sh b/electron-server/install.sh index 6040dbc..d4bc6ce 100755 --- a/electron-server/install.sh +++ b/electron-server/install.sh @@ -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 diff --git a/electron-server/viewer/build.ps1 b/electron-server/viewer/build.ps1 new file mode 100644 index 0000000..13365a3 --- /dev/null +++ b/electron-server/viewer/build.ps1 @@ -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 .\ \ No newline at end of file diff --git a/electron-server/viewer/compile.ps1 b/electron-server/viewer/compile.ps1 deleted file mode 100644 index 985f12b..0000000 --- a/electron-server/viewer/compile.ps1 +++ /dev/null @@ -1,5 +0,0 @@ -$viewer_path=".\electron-server\viewer" - -Remove-Item -Recurse -Force $viewer_path + "\requirements.txt" -ErrorAction:SilentlyContinue -pip install pip-tools -pip-compile $viewer_path + "\requirements.in" \ No newline at end of file diff --git a/electron-server/viewer/install.ps1 b/electron-server/viewer/install.ps1 deleted file mode 100644 index 100c98e..0000000 --- a/electron-server/viewer/install.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -$viewer_path=".\electron-server\viewer" - -Remove-Item -Recurse -Force $viewer_path + "\venv\" -ErrorAction:SilentlyContinue -Remove-Item -Recurse -Force $viewer_path + "\dist\" -ErrorAction:SilentlyContinue -Remove-Item -Recurse -Force $viewer_path + "\build\" -ErrorAction:SilentlyContinue - -$venv_path=$viewer_path + "\venv" -python -m venv $venv_path - -$bin_folder = $venv_path + "\Lib\site-packages\vease_viewer" -$venv_path\Scripts\Activate - -pip install -r $viewer_path + "\requirements.txt diff --git a/electron-server/viewer/requirements.txt b/electron-server/viewer/requirements.txt index ca0b1ce..2c57c13 100644 --- a/electron-server/viewer/requirements.txt +++ b/electron-server/viewer/requirements.txt @@ -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 @@ -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 @@ -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 diff --git a/node_scripts/run_script_file.js b/node_scripts/run_script_file.js index 8fd6fe9..128273b 100644 --- a/node_scripts/run_script_file.js +++ b/node_scripts/run_script_file.js @@ -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]]); }