From a4536c403a862256a3026e17413b6f67c618ae1e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 12 Mar 2014 17:07:39 -0700 Subject: [PATCH] swc-windows-installer.py: Use '~' in ~/nano.rc includes On Wed, Mar 12, 2014 at 04:44:31PM -0700, Ethan White wrote [1]: > Got it. We just need to change the `/c/Users/River/` in the include > statements to `~/` and everything works great! [1]: https://github.com/swcarpentry/bc/pull/357#issuecomment-37483149 --- swc-windows-installer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/swc-windows-installer.py b/swc-windows-installer.py index 440a9ab..fe7af74 100755 --- a/swc-windows-installer.py +++ b/swc-windows-installer.py @@ -123,14 +123,17 @@ def install_nanorc(install_directory): sha1='f2a628394f8dda1b9f28c7e7b89ccb9a6dbd302a', install_directory=install_directory, strip_components=1) - nanorc = os.path.join(os.path.expanduser('~'), 'nano.rc') + home = os.path.expanduser('~') + nanorc = os.path.join(home, 'nano.rc') if not os.path.isfile(nanorc): syntax_dir = os.path.join(install_directory, 'doc', 'syntax') with open(nanorc, 'w') as f: for filename in os.listdir(syntax_dir): if filename.endswith('.nanorc'): path = os.path.join(syntax_dir, filename) - f.write('include {}\n'.format(path)) + rel_path = os.path.relpath(path, home) + include_path = os.path.join('~', rel_path) + f.write('include {}\n'.format(include_path)) def create_nosetests_entry_point(python_scripts_directory): -- 2.26.2