From d55c6bdf05db224669874a9faf2bde837898db88 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 30 Oct 2013 19:47:25 -0700 Subject: [PATCH] swc-windows-installer.py: Restore nose entry point This restores the nose entry point which was removed in 94caead (swc-windows-installer.py: Remove IPython and nose entry points, 2013-10-21). On Tue, Oct 22, 2013 at 11:36:21AM -0700, Ethan White wrote: > IPython works fine for me on Windows 7 for both Anaconda and Canopy > with no added entry points needed. > > Nosetests does not appear to have an entry point on Anaconda and I > forgot to test it with Canopy. I used a slightly different bin path than we'd used previously, to respect 806fedf (swc-windows-installer.py: Rework install paths to use ~/.swc, 2013-10-21). --- swc-windows-installer.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/swc-windows-installer.py b/swc-windows-installer.py index 4016597..1ecd714 100755 --- a/swc-windows-installer.py +++ b/swc-windows-installer.py @@ -6,6 +6,7 @@ Helps mimic a *nix environment on Windows with as little work as possible. The script: * Installs nano and makes it accessible from msysgit +* Provides standard nosetests behavior for msysgit To use: @@ -44,6 +45,20 @@ def install_nano(install_directory): nano_zip.extract(file_name, install_directory) +def create_nosetests_entry_point(python_scripts_directory): + """Creates a terminal-based nosetests entry point for msysgit""" + contents = '\n'.join([ + '#!/usr/bin/env/ python', + 'import sys', + 'import nose', + "if __name__ == '__main__':", + ' sys.exit(nose.core.main())', + '', + ]) + with open(os.path.join(python_scripts_directory, 'nosetests'), 'w') as f: + f.write(contents) + + def update_bash_profile(extra_paths=()): """Create or append to a .bash_profile for Software Carpentry @@ -71,9 +86,11 @@ def make_posix_path(windows_path): def main(): swc_dir = os.path.join(os.path.expanduser('~'), '.swc') + bin_dir = os.path.join(swc_dir, 'bin') + create_nosetests_entry_point(python_scripts_directory=bin_dir) nano_dir = os.path.join(swc_dir, 'lib', 'nano') install_nano(installation_directory=nano_dir) - update_bash_profile(extra_paths=(nano_dir,)) + update_bash_profile(extra_paths=(nano_dir, bin_dir)) if __name__ == '__main__': -- 2.26.2