Skip to content

Commit ea53250

Browse files
committed
fix poetry install and setup
1 parent dbceccb commit ea53250

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

settings/extensions/nix/nix.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
#
4343
# Python
4444
#
45-
[[packages]]
46-
load = [ "poetry",]
47-
4845
[[packages]]
4946
load = [ "python38",]
5047

@@ -60,6 +57,16 @@ load = [ "python38Packages", "virtualenv",]
6057
[[packages]]
6158
load = [ "python38Packages", "wheel",]
6259

60+
[[packages]]
61+
load = [ "cmake",]
62+
63+
[[packages]]
64+
load = [ "pkg-config",]
65+
66+
[[packages]]
67+
load = [ "libffi",]
68+
69+
6370
#
6471
# for .so errors on linux with opencv+ffmpeg
6572
#

settings/extensions/python/commands/ensure_pip_modules

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,28 @@ then
4040
export FORNIX_FOLDER="$(dirname "$(dirname "$path_to_file")")"
4141
fi
4242

43+
echo '(which python): '"$(which python)"
44+
# if poetry not installed, install it
45+
if ! python -c "import poetry" 2>/dev/null; then
46+
python -m pip --disable-pip-version-check install poetry==1.2.1 || python -m pip --disable-pip-version-check install poetry
47+
fi
4348

4449
#
45-
# check for requirements.txt
50+
# check for python-poetry
4651
#
47-
if [ -f "$FORNIX_FOLDER/requirements.txt" ]
52+
if [ -f "$FORNIX_FOLDER/pyproject.toml" ] && [ -n "$(command -v "poetry")" ]
4853
then
4954
# main inputs
5055
__temp_var__command_name="tools/python/check_pip_modules"
51-
__temp_var__file_to_watch="$FORNIX_FOLDER/requirements.txt"
52-
__temp_var__hash_check_name="pip_modules"
56+
__temp_var__file_to_watch="$FORNIX_FOLDER/pyproject.toml"
57+
__temp_var__hash_check_name="pip_poetry_modules"
5358
failed_check_command () {
59+
# for newer versions of poetry tell them to use the existing virtual env
60+
poetry config virtualenvs.path --unset 2>/dev/null
61+
poetry config virtualenvs.in-project true 2>/dev/null
62+
5463
# what to do when node modules haven't been installed yet
55-
python -m pip --disable-pip-version-check install -r "$__temp_var__file_to_watch"
64+
poetry install
5665
# if successful
5766
if [ $? -eq 0 ]
5867
then
@@ -103,21 +112,17 @@ then
103112
fi
104113

105114
#
106-
# check for python-poetry
115+
# check for requirements.txt
107116
#
108-
if [ -f "$FORNIX_FOLDER/pyproject.toml" ] && [ -n "$(command -v "poetry")" ]
117+
if [ -f "$FORNIX_FOLDER/requirements.txt" ]
109118
then
110119
# main inputs
111120
__temp_var__command_name="tools/python/check_pip_modules"
112-
__temp_var__file_to_watch="$FORNIX_FOLDER/pyproject.toml"
113-
__temp_var__hash_check_name="pip_poetry_modules"
121+
__temp_var__file_to_watch="$FORNIX_FOLDER/requirements.txt"
122+
__temp_var__hash_check_name="pip_modules"
114123
failed_check_command () {
115-
# for newer versions of poetry tell them to use the existing virtual env
116-
poetry config virtualenvs.path --unset 2>/dev/null
117-
poetry config virtualenvs.in-project true 2>/dev/null
118-
119124
# what to do when node modules haven't been installed yet
120-
poetry install
125+
python -m pip --disable-pip-version-check install -r "$__temp_var__file_to_watch"
121126
# if successful
122127
if [ $? -eq 0 ]
123128
then

settings/extensions/python/commands/setup_venv

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
export TMPDIR="$FORNIX_HOME/tmp.cleanable"
33
mkdir -p "$TMPDIR"
44
export VIRTUAL_ENV="$FORNIX_FOLDER/.venv"
5-
export PATH="$VIRTUAL_ENV/bin:$PATH"
5+
export PATH="$FORNIX_HOME/.local/bin:$PATH"
66
if ! [ -d "$VIRTUAL_ENV" ]
77
then
88
echo "creating virtual env for python"
@@ -11,5 +11,7 @@ then
1111
python -m venv "$VIRTUAL_ENV" && echo "virtual env created"
1212
fi
1313

14+
export PATH="$VIRTUAL_ENV/bin:$PATH"
15+
1416
# fix SSL issues
1517
export SSL_CERT_FILE="$(python -c 'import ssl; print(ssl.get_default_verify_paths().openssl_cafile)')"

settings/extensions/python/during_purge.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ then
2121
"$FORNIX_FOLDER/settings/extensions/#standard/commands/tools/file_system/remove" "$FORNIX_HOME/.keras"
2222
"$FORNIX_FOLDER/settings/extensions/#standard/commands/tools/file_system/remove" "$FORNIX_HOME/.local/share/jupyter"
2323
"$FORNIX_FOLDER/settings/extensions/#standard/commands/tools/file_system/remove" "$FORNIX_HOME/.python_history"
24+
"$FORNIX_FOLDER/settings/extensions/#standard/commands/tools/file_system/remove" "$FORNIX_HOME/Library/Application Support/pypoetry"
25+
"$FORNIX_FOLDER/settings/extensions/#standard/commands/tools/file_system/remove" "$FORNIX_HOME/Library/Application Support/virtualenv"
26+
"$FORNIX_FOLDER/settings/extensions/#standard/commands/tools/file_system/remove" "$FORNIX_HOME/Library/Library/Preferences/pypoetry"
2427
fi

0 commit comments

Comments
 (0)