Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epm module does not work in Windows #1661

Open
iandol opened this issue Feb 23, 2023 · 8 comments
Open

epm module does not work in Windows #1661

iandol opened this issue Feb 23, 2023 · 8 comments

Comments

@iandol
Copy link
Contributor

iandol commented Feb 23, 2023

I needed to use a Windows 11 machine, and tried to get elvish to use my rc.elv. I find that with standard commands to conditionally install:

epm:install &silent-if-installed ^
	github.com/iwoloschin/elvish-packages ^
	github.com/zzamboni/elvish-modules ^
	github.com/muesli/elvish-libs ^
	github.com/xiaq/edit.elv

I get an error:

=> Installing github.com/iwoloschin/elvish-packages
fatal: destination path 'C:\Users\iando\AppData\Local/elvish/lib/github.com/iwoloschin/elvish-packages' already exists and is not an empty directory.

On inspection by @krader1961, it appears there are several places where the epm module uses *nix commands like test, e.g.

# Returns a boolean value indicating whether the given package is installed.
fn is-installed {|pkg|
  bool ?(test -e (dest $pkg))
}

It would be great if epm could be updated to try to remove some of these *nix-only dependencies if possible...

@iandol iandol changed the title epm module does not work in Windows epm module does not work in Windows Feb 23, 2023
@iandol
Copy link
Contributor Author

iandol commented Feb 23, 2023

On line 29 of epm.elv %appdata% is hard-coded for Windows, it would be nice if we could check for XDG_ env variables first...

@krader1961
Copy link
Contributor

krader1961 commented Feb 24, 2023

Note that resolving issue #1659 would make it possible for the epm module to only rely on commands (like rsync and git) that will never be be integrated as an Elvish builtin. Thus making it simpler to document the explicit external commands the epm module depends on.

The hardcoded %appdata% value could be replaced with a dynamic value if issue #1600 is resolved.

@krader1961
Copy link
Contributor

As things stand today, a user needs to install the MSYS2 package to be able to use the epm module on Windows. While installing MSYS2 is a good idea for anyone expecting a CLI experience on Windows comparable to a UNIX system it shouldn't be mandatory for using the epm module. It should be sufficient for the user to have installed the handful of commands (e.g., curl) that cannot be reasonably expected to be Elvish builtins.

@iandol
Copy link
Contributor Author

iandol commented Feb 28, 2023

The hardcoded %appdata% value could be replaced with a dynamic value if issue #1600 is resolved.

It seems that just got fixed, so one step closer...

@krader1961
Copy link
Contributor

@iandol, I don't see any commits that resolve issue #1600 and that issue is still open. Can you provide a Git commit ID? I'm guessing you misunderstood the point of an unrelated change but I would be thrilled to learn I am wrong.

@iandol
Copy link
Contributor Author

iandol commented Mar 2, 2023

@krader1961 -- indeed my mistake, I read #1660 and missed the second 6 — sorry for the false hope!!!

@krader1961
Copy link
Contributor

FWIW, with the changes I have queued the epm module will only depend on the rsync and git external commands. That is still a bit of a challenge for its use by Elvish users on Windows but it is at least easier, in theory, to document how to satisfy the requirement for those two commands without requiring the user to install Msys2 or something similar. It is not obvious how to eliminate the requirement to have the rsync and git external commands available on Windows but at least the changes I have queued limit the external command dependencies to those two commands.

@iandol
Copy link
Contributor Author

iandol commented Mar 29, 2023

Dear Kurtis, thank you for you work on this. AFAIK there are native versions of both rsync and git (at least available via scoop), so this should be better than the full msys2 requirement.

krader1961 added a commit to krader1961/elvish that referenced this issue Jan 15, 2024
Remove the `epm` dependency on `rm` with `os:remove-all` so it is slightly
easier to use the `epm` command on Windows.

There aren't any unit tests for this but I verified it worked by running
the following statements on my macOS and Windows systems:

    epm:install github.com/doubleagent/rivendell
    epm:uninstall github.com/doubleagent/rivendell

Related elves#1661
xiaq pushed a commit that referenced this issue Jan 22, 2024
Remove the `epm` dependency on `rm` with `os:remove-all` so it is slightly
easier to use the `epm` command on Windows.

There aren't any unit tests for this but I verified it worked by running
the following statements on my macOS and Windows systems:

    epm:install github.com/doubleagent/rivendell
    epm:uninstall github.com/doubleagent/rivendell

Related #1661
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants