From 54f4b1aa6903a0962aa3d73605957d38a9df18d3 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 11 Sep 2020 16:06:18 +0800 Subject: [PATCH] path fixes for relpath, spaces and trailing slashes (#43) This is mostly a fix for windows to make sure path is resolved correctly Co-authored-by: Michael Sundvick --- .github/workflows/pythonapp.yml | 7 +++++++ jill/install.py | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index b61412a..7367745 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -135,6 +135,13 @@ jobs: & julia -e 'using InteractiveUtils; versioninfo()' & julia-1.0 -e 'using InteractiveUtils; versioninfo()' & julia-latest -e 'using InteractiveUtils; versioninfo()' + - name: test path with spaces and trailing slashes + run: | + mkdir "test temp" + & python -m jill install latest --confirm --upstream Official --install_dir "test temp" + & julia -e 'using InteractiveUtils; versioninfo()' + & julia-1.0 -e 'using InteractiveUtils; versioninfo()' + & julia-latest -e 'using InteractiveUtils; versioninfo()' arm_job: runs-on: ubuntu-18.04 diff --git a/jill/install.py b/jill/install.py index 7240019..89c6806 100644 --- a/jill/install.py +++ b/jill/install.py @@ -151,7 +151,7 @@ def make_symlinks(src_bin, symlink_dir, version): if current_system() == "windows": with open(linkpath, 'w') as f: # create a cmd file to mimic how we do symlinks in linux - f.writelines(["@echo off\n", f"{src_bin} %*"]) + f.writelines(['@echo off\n', f'"{src_bin}" %*']) else: os.symlink(src_bin, linkpath) @@ -322,7 +322,9 @@ def install_julia(version=None, *, where you want symlinks(e.g., `julia`, `julia-1`) placed. """ install_dir = install_dir if install_dir else default_install_dir() + install_dir = os.path.abspath(install_dir) symlink_dir = symlink_dir if symlink_dir else default_symlink_dir() + symlink_dir = os.path.abspath(symlink_dir) system, arch = current_system(), current_architecture() version = str(version) if (version or str(version) == "0") else '' version = "latest" if version == "nightly" else version @@ -335,7 +337,7 @@ def install_julia(version=None, *, hello_msg() if system == "windows": - install_dir = install_dir.replace("\\\\", "\\") + install_dir = install_dir.replace("\\\\", "\\").strip('\'"') if not confirm: version_str = version if version else "latest stable release" question = "jill will:\n"