- removed comment
Simfactory assumes python is python2
Simfactory assumes that python is python2. Until recently this seems to have been a valid assumption, but it is no longer so. The "sim" script needs to be updated to check the version of python before invoking any of the simfactory commands.
Keyword: newuser
Comments (12)
-
-
reporter - removed comment
Based on conversations and emails, I think this is what we want.
diff --git a/bin/sim b/bin/sim index 92f74ab..c6bc075 100755 --- a/bin/sim +++ b/bin/sim @@ -20,4 +20,18 @@ if [ -z "$cmd" ]; then fi # Forward the call -exec python "$cmd" "$@" +for PYEXE in python python2 +do + $PYEXE - > /dev/null 2>&1 << EOF +import sys +if sys.hexversion < 0x3000000: + exit(0) +else: + exit(1) +EOF + if [ $? = 0 ] + then + exec $PYEXE "$cmd" "$@" + break + fi +done
-
- removed comment
This should check
python2
first. -
reporter - removed comment
If I agree to make that change can you put it in review_ok?
-
- removed comment
Since we are version testing, it would also make sense to put in a minimal accepted version (likely python 2.6 or 2.7) I think. The "break" should likely be replaced by an "exit $?" since "exec" can return to its caller (eg if redirection fails, but not if it fails to execute the program).
-
reporter - removed comment
I don't want to pick an arbitrary minimum version. If you know of a version for which Simfactory doesn't then I'm all for setting one, otherwise I'd rather not. Using exits make some sense. Anyway, here's what I currently suggest.
# Forward the call for PYEXE in python2 python do $PYEXE - > /dev/null 2>&1 << EOF import sys if sys.hexversion < 0x3000000: exit(0) else: exit(1) EOF if [ $? = 0 ] then exec $PYEXE "$cmd" "$@" exit 1 fi done exit 2
-
- removed comment
Simfactory requires Python 2.3, since that was installed on Queen Bee at the time it was developed, and Queen Bee (at that time) had one of the oldest Red Hat versions. We might have switched to Python 2.6 in the mean time, either accidentally or on purpose, but I'd go with 2.3.
-
reporter - removed comment
OK, then. Version 2.3 corresponds to 0x2030000.
# Forward the call for PYEXE in python2 python do $PYEXE - > /dev/null 2>&1 << EOF import sys if sys.hexversion >= 0x2030000 and sys.hexversion < 0x3000000: exit(0) else: exit(1) EOF if [ $? = 0 ] then exec $PYEXE "$cmd" "$@" exit 1 fi done exit 2
-
- changed status to open
- removed comment
Change to review state.
-
- changed status to open
- removed comment
Looks ok. Please apply.
-
reporter - changed status to resolved
- removed comment
-
- changed status to closed
- edited description
- Log in to comment