From: Peter Wu Date: Thu, 25 Feb 2016 23:23:48 +0000 (+0100) Subject: browse.py: Python 3 compatibility X-Git-Tag: upstream/1.7.0^2~10^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=f7491398a2e97c7c76d5a28cfb3b8ce1a0a1a580;p=platform%2Fupstream%2Fninja.git browse.py: Python 3 compatibility --- diff --git a/src/browse.py b/src/browse.py index 081eb8c..bf85e4d 100755 --- a/src/browse.py +++ b/src/browse.py @@ -31,7 +31,10 @@ import socket import subprocess import sys import webbrowser -import urllib2 +try: + from urllib.request import unquote +except ImportError: + from urllib2 import unquote from collections import namedtuple Node = namedtuple('Node', ['inputs', 'rule', 'target', 'outputs']) @@ -154,7 +157,7 @@ def ninja_dump(target): class RequestHandler(httpserver.BaseHTTPRequestHandler): def do_GET(self): assert self.path[0] == '/' - target = urllib2.unquote(self.path[1:]) + target = unquote(self.path[1:]) if target == '': self.send_response(302)