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

Packaging issue with Python 3 on Fedora #102

Closed
bochecha opened this issue Mar 5, 2016 · 7 comments
Closed

Packaging issue with Python 3 on Fedora #102

bochecha opened this issue Mar 5, 2016 · 7 comments

Comments

@bochecha
Copy link
Collaborator

bochecha commented Mar 5, 2016

I'm trying to package Pew for Fedora.

I have a repository with work-in-progress packages, however one thing is problematic.

I've chosen to build Pew for Python 3, because at this point I'd rather not do anything related to Python 2 if I don't have to. 😉

So I built Pew and its dependencies as Python 3 modules, and overall everything is working fine... except one tiny little detail.

    try:
        check_call(["virtualenv", envname] + rest, cwd=str(workon_home))
    except (CalledProcessError, KeyboardInterrupt):
        ...

The /usr/bin/virtualenv command on Fedora is the Python 2 version. For Python 3, the command is /usr/bin/virtualenv-3.4.

As a result, even though I've built Pew for Python 3, I still need to add a dependency on the Python 2 version of virtualenv. 😞

This virtualenv/virtualenv-3.4 issue is Fedora-specific, as far as I know (Debian only ships /usr/bin/virtualenv for the Python 3 version it seems), so I'd understand if that's not something you want to work around upstream.

Possible solutions I can think of include:

  • If the virtualenv command doesn't exist, try virtualenv-3.4, or virtualenv-3.5, or... Which is clearly not very smart.
  • Stop subprocess-ing the command, and instead use a Python module (maybe venv for Python >= 3.3 ?)
  • A downstream, Fedora-only patch. (this would probably be the worst solution, but I figured I'd mention it... let's find something better)
  • Building Pew for Python 2 on Fedora

What do you think?

@berdario
Copy link
Collaborator

Hi, sorry for not replying earlier. I think there has also been a discussion via email, but I'd like to mention a couple of things here:

  • I think that the proper solution is to use Alternatives (see also an example of how this is used to select a java version). This way Pew would depend on a virtual-package/meta-package "virtualenv", and the python2-virtualenv, python3.4-virtualenv python3.5-virtualenv could all of them be providing it. /usr/bin/virtualenv would thus be a symlink to the preferred package installed by the user
  • I planned to use venv, but I think it might still be a bit premature. Stop subprocess-ing is also something that I considered doing, and back in February I hoped that virtualenv-rewrite would be the way forward (so I refrained from doing any change in that direction until the new virtualenv would've been ready, but I don't think that'll really materialize )

Btw, due to how distracted I've been, if you want I can give you commit access to fix some things (like, falling back on /usr/bin/virtualenv-3.4 or stop subprocess-ing) to help your packaging effort, without having me as a blocker, but I understand also if in the meanwhile you might've moved on and started some other effort.

@berdario
Copy link
Collaborator

berdario commented Aug 29, 2016

PS: I forgot to mention...

there's another reason why I haven't bothered with an alternative to subprocess-ing virtualenv

@bochecha
Copy link
Collaborator Author

bochecha commented Aug 29, 2016

I think that the proper solution is to use Alternatives (see also an example of how this is used to select a java version).

I know of the alternatives framework, we use it quite a bit in Fedora as well.

However, as it turns out that's not how /usr/bin/virtualenv is packaged in Fedora. Maybe it should be, though. (I'm generally not a big fan of how we've handled the Python3 versions of tools like pip, easy_install and virtualenv, which are suffixed with a 3...)

I'll try and ask if this can be improved on the Fedora side.

Btw, due to how distracted I've been, if you want I can give you commit access to fix some things (like, falling back on /usr/bin/virtualenv-3.4 or stop subprocess-ing) to help your packaging effort, without having me as a blocker, but I understand also if in the meanwhile you might've moved on and started some other effort.

I haven't, I'm still very happy using pew. 😄

@berdario
Copy link
Collaborator

Good :)

Let me know if you find a resolution.

Anyhow, it should also be possible to have a Python3-pew packaged in Fedora that depends on the Python2-virtualenv package, shouldn't it?

It's not pretty, but it should be a problem that it'll sort itself, as soon as Fedora drops Python2

@bochecha
Copy link
Collaborator Author

Anyhow, it should also be possible to have a Python3-pew packaged in Fedora that depends on the Python2-virtualenv package, shouldn't it?

That is in fact how I "solved" this problem a few weeks ago. 😉

@bochecha
Copy link
Collaborator Author

This was fixed by 999674c

Thanks @berdario !

@meshy
Copy link
Collaborator

meshy commented Mar 27, 2018

I think you're right, it looks as though that commit fixed this. I hope you don't mind if I close this issue as a result!

@meshy meshy closed this as completed Mar 27, 2018
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

3 participants