Skip to content

Commit 2d0ec1c

Browse files
committed
Pick some Python instead of relying on python to be in PATH
1 parent 0aac4d4 commit 2d0ec1c

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

osg-system-profiler

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
#!/bin/bash -p
22
# ^ -p protects us from shellshock
33

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+
418
realdir ()
519
{
620
# print the canonical path of a directory, resolving symlinks in
@@ -217,11 +231,11 @@ ps -u xrootd u
217231
echo ""
218232

219233
echo "***** Python information:"
220-
python -c "import sys; print 'Version: ' + sys.version"
221-
python -c "import sys; print 'Executable: ' + sys.executable"
222-
python -c "import sys; print 'Prefix: ' + sys.prefix"
223-
python -c 'import platform; print "Architecture: ",; print platform.architecture()'
224-
python -c "import sys; print 'Search paths: ',; print sys.path"
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))"
225239
echo ""
226240

227241
run_cmd openssl version

0 commit comments

Comments
 (0)