rclchm: very small change in support of py3, but there are lots of issue in python-chm itself

This commit is contained in:
Jean-Francois Dockes 2018-02-22 15:54:33 +01:00
parent 5c80488465
commit c56c1d6f46

View File

@ -13,8 +13,14 @@ import sys
import os import os
import re import re
import posixpath import posixpath
import urlparse PY3 = sys.version > '3'
import urllib if PY3:
from urllib.parse import unquote as urllib_unquote
from urllib.parse import urlparse as urlparse_urlparse
else:
from urlparse import urlparse as urlparse_urlparse
from urllib import unquote as urllib_unquote
import subprocess import subprocess
import rclconfig import rclconfig
@ -102,7 +108,7 @@ class ChmTopicsParser(HTMLParser):
return return
# value may be url-encoded. Decode it. If there are no % in there, will # value may be url-encoded. Decode it. If there are no % in there, will
# do nothing # do nothing
value = urllib.unquote(value) value = urllib_unquote(value)
localpath = "" localpath = ""
ll = value.split(":") ll = value.split(":")
@ -149,7 +155,7 @@ class ChmWalker(HTMLParser):
href = val href = val
path = "" path = ""
res = urlparse.urlparse(href) res = urlparse_urlparse(href)
if (not res.scheme or res.scheme.lower == "ms-its"): if (not res.scheme or res.scheme.lower == "ms-its"):
path = res.path path = res.path
lpath = path.split(':') lpath = path.split(':')