Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
Merge branch 'python'
Browse files Browse the repository at this point in the history
Significant changes:
* Bump version to 0.2
* Install GNU Make (cherry-picked from the msysGit repository)
* Mention that R should be installed before running our installer

* python:
  swc-windows-installer.py: Bump version to 0.2
  swc-windows-installer.py: Fix "it's hash" -> "its hash" typo
  swc-windows-installer.py: Add install_msysgit_binary and install Make
  swc-windows-installer.py: Add a trailing paren to get_r_bin_directory.__doc__
  Replace 'Anaconda CE' -> 'Anaconda'
  Mention that R should be installed before running our installer

Conflicts:
	README.md (due to different usage instructions between the Python
	  branch and the Inno branch).
  • Loading branch information
wking committed Oct 18, 2014
2 parents 479b79b + ec469fa commit 1ba2d19
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ Using
=====

Just have your students download and double-click the compiled
installer. If you're using [R][], you'll have to install R before
running this installer (because this installer searches likely paths
to find R's `bin` directory). Otherwise, you can run it whenever you
like (e.g. either before or after installing [Python][]).
installer. If you're using [R][], you'll have to [install
R][R-install] before running this installer (because this installer
searches likely paths to find R's `bin` directory). Otherwise, you
can run it whenever you like (e.g. either before or after installing
[Python][]).

[msysGit]: http://msysgit.github.io/
[nano]: http://www.nano-editor.org/
[SQLite]: http://www.sqlite.org/
[nosetests]: https://nose.readthedocs.org/en/latest/usage.html
[R]: http://www.r-project.org/
[R-install]: http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Installation-and-Usage
[Python]: https://www.python.org/
[py2exe]: http://py2exe.org/
[inno]: http://www.jrsoftware.org/isinfo.php
Expand Down
30 changes: 24 additions & 6 deletions swc-windows-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Helps mimic a *nix environment on Windows with as little work as possible.
The script:
* Installs GNU Make and makes it accessible from msysGit
* Installs nano and makes it accessible from msysGit
* Installs SQLite and makes it accessible from msysGit
* Creates a ~/nano.rc with links to syntax highlighting configs
Expand All @@ -14,11 +15,13 @@
To use:
1. Install Python, IPython, and Nose. An easy way to do this is with
the Anaconda CE Python distribution
http://continuum.io/anacondace.html
the Anaconda Python distribution
http://continuum.io/downloads
2. Install msysGit
https://github.com/msysgit/msysgit/releases
3. Run swc-windows-installer.py.
3. Install R (if your workshop uses R)
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Installation-and-Usage
4. Run swc-windows-installer.py.
You should be able to simply double click the file in Windows
"""
Expand All @@ -41,7 +44,7 @@
import zipfile


__version__ = '0.1'
__version__ = '0.2'

LOG = logging.getLogger('swc-windows-installer')
LOG.addHandler(logging.StreamHandler())
Expand All @@ -62,7 +65,7 @@ def open3(file, mode='r', newline=None):


def download(url, sha1):
"""Download a file and verify it's hash"""
"""Download a file and verify its hash"""
LOG.debug('download {}'.format(url))
r = _urlopen(url)
byte_content = r.read()
Expand Down Expand Up @@ -141,6 +144,18 @@ def zip_install(url, sha1, install_directory):
LOG.info('existing installation at {}'.format(install_directory))


def install_msysgit_binary(name, sha1, install_directory,
tag='Git-1.9.4-preview20140815'):
"""Download and install a binary from msysGit's bin directory"""
bytes = download(
url='https://github.com/msysgit/msysgit/raw/{}/bin/{}'.format(
tag, name),
sha1=sha1)
LOG.info('installing {} into {}'.format(name, install_directory))
with open(os.path.join(install_directory, name), 'wb') as f:
f.write(bytes)


def install_nano(install_directory):
"""Download and install the nano text editor"""
zip_install(
Expand Down Expand Up @@ -197,7 +212,7 @@ def create_nosetests_entry_point(python_scripts_directory):


def get_r_bin_directory():
"""Locate the R bin directory (if R is installed
"""Locate the R bin directory (if R is installed)
"""
version_re = re.compile('^R-(\d+)[.](\d+)[.](\d+)$')
paths = {}
Expand Down Expand Up @@ -263,6 +278,9 @@ def main():
nanorc_dir = os.path.join(swc_dir, 'share', 'nanorc')
sqlite_dir = os.path.join(swc_dir, 'lib', 'sqlite')
create_nosetests_entry_point(python_scripts_directory=bin_dir)
install_msysgit_binary(
name='make.exe', sha1='ad11047985c33ff57074f8e09d347fe122e047a4',
install_directory=bin_dir)
install_nano(install_directory=nano_dir)
install_nanorc(install_directory=nanorc_dir)
install_sqlite(install_directory=sqlite_dir)
Expand Down

0 comments on commit 1ba2d19

Please sign in to comment.