[pacman-dev] [PATCH 2/8] Use Python's "exec" instead of deprecated "execfile".

Jeremy Heiner scalaprotractor at gmail.com
Wed Oct 9 20:35:05 EDT 2013


This was the only issue reported by "python2 -3".

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
---
 test/pacman/pmtest.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py
index b343d55..c183161 100644
--- a/test/pacman/pmtest.py
+++ b/test/pacman/pmtest.py
@@ -100,7 +100,11 @@ def load(self):
         if os.path.isfile(self.name):
             # all tests expect this to be available
             from pmpkg import pmpkg
-            execfile(self.name)
+            input = open(self.name)
+            try: # a "with" would be perfect here...
+                exec(input.read())
+            finally: # ...but isn't available in Python 2.5
+                input.close()
         else:
             raise IOError("file %s does not exist!" % self.name)
 
-- 
1.8.4



More information about the pacman-dev mailing list