X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c4aae34046b764d27402e97349b95aec49fc1ba3..a4c8f1898670317d0fa33bf1b1a904ea922b78cc:/src/smpi/smpirun.in
diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in
index d095d29778..72d381929d 100755
--- a/src/smpi/smpirun.in
+++ b/src/smpi/smpirun.in
@@ -299,8 +299,6 @@ fi
if [ -z "${HOSTFILE}" ] ; then
HOSTFILETMP=1
HOSTFILE="$(mktemp smpitmp-hostfXXXXXX)"
- perl -ne 'print "$1\n" if /.*.*/' ${PLATFORM} > ${HOSTFILE}
- # put all > ${HOSTFILE}
+ ' < ${PLATFORM} > ${HOSTFILE}
fi
UNROLLEDHOSTFILETMP=0
-#parse if our lines are terminated by :num_process
-multiple_processes=$(grep -c ":" $HOSTFILE)
-if [ "${multiple_processes}" -gt 0 ] ; then
+# parse if our lines are terminated by :num_process
+if grep -q ':' $HOSTFILE ; then
UNROLLEDHOSTFILETMP=1
UNROLLEDHOSTFILE="$(mktemp smpitmp-hostfXXXXXX)"
- perl -ne ' do{ for ( 1 .. $2 ) { print "$1\n" } } if /(.*?):(\d+).*/' ${HOSTFILE} > ${UNROLLEDHOSTFILE}
+ @PYTHON_EXECUTABLE@ -c '
+import sys
+import re
+
+for line in sys.stdin:
+ m = re.match("(.*):(.*)", line)
+ if m:
+ for i in range(0, int(m.group(2))):
+ print(m.group(1))
+ else:
+ print(line.strip())
+' < ${HOSTFILE} > ${UNROLLEDHOSTFILE}
if [ ${HOSTFILETMP} = 1 ] ; then
rm ${HOSTFILE}
HOSTFILETMP=0