mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge pull request #229 from DJ2LS/issue_226_additions
Add environment creation scripts.
This commit is contained in:
commit
5ded4020d7
4 changed files with 123 additions and 0 deletions
20
requirements.txt
Normal file
20
requirements.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
crcengine
|
||||
numpy
|
||||
psutil
|
||||
PyAudio
|
||||
pyserial
|
||||
sounddevice
|
||||
structlog
|
||||
ujson
|
||||
|
||||
# Development and test dependencies
|
||||
autopep8
|
||||
black
|
||||
isort
|
||||
pycodestyle
|
||||
pyinstaller
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-cover
|
||||
pytest-coverage
|
||||
pytest-rerunfailures
|
33
tools/create_node_env.sh
Executable file
33
tools/create_node_env.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -d "gui" ]; then
|
||||
echo "Error: Run this script from the main FreeDATA directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Move into gui directory
|
||||
cd gui
|
||||
|
||||
# Common variables
|
||||
OLDPATH=${PATH}
|
||||
PATH=/usr/bin:/bin:/usr/local/bin
|
||||
NPM=$(which npm)
|
||||
PATH=${OLDPATH}
|
||||
VENVDIR="$(pwd)/node_modules"
|
||||
PATH_ADDITIONS="$(pwd)/node_modules/bin:$(pwd)/node_modules/.bin"
|
||||
|
||||
# Verify NPM exists.
|
||||
if [ -z "${NPM}" ] || [ ! -x "${NPM}" ]; then
|
||||
echo "Error: ${NPM} isn't executable or doesn't exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${NPM} install n
|
||||
${NPM} i
|
||||
|
||||
PATH=${PATH_ADDITIONS}:${PATH}
|
||||
|
||||
n stable
|
||||
|
||||
echo ""
|
||||
echo "Be sure to add '$PATH_ADDITIONS' to your path."
|
48
tools/create_python_env.sh
Executable file
48
tools/create_python_env.sh
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -d "tnc" ]; then
|
||||
echo "Error: Run this script from the main FreeDATA directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Common variables
|
||||
VENVDIR="$(pwd)/.venv"
|
||||
|
||||
# Choose an appropriate python interpreter
|
||||
CHOSEN=/bin/python3
|
||||
for i in python3.8 python3.9 python3.10 python3.7
|
||||
do
|
||||
if [ -x /bin/$i ]; then
|
||||
CHOSEN="/bin/$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Verify it's there.
|
||||
if [ ! -x ${CHOSEN} ]; then
|
||||
echo "Error: ${CHOSEN} is not executable or does not exist."
|
||||
echo "Note: FreeDATA requires Python 3 (higher than version 3.6)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clear the existing virtual environment.
|
||||
if [ -e "${VENVDIR}" ]; then
|
||||
${CHOSEN} -m venv "${VENVDIR}" --clear
|
||||
fi
|
||||
|
||||
# Create the virtual environment
|
||||
${CHOSEN} -m venv "${VENVDIR}"
|
||||
|
||||
# Activate the virtual environment, if needed
|
||||
if [ -z "${VIRTUAL_ENV}" ] || [ "${VIRTUAL_ENV}" != "${VENVDIR}" ]; then
|
||||
source "${VENVDIR}/activate"
|
||||
fi
|
||||
|
||||
# Cease using ${CHOSEN} as the interpreter we want now is in our path.
|
||||
|
||||
# Install packages
|
||||
python3 -m pip install -U pip wheel
|
||||
python3 -m pip install -r requirements.txt
|
||||
|
||||
echo ""
|
||||
echo "Be sure to run '. $VENVDIR/activate' before starting the daemon."
|
22
tools/setup_python_node.sh
Executable file
22
tools/setup_python_node.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ ! -d "tnc" ]; then
|
||||
echo "Error: Run this script from the main FreeDATA directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HERE="$(pwd)"
|
||||
|
||||
echo "Running Python and NodeJS setup scripts for FreeDATA..."
|
||||
|
||||
bash tools/create_python_env.sh
|
||||
bash tools/create_node_env.sh
|
||||
|
||||
echo "Both Python and NodeJS were setup correctly."
|
||||
echo ""
|
||||
echo "Run the following to add the new Python environment to your path:"
|
||||
echo "source ${HERE}/.venv/activate"
|
||||
echo ""
|
||||
echo "Run the following to add the new NodeJS environment to your path:"
|
||||
echo "PATH=\${PATH}:${HERE}/gui/node_modules/bin:${HERE}/gui/node_modules/.bin"
|
Loading…
Reference in a new issue