Skip to content

Commit 0bfc815

Browse files
Update pypirun.sh (#27)
Another attempt at fixing the sd-cmd for fedora. Change the version check to also check for pip and venv modules in the interpreter.
1 parent 8d6f633 commit 0bfc815

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sd-cmd/pypirun.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616

1717
# set -e
1818
export PATH=$PATH:/opt/python/cp38-cp38m/bin:/opt/python/cp37-cp37m/bin:/opt/python/cp36-cp36m/bin:/opt/python/cp35-cp35m/bin:/opt/python/bin:/usr/local/bin:~/.local/bin
19-
PYTHON_VERSION="`python3 --version 2>/dev/null`" || true
19+
VERSION="`python3 -c "import pip,sys,venv;print(str(sys.version_info.major)+'.'+str(sys.version_info.minor))" 2>/dev/null`"
20+
RC="$?"
21+
if [ "$RC" != "0" ]; then
22+
PYTHON_VERSION=""
23+
fi
2024

2125
function install_python {
2226
if [ "$PYTHON_VERSION" != "" ]; then
@@ -44,7 +48,7 @@ function install_pyrun {
4448
python -m pypirun.utility 2>/dev/null
4549
RC="$?"
4650
if [ "$RC" != "0" ]; then
47-
python3 -m pip install -q --user pypirun 2> /dev/null
51+
python3 -m pip install -q pypirun 2> /dev/null
4852
fi
4953
}
5054

@@ -58,7 +62,7 @@ function pyrun_command {
5862
}
5963

6064
function ensure_venv_works {
61-
python3 -m venv /tmp/foo > /dev/null 2>&1
65+
python3 -m venv --clear /tmp/foo > /dev/null 2>&1
6266
RC="$?"
6367
if [ "$RC" = "1" ]; then
6468
PYTHON_VERSION=""

0 commit comments

Comments
 (0)