#2058: Simfactory assumes python is python2 ------------------------+--------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Keywords: | ------------------------+--------------------------------------------------- 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.
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+-------------------------------------------------- Changes (by hinder):
* keywords: => newuser
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+--------------------------------------------------
Comment (by sbrandt):
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 }}}
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+--------------------------------------------------
Comment (by eschnett):
This should check {{{python2}}} first.
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+--------------------------------------------------
Comment (by sbrandt):
If I agree to make that change can you put it in review_ok?
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+--------------------------------------------------
Comment (by rhaas):
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).
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+--------------------------------------------------
Comment (by sbrandt):
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 }}}
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+--------------------------------------------------
Comment (by eschnett):
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.
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: new Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+--------------------------------------------------
Comment (by sbrandt):
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 }}}
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: review Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+-------------------------------------------------- Changes (by rhaas):
* status: new => review
Comment:
Change to review state.
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: reviewed_ok Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: | Keywords: newuser -------------------------+-------------------------------------------------- Changes (by rhaas):
* status: review => reviewed_ok
Comment:
Looks ok. Please apply.
#2058: Simfactory assumes python is python2 -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: defect | Status: closed Priority: unset | Milestone: Component: SimFactory | Version: development version Resolution: fixed | Keywords: newuser -------------------------+-------------------------------------------------- Changes (by sbrandt):
* status: reviewed_ok => closed * resolution: => fixed
Comment:
Fixed in commit 96d3250cc317cceb179b9f4b6f69f9344802a6fd of https://bitbucket.org/simfactory/simfactory2.git
trac@lists.einsteintoolkit.org