summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
W. Trevor King [Wed, 12 Mar 2014 23:41:05 +0000 (16:41 -0700)]
swc-windows-installer.sh: Rename ~/.nanorc to ~/nano.rc
The nano FAQ hints that this is the prefered path on MS Windows [1],
and Ethan White confirmed it in testing [2].
[1]: http://www.nano-editor.org/dist/v2.2/faq.html#3.9.1
[2]: https://github.com/swcarpentry/bc/pull/357#issuecomment-
37482899
W. Trevor King [Tue, 4 Mar 2014 23:44:02 +0000 (15:44 -0800)]
swc-windows-installer.sh: Install nano source syntax highlighters
Make writing Python source code (and a number of other languages) a
bit more exciting for the eyes and easier on the brain by coloring
strings, comments, and such.
We need to install the source tarball because the compiled zip doesn't
include the syntax highlighting scripts. To make that easier, I've
extracted out the download / hash-check functionality into a new
download(), which I use in both the old zip_install() and the new
tar_install(). If the user doesn't have an existing ~/.nanorc, we
populate it by adding 'include' options for each of the syntax files
in the Nano tarball. If they do have an existing ~/.nanorc, I assume
they know what they're doing ;).
W. Trevor King [Mon, 13 Jan 2014 18:38:14 +0000 (10:38 -0800)]
swc-windows-installer.sh: Convert script from Python to POSIX shell
On Mon, Jan 13, 2014 at 05:49:51AM -0800, Aron Ahmadia wrote:
> We currently have an installer that handles the issue of installing
> `nano` into msysgit for use with Git: ...
>
> This currently doesn't help for bootcamps where Python is not
> installed, so it would be handy to have a version of this that
> doesn't rely on a Python install.
POSIX shell, because an interpreted language from 1977 [1] is more
widely supported than an interpreted language from 1991 [2]. It looks
like the default msysGit install sets up the right double-click magic
too:
On Mon, Jan 13, 2014 at 10:03:24AM -0800, Ethan White wrote:
> Will a POSIX version run by simply double clicking the file?
On Mon, Jan 13, 2014 at 10:25:33AM -0800, Ethan White wrote:
> Just checked this on my Windows machine and it actually seems to
> work automatically as long as GitBash is installed and the file has
> a .sh extension. So POSIX away.
[1]: http://en.wikipedia.org/wiki/Bourne_shell
[2]: http://en.wikipedia.org/wiki/Python_language
W. Trevor King [Wed, 13 Nov 2013 16:12:58 +0000 (08:12 -0800)]
swc-windows-installer.py: Use regular expressions to POSIX-ify paths
On a Windows 7 SP1 box with Python 2.7.3:
>>> import os.path
>>> os.path.expanduser('~')
'c:/Users/JohnDoe'
That wasn't matching the previous POSIX-ification patterns, which
assumed the drive prefix would be uppercase (C:). Now we use a
regular expression to match both cases.
W. Trevor King [Tue, 12 Nov 2013 18:05:08 +0000 (10:05 -0800)]
swc-windows-installer.py: Only create the python-scripts dir if it doesn't exist
os.makedirs, unlike 'mkdir -p', errors if the target directory already
exists [1,2].
[1]: http://docs.python.org/2/library/os.html#os.makedirs
"Raises an error exception if the leaf directory already exists
or cannot be created"
[2]: http://docs.python.org/3/library/os.html#os.makedirs
"If exist_ok is False (the default), an OSError is raised if the
target directory already exists."
W. Trevor King [Tue, 12 Nov 2013 18:02:23 +0000 (10:02 -0800)]
swc-windows-installer.py: Split out zip_install into its own function
This makes it easy to install other packages besides nano. I've also
added SHA1 checks to avoid installing packages that don't match the
expected hash. This lets us trust ZipFile.extractall instead of
extracting from a hard-coded list of approved files.
W. Trevor King [Thu, 31 Oct 2013 02:47:25 +0000 (19:47 -0700)]
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).
W. Trevor King [Wed, 23 Oct 2013 19:03:07 +0000 (12:03 -0700)]
swc-windows-installer.py: Remove nesting setup/
There's no need to hard-code target directories in this repository.
Anyone consuming this material can use submodules and pick their own
target directory.
W. Trevor King [Mon, 21 Oct 2013 05:37:48 +0000 (22:37 -0700)]
swc-nano-installer.py: Remove now that changes are in swc-windows-installer.py
W. Trevor King [Mon, 21 Oct 2013 16:41:49 +0000 (09:41 -0700)]
swc-windows-installer.py: Rework install paths to use ~/.swc
Instead of cluttering the user's home directory with multiple
SWC-installed directories, reduce clutter and improve namespacing by
dumping everything inside ~/.swc. Think of it as a SWC-specific
~/.local. We avoid actually using ~/.local because users might
already be using that for other purposes.
Use os.makedirs to create the nano install directory if it does not
already exist, because ZipFile.extract uses os.mkdir internally, and
mkdir will not recursively create directories.
W. Trevor King [Mon, 21 Oct 2013 16:36:38 +0000 (09:36 -0700)]
swc-windows-installer.py: Remove IPython and nose entry points
Ethan thought these had been fixed upstream, and Aron Ahmadia pointed
to the Anaconda v1.6.2 release notes [1]:
2013-07-09: 1.6.2: (Windows only)
Fixed path being incorrectly appended on Windows during install
That means we can drop our entry point scripts and fall back to just
installing Nano and setting up EDITOR.
[1]: http://docs.continuum.io/anaconda/changelog.html
W. Trevor King [Mon, 21 Oct 2013 05:35:00 +0000 (22:35 -0700)]
swc-windows-installer.py: De-emphasize Anaconda
Bridge the gap between the original Anaconda plug and Ethan's simpler
"Install Python" from
833d0ee (Add a Nano installer for Windows,
2013-09-17). As of Anaconda 1.7.0, IPython 1.0.0 and nose 1.3.0 are
included by default [1].
[1]: http://docs.continuum.io/anaconda/pkgs.html
W. Trevor King [Mon, 21 Oct 2013 05:31:24 +0000 (22:31 -0700)]
swc-windows-installer.py: Rework paths in main()
Based on Ethan's path handling in
833d0ee (Add a Nano installer for
Windows, 2013-09-17), while still retaining the entry-point creation
for IPython and nose.
W. Trevor King [Mon, 21 Oct 2013 05:27:23 +0000 (22:27 -0700)]
swc-windows-installer.py: Generalize update_bash_profile
And rename from make_bash_profile now that we're appending instead of
creating (since
c5d5414, Append exports to end of .bash_profile
instead of overwriting, 2013-09-19).
This more general form can be used to add even more paths, for example
our IPython and nosetest entry points.
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
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
Ethan White [Fri, 20 Sep 2013 00:35:07 +0000 (20:35 -0400)]
Remove testing line
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.
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
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
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.
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.
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/
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.
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.
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.
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/
W. Trevor King [Wed, 20 Mar 2013 22:13:05 +0000 (18:13 -0400)]
swc-windows-installer.py: Cleanup whitespace
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.