[CRIU] [PATCH 3/4] python: specify python2 as .py interpreter

Dmitry Safonov dsafonov at virtuozzo.com
Mon Apr 10 12:41:52 PDT 2017


On some distro the default python interpreter is Python 3,
which results in such errors:
>  Running zdtm/static/socket-tcp-closed.hook(--post-start)
>  make[1]: Nothing to be done for default.
>  ./socket-tcp-closed --pidfile=socket-tcp-closed.pid --outfile=socket-tcp-closed.out
>    File "zdtm/static/socket-tcp-closed.hook", line 16
>      except OSError, e:
>                    ^
>  SyntaxError: invalid syntax
>  ######### Test zdtm/static/socket-tcp-closed FAIL at hook --post-start #########
>  Running zdtm/static/socket-tcp-closed.hook(--clean)
>    File "zdtm/static/socket-tcp-closed.hook", line 16
>      except OSError, e:
>                    ^
>  SyntaxError: invalid syntax
>  Traceback (most recent call last):
>    File "zdtm.py", line 1921, in <module>
>      do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
>    File "zdtm.py", line 1388, in do_run_test
>      try_run_hook(t, ["--clean"])
>    File "zdtm.py", line 1053, in try_run_hook
>      raise test_fail_exc("hook " + " ".join(args))
>  __main__.test_fail_exc: <__main__.test_fail_exc instance at 0x76294468>

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 coredump/criu-coredump                     | 2 +-
 crit/crit                                  | 2 +-
 lib/py/images/images.py                    | 2 +-
 scripts/magic-gen.py                       | 2 +-
 test/check_actions.py                      | 2 +-
 test/others/ext-tty/run.py                 | 2 +-
 test/zdtm/static/socket-tcp-fin-wait1.hook | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/coredump/criu-coredump b/coredump/criu-coredump
index b667e862ac9f..25c188c6bc46 100755
--- a/coredump/criu-coredump
+++ b/coredump/criu-coredump
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 import argparse
 import os
 
diff --git a/crit/crit b/crit/crit
index cc3f5ab220de..8b1e19bb99e5 100755
--- a/crit/crit
+++ b/crit/crit
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 import argparse
 import sys
 import json
diff --git a/lib/py/images/images.py b/lib/py/images/images.py
index 4d8fc10c2029..0f3e8b3a1d0c 100644
--- a/lib/py/images/images.py
+++ b/lib/py/images/images.py
@@ -1,4 +1,4 @@
-#!/bin/env python
+#!/bin/env python2
 
 # This file contains methods to deal with criu images.
 #
diff --git a/scripts/magic-gen.py b/scripts/magic-gen.py
index 6719e4c3ee17..319e99812b09 100755
--- a/scripts/magic-gen.py
+++ b/scripts/magic-gen.py
@@ -1,4 +1,4 @@
-#!/bin/env python
+#!/bin/env python2
 import os, sys
 import struct
 
diff --git a/test/check_actions.py b/test/check_actions.py
index 70d257fbd178..96c07a758f5c 100755
--- a/test/check_actions.py
+++ b/test/check_actions.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import sys
 import os
diff --git a/test/others/ext-tty/run.py b/test/others/ext-tty/run.py
index 3806d5043880..052f9c1a1426 100755
--- a/test/others/ext-tty/run.py
+++ b/test/others/ext-tty/run.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 import subprocess
 import os, sys, time, signal, pty
 
diff --git a/test/zdtm/static/socket-tcp-fin-wait1.hook b/test/zdtm/static/socket-tcp-fin-wait1.hook
index ae0b51d3928a..9630e0d74d25 100755
--- a/test/zdtm/static/socket-tcp-fin-wait1.hook
+++ b/test/zdtm/static/socket-tcp-fin-wait1.hook
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 import sys
 
 sys.path.append("../crit")
-- 
2.12.2



More information about the CRIU mailing list