mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 03:20:08 +01:00
Make pip usage in wxget optional
As the code states, using pip to download is abusing it, and it is just a fallback in case neither wget nor urllib works.
This commit is contained in:
@@ -33,7 +33,6 @@ import os
|
|||||||
import wx
|
import wx
|
||||||
import subprocess
|
import subprocess
|
||||||
import ssl
|
import ssl
|
||||||
import pip
|
|
||||||
|
|
||||||
if sys.version_info >= (3,):
|
if sys.version_info >= (3,):
|
||||||
from urllib.error import (HTTPError, URLError)
|
from urllib.error import (HTTPError, URLError)
|
||||||
@@ -44,6 +43,11 @@ else:
|
|||||||
from urllib2 import (HTTPError, URLError)
|
from urllib2 import (HTTPError, URLError)
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pip
|
||||||
|
except ImportError as e:
|
||||||
|
pip = None
|
||||||
|
|
||||||
def get_docs_demo_url(demo=False):
|
def get_docs_demo_url(demo=False):
|
||||||
""" Get the URL for the docs or demo."""
|
""" Get the URL for the docs or demo."""
|
||||||
if 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
|
success = download_wget(url, filename, trusted) # Try wget
|
||||||
if not success:
|
if not success:
|
||||||
success = download_urllib(url, filename) # Try urllib
|
success = download_urllib(url, filename) # Try urllib
|
||||||
if not success:
|
if not success and pip is not None:
|
||||||
success = download_pip(url, filename, force, trusted) # Try urllib
|
success = download_pip(url, filename, force, trusted) # Try pip
|
||||||
if not success:
|
if not success:
|
||||||
split_url = url.split('/')
|
split_url = url.split('/')
|
||||||
msg = '\n'.join([
|
msg = '\n'.join([
|
||||||
|
|||||||
Reference in New Issue
Block a user