swc-workshop.git
11 years agoswc-windows-installer.py: Bring in Ethan's make_bash_profile and make_posix_path
Ethan White [Mon, 21 Oct 2013 05:01:59 +0000 (22:01 -0700)]
swc-windows-installer.py: Bring in Ethan's make_bash_profile and make_posix_path

This integerates some of Ethan's nano-installer changes.  In the pull
request, Ethan elaborates on the .bash_profile choice [1]:

  In response to comments on the Tutors list the installer now uses
  .bash_profile instead of .bashrc and appends the lines rather than
  overwriting the file. I have also added comments that indicate where
  the new lines in .bash_profile come from.

  Once the Python version is in I'll move on to getting this compiled
  into a .exe file, which should be more familiar to our students and
  won't run into issues with Canopy installs opening the file in
  Canopy rather than executing it.

The referenced tutors@ discussion is in the messages leading up to
[2], where Ethan top-quotes a discussion with R. David Murray about
the relative merits of .bash_profile and .bashrc.  The imporant point
David made was that .bash_profile is only executed once at login,
while .bashrc is executed for each new shell.  Putting PATH appends in
.bash_profile means that you don't end up adding duplicate entries to
the PATH as you spawn subshells.  For example:

  ${ORIGINAL_PATH}:${NANO_PATH}:${NANO_PATH}:...

[1]: https://github.com/swcarpentry/bc/pull/35
[2]: http://lists.software-carpentry.org/pipermail/tutors_lists.software-carpentry.org/2013-September/000969.html

11 years agoMerge branch 'nano-installer' into windows-installer
W. Trevor King [Mon, 21 Oct 2013 17:09:11 +0000 (10:09 -0700)]
Merge branch 'nano-installer' into windows-installer

* nano-installer:
  Remove testing line
  Append exports to end of .bash_profile instead of overwriting
  Switch from using .bashrc to .bash_profile nano path and editor export
  Add a Nano installer for Windows

11 years agoRemove testing line
Ethan White [Fri, 20 Sep 2013 00:35:07 +0000 (20:35 -0400)]
Remove testing line

11 years agoAppend exports to end of .bash_profile instead of overwriting
Ethan White [Fri, 20 Sep 2013 00:33:17 +0000 (20:33 -0400)]
Append exports to end of .bash_profile instead of overwriting

In the process at an explanation of where the lines came from
so that users know they can remove the lines if desired.

11 years agoSwitch from using .bashrc to .bash_profile nano path and editor export
Ethan White [Fri, 20 Sep 2013 00:24:21 +0000 (20:24 -0400)]
Switch from using .bashrc to .bash_profile nano path and editor export

11 years agoAdd a Nano installer for Windows
Ethan White [Wed, 18 Sep 2013 01:29:52 +0000 (21:29 -0400)]
Add a Nano installer for Windows

1. Downloads and installs Nano into the users home directory
2. Adds Nano to the path
3. Makes Nano the default editor

11 years agoswc-windows-installer.py: Use the stdlib's urlopen()
W. Trevor King [Wed, 20 Mar 2013 23:30:09 +0000 (19:30 -0400)]
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.

11 years agoswc-windows-installer.py: Use lists for file content
W. Trevor King [Wed, 20 Mar 2013 23:10:16 +0000 (19:10 -0400)]
swc-windows-installer.py: Use lists for file content

This allows us to keep the usual Python block indentation while still
producing the appropriate wrapper content.

11 years agoswc-windows-installer.py: Use `with` to write script wrappers
W. Trevor King [Wed, 20 Mar 2013 22:58:18 +0000 (18:58 -0400)]
swc-windows-installer.py: Use `with` to write script wrappers

From PEP 343.  This gives you automatic file descriptor (file handles
on Windows?) cleanup on errors.  Also use os.path.join() to build the
paths.

[1]: http://www.python.org/dev/peps/pep-0343/

11 years agoswc-windows-installer.py: Simplify `ipython` wrapper
W. Trevor King [Wed, 20 Mar 2013 22:42:49 +0000 (18:42 -0400)]
swc-windows-installer.py: Simplify `ipython` wrapper

This matches my system's `/usr/bin/ipython-2.7`, and is the hook
defined in IPython's setupbase.py:

  'ipython%s = IPython.frontend.terminal.ipapp:launch_new_instance'

This should handle the 'notebook' option internally.

11 years agoswc-windows-installer.py: Extract nano directly to the install directory
W. Trevor King [Wed, 20 Mar 2013 22:21:56 +0000 (18:21 -0400)]
swc-windows-installer.py: Extract nano directly to the install directory

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.

11 years agoswc-windows-installer.py: Avoid writing nano.zip to disk
W. Trevor King [Wed, 20 Mar 2013 22:18:05 +0000 (18:18 -0400)]
swc-windows-installer.py: Avoid writing nano.zip to disk

It's already in memory, and we're going to use it again immediately.
Avoiding the flush-to-disk is both more efficient, and easier to clean
up.

11 years agoswc-windows-installer.py: Separate requests import from stdlib imports
W. Trevor King [Wed, 20 Mar 2013 22:13:44 +0000 (18:13 -0400)]
swc-windows-installer.py: Separate requests import from stdlib imports

Python-requests [1] is not part of the stdlib.

[1]: http://docs.python-requests.org/en/latest/

11 years agoswc-windows-installer.py: Cleanup whitespace
W. Trevor King [Wed, 20 Mar 2013 22:13:05 +0000 (18:13 -0400)]
swc-windows-installer.py: Cleanup whitespace

11 years agoswc-windows-installer.py: Setup msysgit to act like *nix systems
Ethan White [Wed, 20 Mar 2013 22:08:08 +0000 (18:08 -0400)]
swc-windows-installer.py: Setup msysgit to act like *nix systems

* Install `nano` 2.2.6.
* Add `ipython` and `nosetests` command line entry points.