-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python virtual environment for linux
- Loading branch information
Showing
31 changed files
with
173 additions
and
12 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 |
---|---|---|
@@ -1,7 +1,22 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
# Get script current directory | ||
SRC_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
# Check if virtual environment is created | ||
if ! [ -f "$SRC_HOME/env/log.info" ] | ||
then | ||
bash "$SRC_HOME/install/install_linux.sh" | ||
fi | ||
|
||
# Electron path | ||
ELECTRON="$SRC_HOME/electron-v11.0.3-linux-x64/electron" | ||
|
||
# Execute electron with app | ||
"$SRC_HOME/node_modules/electron/dist/electron" "$SRC_HOME/app" | ||
"$ELECTRON" "$SRC_HOME/app" | ||
|
||
# If user closed before finishing process, kill processes | ||
if [ $? -eq 99 ] | ||
then | ||
kill -9 $(ps -o pid= | grep -v -E "($$|$PPID)" ) > /dev/null 2>&1 | ||
fi |
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
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
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/Adduct.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/Element.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/FattyAcid.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/Fragment.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidAdduct.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidCategory.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidClass.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidExceptions.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidFaBondType.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...pApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidIsomericSubspecies.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidLevel.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...App/app/src/pyModules/pygoslin/domain/__pycache__/LipidMolecularSubspecies.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidSpecies.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/LipidSpeciesInfo.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...pp/app/src/pyModules/pygoslin/domain/__pycache__/LipidStructuralSubspecies.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/domain/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...opApp/app/src/pyModules/pygoslin/parser/__pycache__/BaseParserEventHandler.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...src/pyModules/pygoslin/parser/__pycache__/GoslinFragmentParserEventHandler.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...App/app/src/pyModules/pygoslin/parser/__pycache__/GoslinParserEventHandler.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...opApp/app/src/pyModules/pygoslin/parser/__pycache__/HmdbParserEventHandler.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
.../app/src/pyModules/pygoslin/parser/__pycache__/LipidMapsParserEventHandler.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/parser/__pycache__/Parser.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
desktopApp/app/src/pyModules/pygoslin/parser/__pycache__/ParserCommon.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...app/src/pyModules/pygoslin/parser/__pycache__/SumFormulaParserEventHandler.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(100%)
...pp/src/pyModules/pygoslin/parser/__pycache__/SwissLipidsParserEventHandler.cpython-37.pyc
Binary file not shown.
Binary file modified
BIN
-12 Bytes
(99%)
desktopApp/app/src/pyModules/pygoslin/parser/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
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,140 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
################### | ||
# Local functions # | ||
################### | ||
|
||
function checkPython { | ||
"$PYTHON" --version > /dev/null 2>&1 | ||
|
||
if [ $? -eq 0 ] | ||
then | ||
# if python is in path, check version | ||
local PY_VERSION="$("$PYTHON" --version)" | ||
checkVersion "$PY_VERSION" | ||
|
||
else | ||
# if python is not in path, ask user to give it | ||
getPython | ||
fi | ||
} | ||
|
||
|
||
function checkVersion { | ||
# get version | ||
local VERSION=$(grep -E -o "Python\s[0-9]" <(echo "$1")) | ||
local SUB_VERSION=$(grep -E -o "Python\s[0-9]\.[0-9]" <(echo "$1") | grep -E -o "[0-9]$") | ||
|
||
if [ "$VERSION" != "Python 3" ] | ||
then | ||
echo "** ERROR: Using $VERSION instead of Python 3" | ||
getPython | ||
fi | ||
|
||
if ! [ "$SUB_VERSION" -ge "6" ] | ||
then | ||
echo "** ERROR: Using $VERSION.$SUB_VERSION instead of Python 3.6 or greater" | ||
getPython | ||
fi | ||
|
||
createVENV | ||
|
||
} | ||
|
||
|
||
function getPython { | ||
echo "** Python not found" | ||
read -p "** Enter full path to Python (or q to exit): " PYTHON | ||
|
||
if [ $PYTHON -eq "q" ] | ||
then | ||
endInstall | ||
|
||
else | ||
checkPython | ||
fi | ||
} | ||
|
||
|
||
function createVENV { | ||
|
||
echo "** Creating virtual environment" | ||
rm -rf "$SRC_HOME/../env" | ||
"$PYTHON" -m venv "$SRC_HOME/../env" | ||
|
||
if ! [ $? -eq 0 ] | ||
then | ||
echo "** ERROR: An error occurred while creating virtual environment" | ||
rm -rf "$SRC_HOME/../env" | ||
endInstall | ||
fi | ||
|
||
local PYTHON_ENV="$SRC_HOME/../env/bin/python" | ||
local PIP_ENV="$SRC_HOME/../env/bin/pip" | ||
|
||
echo "** Updating pip" | ||
"$PYTHON_ENV" -m pip install --upgrade pip | ||
|
||
if ! [ $? -eq 0 ] | ||
then | ||
echo "** ERROR: An error occurred while updating pip" | ||
rm -rf "$SRC_HOME/../env" | ||
endInstall | ||
fi | ||
|
||
echo "** Installing modules" | ||
"$PIP_ENV" install numpy pandas xlrd xlwt --no-warn-script-location | ||
if ! [ $? -eq 0 ] | ||
then | ||
echo "** ERROR: An error occurred while installing modules" | ||
rm -rf "$SRC_HOME/../env" | ||
endInstall | ||
fi | ||
|
||
echo "$(date) - INFO: Python Virtual Environment for TurboPutative created" > "$SRC_HOME/../env/log.info" | ||
checkVENV | ||
} | ||
|
||
|
||
function checkVENV { | ||
|
||
if [ -f "$SRC_HOME/../env/log.info" ] | ||
then | ||
# if it exists, exit... | ||
envCreated | ||
fi | ||
|
||
} | ||
|
||
|
||
function envCreated { | ||
echo "** Python virtual environment created" | ||
endInstall | ||
} | ||
|
||
|
||
function endInstall { | ||
echo "** Installation process finished" | ||
exit | ||
} | ||
|
||
############## | ||
# Start main # | ||
############## | ||
|
||
echo "**" | ||
echo "** CREATING PYTHON VIRTUAL ENVIRONMENT" | ||
echo "**" | ||
|
||
# Define SRC_HOME | ||
SRC_HOME="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
|
||
# Default python | ||
PYTHON="python" | ||
|
||
# Check if env folder already exists | ||
checkVENV | ||
|
||
# Start checking default python | ||
checkPython |