Summary: | dev-python/setuptools writes to symlink targets when installing scripts (python-exec) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | David Xie <david.scriptfan> |
Component: | [OLD] Development | Assignee: | Python Gentoo Team <python> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | david.scriptfan, msummers57, nikoli, profunctor, tobbez |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
URL: | https://bitbucket.org/pypa/setuptools/pull-request/10/unlink-destination-file-before-writing/diff | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 479980 | ||
Bug Blocks: |
Description
David Xie
2013-05-03 09:26:40 UTC
Rebuild python-exec. You should know already you aren't supposed to let poor tools like 'pip' install stuff into /usr or it can do horribly things like replacing half of your system with junk. (In reply to comment #1) > Rebuild python-exec. You should know already you aren't supposed to let poor > tools like 'pip' install stuff into /usr or it can do horribly things like > replacing half of your system with junk. Doesn't pip/easy_install always install libs into /usr/lib/pythonX.Y/site-packages? (In reply to comment #2) > (In reply to comment #1) > > Rebuild python-exec. You should know already you aren't supposed to let poor > > tools like 'pip' install stuff into /usr or it can do horribly things like > > replacing half of your system with junk. > > Doesn't pip/easy_install always install libs into > /usr/lib/pythonX.Y/site-packages? and scripts into /usr/bin. Yet for some reason, it fails to replace symlinks properly and instead rewrites symlink target.. at least that's what I guess since I haven't tested it myself. Also, anything in /usr and not in /usr/local must not be ever touched by anything but portage. Otherwise, your system becomes inconsistent and something will start failing at some point. (In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > Rebuild python-exec. You should know already you aren't supposed to let poor > > > tools like 'pip' install stuff into /usr or it can do horribly things like > > > replacing half of your system with junk. > > > > Doesn't pip/easy_install always install libs into > > /usr/lib/pythonX.Y/site-packages? > > and scripts into /usr/bin. Yet for some reason, it fails to replace symlinks > properly and instead rewrites symlink target.. at least that's what I guess > since I haven't tested it myself. > > Also, anything in /usr and not in /usr/local must not be ever touched by > anything but portage. Otherwise, your system becomes inconsistent and > something will start failing at some point. Does it mean I have to install packages by using emerge not pip/easy_install? But what if I want to install some packages that not in portage? Install them to /usr/local/lib/python2.7/site-packages? (In reply to comment #4) > (In reply to comment #3) > > Also, anything in /usr and not in /usr/local must not be ever touched by > > anything but portage. Otherwise, your system becomes inconsistent and > > something will start failing at some point. > > Does it mean I have to install packages by using emerge not pip/easy_install? Yes. > But what if I want to install some packages that not in portage? Install > them to /usr/local/lib/python2.7/site-packages? Preferably, write an ebuild for it :). There is a dev-python/g-pypi which could help but I don't know if it still works. There's also a GSoC project this year which could improve automated ebuild generators. Alternatively, install to any local location. Either /usr/local or your homedir. (In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #3) > > > Also, anything in /usr and not in /usr/local must not be ever touched by > > > anything but portage. Otherwise, your system becomes inconsistent and > > > something will start failing at some point. > > > > Does it mean I have to install packages by using emerge not pip/easy_install? > > Yes. > > > But what if I want to install some packages that not in portage? Install > > them to /usr/local/lib/python2.7/site-packages? > > Preferably, write an ebuild for it :). There is a dev-python/g-pypi which > could help but I don't know if it still works. There's also a GSoC project > this year which could improve automated ebuild generators. > > Alternatively, install to any local location. Either /usr/local or your > homedir. If there are 10,000 python 3rd-party libraries, we will have 10,000 ebuilds for them. That's really a large number packages to maintain and a little duplicate work for pypi. So I think maybe we should set some default environment varialbes to make pip/easy_install install packages to /usr/local instead of /usr. What do you think? One more thing, can I become a packager of portage? (In reply to comment #6) > (In reply to comment #5) > > Preferably, write an ebuild for it :). There is a dev-python/g-pypi which > > could help but I don't know if it still works. There's also a GSoC project > > this year which could improve automated ebuild generators. > > > > Alternatively, install to any local location. Either /usr/local or your > > homedir. > If there are 10,000 python 3rd-party libraries, we will have 10,000 ebuilds > for them. That's really a large number packages to maintain and a little > duplicate work for pypi. I doubt there will be so many, but yes -- that is the plan. > So I think maybe we should set some default environment varialbes to make > pip/easy_install install packages to /usr/local instead of /usr. What do you > think? @python, what do you think? Anyway, I think the best thing you could do with custom packages is to use virtualenv. I think that's least likely to cause problems such as different versions of same package being installed via portage and externally. > One more thing, can I become a packager of portage? Do you mean an ebuild maintainer? Yes, there are a few ways of doing that. You can take a look at the Sunrise overlay [1] which -- though an overlay -- is a pretty official collection of community maintained packages. The goal is to help people polish and publish their ebuilds, and sometimes packages are collected by devs and moved to main repo. You can also become a proxy-maintainer [2]. In that case, your packages go straight to main repo but they go through a developer which commits them for you. And finally, you can become a developer :). [1]:http://www.gentoo.org/proj/en/sunrise/ [2]:http://www.gentoo.org/proj/en/qa/proxy-maintainers/ (In reply to comment #7) > (In reply to comment #6) > > (In reply to comment #5) > > > Preferably, write an ebuild for it :). There is a dev-python/g-pypi which > > > could help but I don't know if it still works. There's also a GSoC project > > > this year which could improve automated ebuild generators. > > > > > > Alternatively, install to any local location. Either /usr/local or your > > > homedir. > > If there are 10,000 python 3rd-party libraries, we will have 10,000 ebuilds > > for them. That's really a large number packages to maintain and a little > > duplicate work for pypi. > > I doubt there will be so many, but yes -- that is the plan. > > > So I think maybe we should set some default environment varialbes to make > > pip/easy_install install packages to /usr/local instead of /usr. What do you > > think? > > @python, what do you think? > > Anyway, I think the best thing you could do with custom packages is to use > virtualenv. I think that's least likely to cause problems such as different > versions of same package being installed via portage and externally. Maybe this is not the best way either. There's always a situation like this: I need a library A, but it's not in portage. Also I need it in many projects, so using virtualenv is not situable. What should I do then? Normally, I will use pip/easy_install to install it for all my projects, but we have python-exec, so I can't do that. At this time, installing it to /usr/local is helpful now. Am I right on this? Also, for pip, I checked this doc: http://www.pip-installer.org/en/latest/cookbook.html#user-installs So I guess, can we set an ENV variable in python-exec ebuild? So that anyone who install this package, all other packages installed by pip wil directly go to /usr/local. Does it make sense? > > > One more thing, can I become a packager of portage? > > Do you mean an ebuild maintainer? Yes, there are a few ways of doing that. > > You can take a look at the Sunrise overlay [1] which -- though an overlay -- > is a pretty official collection of community maintained packages. The goal > is to help people polish and publish their ebuilds, and sometimes packages > are collected by devs and moved to main repo. > > You can also become a proxy-maintainer [2]. In that case, your packages go > straight to main repo but they go through a developer which commits them for > you. > > And finally, you can become a developer :). > Thank you for your advice! I will try to look at sunrise first! > [1]:http://www.gentoo.org/proj/en/sunrise/ > [2]:http://www.gentoo.org/proj/en/qa/proxy-maintainers/ (In reply to comment #8) > (In reply to comment #7) > > @python, what do you think? > > > > Anyway, I think the best thing you could do with custom packages is to use > > virtualenv. I think that's least likely to cause problems such as different > > versions of same package being installed via portage and externally. > > Maybe this is not the best way either. There's always a situation like this: > I need a library A, but it's not in portage. Also I need it in many > projects, so using virtualenv is not situable. What should I do then? > Normally, I will use pip/easy_install to install it for all my projects, but > we have python-exec, so I can't do that. At this time, installing it to > /usr/local is helpful now. Am I right on this? I'm not sure but I think the default PYTHONPATH does not list /usr/local (which means you'd have to add it). > Also, for pip, I checked this doc: > http://www.pip-installer.org/en/latest/cookbook.html#user-installs > So I guess, can we set an ENV variable in python-exec ebuild? So that anyone > who install this package, all other packages installed by pip wil directly > go to /usr/local. Does it make sense? I'd rather not use environment variables here. We need to be, er, cautious here. We want to change the default but not enforce something over what the user wants (and set up already). In any case, I'll take a look at it soon. I just need to convert my system to btrfs, so I could snapshot it before attempting to break it :). (In reply to comment #9) > (In reply to comment #8) > > (In reply to comment #7) > > > @python, what do you think? > > > > > > Anyway, I think the best thing you could do with custom packages is to use > > > virtualenv. I think that's least likely to cause problems such as different > > > versions of same package being installed via portage and externally. > > > > Maybe this is not the best way either. There's always a situation like this: > > I need a library A, but it's not in portage. Also I need it in many > > projects, so using virtualenv is not situable. What should I do then? > > Normally, I will use pip/easy_install to install it for all my projects, but > > we have python-exec, so I can't do that. At this time, installing it to > > /usr/local is helpful now. Am I right on this? > > I'm not sure but I think the default PYTHONPATH does not list /usr/local > (which means you'd have to add it). > > > Also, for pip, I checked this doc: > > http://www.pip-installer.org/en/latest/cookbook.html#user-installs > > So I guess, can we set an ENV variable in python-exec ebuild? So that anyone > > who install this package, all other packages installed by pip wil directly > > go to /usr/local. Does it make sense? > > I'd rather not use environment variables here. We need to be, er, cautious > here. We want to change the default but not enforce something over what the > user wants (and set up already). > > In any case, I'll take a look at it soon. I just need to convert my system > to btrfs, so I could snapshot it before attempting to break it :). You are right. We should be more cautious here. But my point is, no matter which methond we choose, we have to let user can run pip/easy_install directly to install 3rd-party libraries. I think it make sense. *** Bug 475254 has been marked as a duplicate of this bug. *** Ai, I was wrong. distutils is fine, it's just setuptools screwed up. I've sent bug report to their mailing list, I'll add it here as soon as it shows up in archive. I'm a bit late to this party, however in retrospect something like virtualenv (http://guide.python-distribute.org/pip.html) would have been the right thing for me to do. For Python noobs like myself it would save a lot of trouble (and Bugzilla time) if someplace in the Gentoo Python docs there was a recommendation to setup a user local Pip repository. Gentoo depends heavily on Python and for the inexperienced it's easy to mess it up. I've just committed -0.9.8-r1 with a patch that supposedly fixes that. Could any of you, brave gentlemen, test it? Reporter timeout, assuming fixed :P. Yes, indeed. Thanks! |