mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Some easy python3 compatibility changes.
This commit is contained in:
parent
90257a1b5e
commit
032c4091c3
5 changed files with 11 additions and 7 deletions
2
Makefile
2
Makefile
|
|
@ -2,7 +2,7 @@
|
|||
PYVER:=2.7
|
||||
PYTHON?=python$(PYVER)
|
||||
VERSION:=$(shell $(PYTHON) setup.py --version)
|
||||
PLATFORM:=$(shell $(PYTHON) -c "from distutils.util import get_platform; print get_platform()")
|
||||
PLATFORM:=$(shell $(PYTHON) -c "from __future__ import print_function; from distutils.util import get_platform; print(get_platform())")
|
||||
APPNAME:=$(shell $(PYTHON) setup.py --name)
|
||||
AUTHOR:=$(shell $(PYTHON) setup.py --author)
|
||||
MAINTAINER:=$(shell $(PYTHON) setup.py --maintainer)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class PdfParser(_ParserPlugin):
|
|||
search_url(page.attrs["Contents"], url_data, pageno, set())
|
||||
if "Annots" in page.attrs:
|
||||
search_url(page.attrs["Annots"], url_data, pageno, set())
|
||||
except PSException, msg:
|
||||
except PSException as msg:
|
||||
if not msg.args:
|
||||
# at least show the class name
|
||||
msg = repr(msg)
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class RobotFileParser (object):
|
|||
else:
|
||||
log.debug(LOG_CHECK, "%r allow all (no text content)", self.url)
|
||||
self.allow_all = True
|
||||
except requests.HTTPError, x:
|
||||
except requests.HTTPError as x:
|
||||
if x.response.status_code in (401, 403):
|
||||
self.disallow_all = True
|
||||
log.debug(LOG_CHECK, "%r disallow all (code %d)", self.url, x.response.status_code)
|
||||
|
|
|
|||
10
setup.py
10
setup.py
|
|
@ -45,6 +45,10 @@ import subprocess
|
|||
import stat
|
||||
import glob
|
||||
import shutil
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = lambda x: x
|
||||
|
||||
# if a frozen Unix application should be built with cx_Freeze
|
||||
do_freeze = int(os.environ.get('LINKCHECKER_FREEZE', '0'))
|
||||
|
|
@ -291,7 +295,7 @@ def sign_the_code (dist_dir):
|
|||
print("*** signing the application code ***")
|
||||
try:
|
||||
subprocess.check_call(args)
|
||||
except subprocess.CalledProcessError, msg:
|
||||
except subprocess.CalledProcessError as msg:
|
||||
print("WARN: codesigning failed", msg)
|
||||
|
||||
|
||||
|
|
@ -416,8 +420,8 @@ class MyInstallData (install_data, object):
|
|||
for path in self.get_outputs():
|
||||
mode = os.stat(path)[stat.ST_MODE]
|
||||
if stat.S_ISDIR(mode):
|
||||
mode |= 011
|
||||
mode |= 044
|
||||
mode |= 0o11
|
||||
mode |= 0o44
|
||||
os.chmod(path, mode)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ def limit_time (seconds, skip=False):
|
|||
try:
|
||||
with _limit_time(seconds):
|
||||
return func(*args, **kwargs)
|
||||
except LinkCheckerInterrupt, msg:
|
||||
except LinkCheckerInterrupt as msg:
|
||||
if skip:
|
||||
pytest.skip("time limit of %d seconds exceeded" % seconds)
|
||||
assert False, msg
|
||||
|
|
|
|||
Loading…
Reference in a new issue