|
1 | 1 | #!/bin/bash -p
|
2 | 2 | # ^ -p protects us from shellshock
|
3 | 3 |
|
4 |
| -# pick a python |
5 |
| -if command -v python >/dev/null 2>&1; then |
6 |
| - python=python |
7 |
| -elif command -v python3 >/dev/null 2>&1; then |
8 |
| - python=python3 |
9 |
| -elif command -v python2 >/dev/null 2>&1; then |
10 |
| - python=python2 |
11 |
| -elif test -x /usr/libexec/platform-python; then |
12 |
| - python=/usr/libexec/platform-python |
13 |
| -else |
14 |
| - echo >&2 "Can't find Python" |
15 |
| -fi |
16 |
| - |
17 |
| - |
18 | 4 | realdir ()
|
19 | 5 | {
|
20 | 6 | # print the canonical path of a directory, resolving symlinks in
|
@@ -138,6 +124,15 @@ message() {
|
138 | 124 | echo "$@" >&3
|
139 | 125 | }
|
140 | 126 |
|
| 127 | +python_info () { |
| 128 | + local python=$1 |
| 129 | + $python -c "import sys; print('Version: ' + sys.version)" |
| 130 | + $python -c "import sys; print('Executable: ' + sys.executable)" |
| 131 | + $python -c "import sys; print('Prefix: ' + sys.prefix)" |
| 132 | + $python -c 'import platform; print("Architecture: " + str(platform.architecture()))' |
| 133 | + $python -c "import sys; print('Search paths: ' + str(sys.path))" |
| 134 | +} |
| 135 | + |
141 | 136 | dir=`pwd`
|
142 | 137 |
|
143 | 138 | if [ ! -w $dir ]; then
|
@@ -231,12 +226,12 @@ ps -u xrootd u
|
231 | 226 | echo ""
|
232 | 227 |
|
233 | 228 | echo "***** Python information:"
|
234 |
| -$python -c "import sys; print('Version: ' + sys.version)" |
235 |
| -$python -c "import sys; print('Executable: ' + sys.executable)" |
236 |
| -$python -c "import sys; print('Prefix: ' + sys.prefix)" |
237 |
| -$python -c 'import platform; print("Architecture: " + str(platform.architecture()))' |
238 |
| -$python -c "import sys; print('Search paths: ' + str(sys.path))" |
239 |
| -echo "" |
| 229 | + |
| 230 | +for python in "$(command -v python)" "$(command -v python2)" "$(command -v python3)" "/usr/libexec/platform-python"; do |
| 231 | + if [[ -n $python && -x $python ]]; then |
| 232 | + python_info "$python" |
| 233 | + fi |
| 234 | +done |
240 | 235 |
|
241 | 236 | run_cmd openssl version
|
242 | 237 |
|
|
0 commit comments