1
0
python-wxPython/0003-Make-pip-usage-in-wxget-optional.patch

50 lines
1.5 KiB
Diff

From 00ba66a86f65abb24402427d66bf50e8da477321 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 28 Jun 2022 18:16:34 +0200
Subject: [PATCH 3/4] Make pip usage in wxget optional
As the code states, using pip to download is abusing it, and as it is
just a fallback in case neither wget nor urllib works.
---
wx/tools/wxget.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/wx/tools/wxget.py b/wx/tools/wxget.py
index c83ced7a..75eb0f47 100644
--- a/wx/tools/wxget.py
+++ b/wx/tools/wxget.py
@@ -33,7 +33,6 @@ import os
import wx
import subprocess
import ssl
-import pip
if sys.version_info >= (3,):
from urllib.error import (HTTPError, URLError)
@@ -44,6 +43,11 @@ else:
from urllib2 import (HTTPError, URLError)
import urlparse
+try:
+ import pip
+except ImportError as e:
+ pip = None
+
def get_docs_demo_url(demo=False):
""" Get the URL for the docs or demo."""
if demo:
@@ -196,8 +200,8 @@ def download_file(url, dest=None, force=False, trusted=False):
success = download_wget(url, filename, trusted) # Try wget
if not success:
success = download_urllib(url, filename) # Try urllib
- if not success:
- success = download_pip(url, filename, force, trusted) # Try urllib
+ if not success and pip not None:
+ success = download_pip(url, filename, force, trusted) # Try pip
if not success:
split_url = url.split('/')
msg = '\n'.join([
--
2.36.1