|
40 | 40 | export FORNIX_FOLDER="$(dirname "$(dirname "$path_to_file")")"
|
41 | 41 | fi
|
42 | 42 |
|
| 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 |
43 | 48 |
|
44 | 49 | #
|
45 |
| -# check for requirements.txt |
| 50 | +# check for python-poetry |
46 | 51 | #
|
47 |
| -if [ -f "$FORNIX_FOLDER/requirements.txt" ] |
| 52 | +if [ -f "$FORNIX_FOLDER/pyproject.toml" ] && [ -n "$(command -v "poetry")" ] |
48 | 53 | then
|
49 | 54 | # main inputs
|
50 | 55 | __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" |
53 | 58 | 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 | + |
54 | 63 | # 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 |
56 | 65 | # if successful
|
57 | 66 | if [ $? -eq 0 ]
|
58 | 67 | then
|
@@ -103,21 +112,17 @@ then
|
103 | 112 | fi
|
104 | 113 |
|
105 | 114 | #
|
106 |
| -# check for python-poetry |
| 115 | +# check for requirements.txt |
107 | 116 | #
|
108 |
| -if [ -f "$FORNIX_FOLDER/pyproject.toml" ] && [ -n "$(command -v "poetry")" ] |
| 117 | +if [ -f "$FORNIX_FOLDER/requirements.txt" ] |
109 | 118 | then
|
110 | 119 | # main inputs
|
111 | 120 | __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" |
114 | 123 | 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 |
| - |
119 | 124 | # 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" |
121 | 126 | # if successful
|
122 | 127 | if [ $? -eq 0 ]
|
123 | 128 | then
|
|
0 commit comments