From 2fbd49dd0bc977e92d89042b34c36bbfbfb576b9 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Sat, 29 Aug 2020 16:57:57 +0100 Subject: [PATCH 1/3] Replace os.path.splitunc() with os.path.splitdrive() os.path.splitunc() removed in Python 3.7. https://docs.python.org/3/whatsnew/3.7.html#api-and-feature-removals --- linkcheck/checker/fileurl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linkcheck/checker/fileurl.py b/linkcheck/checker/fileurl.py index 8f0134e3..e0450f07 100644 --- a/linkcheck/checker/fileurl.py +++ b/linkcheck/checker/fileurl.py @@ -54,7 +54,7 @@ def prepare_urlpath_for_nt(path): def get_nt_filename(path): """Return case sensitive filename for NT path.""" - unc, rest = os.path.splitunc(path) + unc, rest = os.path.splitdrive(path) head, tail = os.path.split(rest) if not tail: return path From 89613d56f22d38255dcc03ac060885f4f8b673b2 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Sat, 29 Aug 2020 16:57:57 +0100 Subject: [PATCH 2/3] Replace the use of Python internal test.support Its use is discourged and it is not present in the MS Store version of Python. --- tests/checker/test_noproxy.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/checker/test_noproxy.py b/tests/checker/test_noproxy.py index 8edbb9bb..4b766339 100644 --- a/tests/checker/test_noproxy.py +++ b/tests/checker/test_noproxy.py @@ -16,7 +16,8 @@ """ Test proxy handling. """ -from test.support import EnvironmentVarGuard + +from unittest.mock import patch from . import httpserver @@ -25,10 +26,11 @@ class TestProxy(httpserver.HttpServerTest): """Test no_proxy env var handling.""" def test_noproxy(self): - # set env vars - with EnvironmentVarGuard() as env: - env.set("http_proxy", "http://example.org:8877") - env.set("no_proxy", "localhost:%d" % self.port) + with patch.dict("os.environ", + { + "http_proxy": "http://example.org:8877", + "no_proxy": "localhost:%d" % self.port, + }): self.noproxy_test() def noproxy_test(self): From bfb992fa2bd81d6c51262334e683330bb28b7fe3 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Sat, 29 Aug 2020 16:57:57 +0100 Subject: [PATCH 3/3] Update example MS Windows batch file Run LinkChecker after installing with pip on Python from the MS Store. --- doc/examples/windows.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/examples/windows.bat b/doc/examples/windows.bat index 19b497ab..e19daa83 100644 --- a/doc/examples/windows.bat +++ b/doc/examples/windows.bat @@ -1,4 +1,4 @@ @echo off -:: example using linkchecker on windows, logging to html -set PYDIR=c:\python26 -%PYDIR%\python.exe %PYDIR%\scripts\linkchecker -Fhtml http://www.example.com +:: Do replace the for loop with setting SCRIPTSDIR to the literal path +for /f "delims=" %%i in ('python -c "import site; print(site.getusersitepackages().replace('site-packages', 'Scripts'))"') do set SCRIPTSDIR=%%i +python %SCRIPTSDIR%\linkchecker %*