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

Plugin doesn't work with pyenv >= 2.3.10 #3

Open
AndreyBozhko opened this issue Jan 24, 2023 · 11 comments
Open

Plugin doesn't work with pyenv >= 2.3.10 #3

AndreyBozhko opened this issue Jan 24, 2023 · 11 comments

Comments

@AndreyBozhko
Copy link

When using pyenv 2.3.10 or later, specifying the VERSION_ALIAS seems to have no effect whatsoever.

I suspect that this change (pyenv/pyenv#2568) broke the version aliasing. I also verified that the plugin works correctly with pyenv 2.3.9.

@s1341
Copy link
Owner

s1341 commented Jan 24, 2023

Hi. I’m no longer using pyenv, so it’s unlikely I’ll get to fix this. I’d be happy to accept a pr though …

@AndreyBozhko
Copy link
Author

Thanks, that makes sense. Since my use case for pyenv is quite limited actually, I think I'll just work around it by pinning pyenv to an older version...

@AdrianDAlessandro
Copy link

I attempted to fix this, but not being much of a bash programmer I was unable to reproduce the previous behaviour. I have created an alternative that allows you to append a suffix to the version name: https://github.com/AdrianDAlessandro/pyenv-suffix

To quickly explain the bug, if it helps fix this plugin...

This plugin sets the VERSION_NAME variable, but this variable is defined in the code after the entry point for the install hook. There is another entry point that can be accessed by defining the before_install hook (which is what I've done here, but that is after VERSION_NAME has already been used to define the PREFIX (which includes all the path information).

Instead of working out how to pattern-match strings in bash to replace the whole version name at the tail of PREFIX, I just re-implemented this to add a suffix, which is good enough for my use case.

@IvanaGyro
Copy link

Another alternative is directly invoking python-build, which is the default plugin called by pyenv-install.

@igor-buzzoola
Copy link

For work pyenv-alias on pyenv 2.3.25 patch line 9 etc/pyenv.d/install/alias.bash:
old:
VERSION_NAME="${VERSION_ALIAS##*/}"
new:
before_install 'PREFIX="$(dirname ${PREFIX})/${VERSION_ALIAS}"; echo "Installing at ${PREFIX}"'

@s1341
Copy link
Owner

s1341 commented Aug 30, 2023

@igor-buzzoola any chance you can make a PR?

@s1341 s1341 closed this as completed Aug 30, 2023
@s1341 s1341 reopened this Aug 30, 2023
@tchayintr
Copy link

For work pyenv-alias on pyenv 2.3.25 patch line 9 etc/pyenv.d/install/alias.bash:
old:
VERSION_NAME="${VERSION_ALIAS##*/}"
new:
before_install 'PREFIX="$(dirname ${PREFIX})/${VERSION_ALIAS}"; echo "Installing at ${PREFIX}"'

It does work but will be the same as the forked one here:

https://github.com/AdrianDAlessandro/pyenv-suffix

@tchayintr
Copy link

I think we may can make it simpler to read and probably easier to add more functions later.

update_prefix_with_version_alias() {
  PREFIX="$(dirname ${PREFIX})/${VERSION_ALIAS}"
}

if [ -n "${VERSION_ALIAS}" ]; then
    before_install 'update_prefix_with_version_alias'
fi

@native-api
Copy link

Providing a suffix instead of a full name has been suggested in pyenv/pyenv#2810 and we're considering adding that into the base product due to apparent considerable demand for the alternate name feature.

Evereyone is welcome to provide feedback on that.

@pshriwise
Copy link

Hi! I'm curious as to the state of this. It looks like a reasonable fix is in @AdrianDAlessandro's fork. Does it simply need to be contributed here @s1341?

@pshriwise
Copy link

Or perhaps the recommendation is to switch to pyenv-suffix?

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

8 participants