swc-windows-installer.py: Extract nano directly to the install directory
authorW. Trevor King <wking@tremily.us>
Wed, 20 Mar 2013 22:21:56 +0000 (18:21 -0400)
committerW. Trevor King <wking@tremily.us>
Mon, 21 Oct 2013 03:55:18 +0000 (20:55 -0700)
This is more efficient than "extract to . and then copy".  I also
renamed the install_nano() argument.  The function doesn't care that
we're currently passing the Python script directory; it will work
perfectly well with a different directory in the PATH.

setup/swc-windows-installer.py

index 74ee3214e14239fcee44ce5024c724a4daea779b..61d1f93713bfc5a680a1808c7f42be83621eed31 100755 (executable)
@@ -23,14 +23,13 @@ try:  # Python 3
     from io import BytesIO as _BytesIO
 except ImportError:  # Python 2
     from StringIO import StringIO as _BytesIO
-import shutil
 import os.path
 import zipfile
 
 import requests
 
 
-def install_nano(python_scripts_directory):
+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)
@@ -39,8 +38,7 @@ def install_nano(python_scripts_directory):
     nano_files = ['nano.exe', 'cygwin1.dll', 'cygintl-8.dll',
                   'cygiconv-2.dll', 'cyggcc_s-1.dll']
     for file_name in nano_files:
-        nano_zip.extract(file_name, '.')
-        shutil.move(file_name, python_scripts_directory)
+        nano_zip.extract(file_name, install_directory)
 
 def create_ipython_entry_point(python_scripts_directory):
     """Creates a terminal-based IPython entry point for msysgit"""