From 52a6f2a20f7b63119946f60e2fe9ca0518a7b587 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 20 Mar 2013 19:30:09 -0400 Subject: [PATCH] swc-windows-installer.py: Use the stdlib's urlopen() This way I can test the script (on Linux, but whatever) without having to install an additional package. --- setup/swc-windows-installer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/setup/swc-windows-installer.py b/setup/swc-windows-installer.py index 58c1b29..c0bde19 100755 --- a/setup/swc-windows-installer.py +++ b/setup/swc-windows-installer.py @@ -24,16 +24,18 @@ try: # Python 3 except ImportError: # Python 2 from StringIO import StringIO as _BytesIO import os.path +try: # Python 3 + from urllib.request import urlopen as _urlopen +except ImportError: # Python 2 + from urllib2 import urlopen as _urlopen import zipfile -import requests - def install_nano(install_directory): """Download and install the nano text editor""" url = "http://www.nano-editor.org/dist/v2.2/NT/nano-2.2.6.zip" - r = requests.get(url) - nano_zip_content = _BytesIO(r.content) + r = _urlopen(url) + nano_zip_content = _BytesIO(r.read()) nano_zip = zipfile.ZipFile(nano_zip_content) nano_files = ['nano.exe', 'cygwin1.dll', 'cygintl-8.dll', 'cygiconv-2.dll', 'cyggcc_s-1.dll'] -- 2.26.2