[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Fixing python3 support



commit 7f356311909a12c9ad4ad3c0021daf5e5fa73d33
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Feb 17 09:59:38 2015 -0800

    Fixing python3 support
    
    Earlier changes rolled back support for python3. Not sure why.
---
 stem/util/system.py |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/stem/util/system.py b/stem/util/system.py
index 9ee8ad6..2c15d23 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -55,7 +55,7 @@ import time
 import stem.util.proc
 import stem.util.str_tools
 
-from stem import UNDEFINED
+from stem import UNDEFINED, str_type
 from stem.util import log
 
 # Mapping of commands to if they're available or not.
@@ -243,7 +243,7 @@ def is_running(command):
       command_listing = call(secondary_resolver, None)
 
     if command_listing:
-      command_listing = map(unicode.strip, command_listing)
+      command_listing = map(str_type.strip, command_listing)
       return command in command_listing
 
   return None
@@ -329,7 +329,7 @@ def pid_by_name(process_name, multiple = False):
 
     if results:
       try:
-        pids = map(int, results)
+        pids = list(map(int, results))
 
         if multiple:
           return pids
@@ -350,7 +350,7 @@ def pid_by_name(process_name, multiple = False):
 
     if results and len(results) == 1:
       try:
-        pids = map(int, results[0].split())
+        pids = list(map(int, results[0].split()))
 
         if multiple:
           return pids
@@ -382,7 +382,7 @@ def pid_by_name(process_name, multiple = False):
 
       if results:
         try:
-          pids = map(int, results[1:])
+          pids = list(map(int, results[1:]))
 
           if multiple:
             return pids
@@ -400,7 +400,7 @@ def pid_by_name(process_name, multiple = False):
         results = [r.split()[0] for r in results if r.endswith(' %s' % process_name)]
 
         try:
-          pids = map(int, results)
+          pids = list(map(int, results))
 
           if multiple:
             return pids
@@ -428,7 +428,7 @@ def pid_by_name(process_name, multiple = False):
 
     if results:
       try:
-        pids = map(int, results)
+        pids = list(map(int, results))
 
         if multiple:
           return pids
@@ -990,7 +990,7 @@ def get_process_name():
 
       args, argc = [], argc_t()
 
-      for i in xrange(100):
+      for i in range(100):
         # The ending index can be either None or raise a ValueError when
         # accessed...
         #



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits