From 77de1545effc878039ed25352453bd8bf8ad2ab5 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Wed, 13 May 2020 19:50:19 +0100 Subject: [PATCH 1/5] Use setuptools.find_packages() --- setup.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index 7871f41f..8a1bb1fe 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ import stat import glob # import Distutils stuff -from setuptools import setup +from setuptools import find_packages, setup from distutils.command.install_lib import install_lib from distutils.command.sdist import sdist from distutils.command.clean import clean @@ -373,19 +373,7 @@ setup( 'clean': MyClean, 'sdist': MySdist, }, - packages = [ - 'linkcheck', - 'linkcheck.bookmarks', - 'linkcheck.cache', - 'linkcheck.checker', - 'linkcheck.configuration', - 'linkcheck.director', - 'linkcheck.htmlutil', - 'linkcheck.logger', - 'linkcheck.network', - 'linkcheck.parser', - 'linkcheck.plugins', - ], + packages = find_packages(include=["linkcheck", "linkcheck.*"]), scripts = scripts, data_files = data_files, classifiers = [ From adcc3e56905e20c74303a49efab12b2a6add8228 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Wed, 13 May 2020 19:50:19 +0100 Subject: [PATCH 2/5] Remove -R from linkchecker shebang This turned on hash randomization in Python 2 (>=2.6.8), in Python 3 this is enabled by default, unless PYTHONHASHSEED is 0. --- linkchecker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linkchecker b/linkchecker index 3073f13c..33ceaade 100755 --- a/linkchecker +++ b/linkchecker @@ -1,4 +1,4 @@ -#!/usr/bin/python -Ru +#!/usr/bin/python -u # Copyright (C) 2000-2014 Bastian Kleineidam # # This program is free software; you can redistribute it and/or modify From 5300702991841d0d5dd9fb3df2cac3450f2d91e6 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Wed, 13 May 2020 19:50:19 +0100 Subject: [PATCH 3/5] Get yappi working with Python 3 --- linkchecker | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/linkchecker b/linkchecker index 33ceaade..95a33513 100755 --- a/linkchecker +++ b/linkchecker @@ -578,13 +578,12 @@ else: if do_profile: if has_profile: if os.path.exists(_profile): - question = _("""Overwrite profiling file %(file)r? -Press Ctrl-C to cancel, RETURN to continue.""") % {"file": _profile} + print(_("""Overwrite profiling file %(file)r? +Press Ctrl-C to cancel, RETURN to continue.""") % {"file": _profile}) try: - raw_input(question.encode(i18n.default_encoding, 'replace')) + input() except KeyboardInterrupt: - print >> sys.stderr - print >> sys.stderr, _("Canceled.") + print("", _("Canceled."), file=sys.stderr, sep="\n") sys.exit(1) else: log.warn(LOG_CMDLINE, From c80002437e32e7b2d5d59895863aba293cc5f9b2 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Wed, 13 May 2020 19:50:19 +0100 Subject: [PATCH 4/5] Update run-time version check --- linkcheck/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/linkcheck/__init__.py b/linkcheck/__init__.py index 91cfbebd..f51c9d85 100644 --- a/linkcheck/__init__.py +++ b/linkcheck/__init__.py @@ -19,13 +19,9 @@ Main function module for link checking. # version checks import sys -# Needs Python >= 2.7 because we use dictionary based logging config -# Needs Python >= 2.7.2 which fixed http://bugs.python.org/issue11467 -if not (hasattr(sys, 'version_info') or - sys.version_info < (2, 7, 2, 'final', 0)): +if sys.version_info < (3, 5, 0, 'final', 0): import platform - version = platform.python_version() - raise SystemExit("This program requires Python 2.7.2 or later instead of %s." % version) + raise SystemExit("This program requires Python 3.5.0 or later instead of %s." % platform.python_version()) # require a reasonably recent requests module: 2.4.0 from 2014-08-29 import requests # PEP 396 has only version strings, bummer! PEP 386 is also not helpful. From 40f7c4470364c43e32ab13b92739d4c23d087caf Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Thu, 14 May 2020 19:39:45 +0100 Subject: [PATCH 5/5] Ensure the Python 3 interpreter is used --- linkchecker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linkchecker b/linkchecker index 95a33513..2efcaa09 100755 --- a/linkchecker +++ b/linkchecker @@ -1,4 +1,4 @@ -#!/usr/bin/python -u +#!/usr/bin/python3 -u # Copyright (C) 2000-2014 Bastian Kleineidam # # This program is free software; you can redistribute it and/or modify