From: W. Trevor King Date: Fri, 4 Apr 2014 15:51:29 +0000 (-0700) Subject: swc-windows-installer.py: Install the sqlite3 shell X-Git-Tag: v0.1~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=79b3dae753017a518ccda794ed6cdf87d3174b81;p=swc-setup-windows-installer.git swc-windows-installer.py: Install the sqlite3 shell On Thu, Apr 03, 2014 at 09:38:38AM -0700, Ethan White wrote: > Some instructors like to teach `sqlite` from the command > line. Therefore we should have the Windows installer handle > downloading, installing and adding sqlite3 to the path. The novice/sql lessons currently revolve around some IPython magic, but even they use the SQLite shell to do the initial database setup [1]. The SQLite shell has also seen a bit more developer time than our one-off magic [2], so it's probably more robust ;). I've installed this in it's own directory (rather than just dumping it into ~/.swc/bin), because zip_install uses the existence of ${INSTALL_DIRECTORY} to decide whether or not the installation has already happened. create_nosetests_entry_point will have already created ${BIN_DIR}, so we need to use a different target directory for SQLite. We could also flip the order and run install_sqlite first, but that doesn't scale well if we install more packages in the future, and it's easier to keep the installs separate and keep adding to the path. [1]: https://github.com/swcarpentry/bc/blob/1aa0799ac6a48e9815d50bf2f49171b9eb5bf6d4/novice/sql/README.txt#L8 [2]: https://github.com/swcarpentry/bc/blob/1aa0799ac6a48e9815d50bf2f49171b9eb5bf6d4/novice/sql/sqlitemagic.py --- diff --git a/swc-windows-installer.py b/swc-windows-installer.py index e76f54d..5cf132d 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 +* Installs sqlite3 and makes it accessible from msysGit * Creates ~/nano.rc with links to syntax highlighting configs * Provides standard nosetests behavior for msysgit @@ -150,6 +151,14 @@ def install_nanorc(install_directory): f.write('include {}\n'.format(include_path)) +def install_sqlite(install_directory): + """Download and install the sqlite3 shell""" + zip_install( + url='https://sqlite.org/2014/sqlite-shell-win32-x86-3080403.zip', + sha1='1a8ab0ca9f4c51afeffeb49bd301e1d7f64741bb', + install_directory=install_directory) + + def create_nosetests_entry_point(python_scripts_directory): """Creates a terminal-based nosetests entry point for msysgit""" contents = '\n'.join([ @@ -202,10 +211,12 @@ def main(): bin_dir = os.path.join(swc_dir, 'bin') nano_dir = os.path.join(swc_dir, 'lib', 'nano') 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_nano(install_directory=nano_dir) install_nanorc(install_directory=nanorc_dir) - update_bash_profile(extra_paths=(nano_dir, bin_dir)) + install_sqlite(install_directory=sqlite_dir) + update_bash_profile(extra_paths=(nano_dir, sqlite_dir, bin_dir)) if __name__ == '__main__':