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

coursier: Add support for both cs and coursier executable names #2293

Merged
merged 1 commit into from Mar 17, 2022

Conversation

Holzhaus
Copy link
Contributor

On some systems, the executable might be named coursier instead of
cs. For example, this is the case on Arch Linux when using the AUR
package, or when following the official instructions when installing the
JAR-based launcher:

https://get-coursier.io/docs/cli-installation#jar-based-launcher

@@ -27,6 +27,14 @@ def install_environment(
helpers.assert_version_default('coursier', version)
helpers.assert_no_additional_deps('coursier', additional_dependencies)

# Support both possible executable names (either "cs" or "coursier")
executable = next(filter(helpers.exe_exists, ('cs', 'coursier')), None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary FP -- we avoid map / filter / reduce

this should be exe('cs') or exe('coursier') once you find the right function (helpers.exe_exists isn't it -- that returns a bool)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be exe('cs') or exe('coursier') once you find the right function (helpers.exe_exists isn't it -- that returns a bool)

Do you want me to write a new one or is there something that I can use? shutil.which would be a candiate, or maybe pre_commit.parse_shebang.find_executable which kind of duplicates that functionality.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_executable is the right one probably yes

On some systems, the executable might be named `coursier` instead of
`cs`. For example, this is the case on Arch Linux when using the AUR
package, or when following the official instructions when installing the
JAR-based launcher:

  https://get-coursier.io/docs/cli-installation#jar-based-launcher
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@asottile asottile merged commit 4421cb9 into pre-commit:master Mar 17, 2022
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants