Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 300582 - python.eclass hard-codes '/usr/bin/python', isn't prefix-aware
Summary: python.eclass hard-codes '/usr/bin/python', isn't prefix-aware
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All IRIX
: High major (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-11 11:30 UTC by Stuart Shelton
Modified: 2014-07-07 20:32 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2010-01-11 11:30:33 UTC
portage-1.5.187's temp/environment file contains:

    if [[ "$#" -eq 0 ]]; then
        if [[ "${active}" == "1" ]]; then
            if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
                die "${FUNCNAME}(): '--active' option cannot be used in ebuilds of packages supporting installation for multiple versions of Python";
            fi;
            slot="$(/usr/bin/python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')";

... around about line 172.  When the package is emerged, the installation process ends with:

>>> Original instance of package unmerged safely.
/usr/opt/gentoo/var/tmp/portage/sys-apps/portage-2.2.00.15187/temp/environment: line 182: /usr/bin/python: No such file or directory
 * Compilation and optimization of Python modules for Python  ...
/usr/opt/gentoo/var/tmp/portage/sys-apps/portage-2.2.00.15187/temp/environment: line 182: /usr/bin/python: No such file or directory
/usr/opt/gentoo/var/tmp/portage/sys-apps/portage-2.2.00.15187/temp/environment: line 182: /usr/bin/python: No such file or directory
/opt/gentoo/usr/bin/python2.6: can't open file '/opt/gentoo/usr/lib32/python/compileall.py': [Errno 2] No such file or directory
/usr/opt/gentoo/var/tmp/portage/sys-apps/portage-2.2.00.15187/temp/environment: line 182: /usr/bin/python: No such file or directory
/usr/opt/gentoo/var/tmp/portage/sys-apps/portage-2.2.00.15187/temp/environment: line 182: /usr/bin/python: No such file or directory                    [ !! ]

... note that the "/opt/gentoo/usr/lib32/python/compileall.py" path above should be "/opt/gentoo/usr/lib32/python2.6/compileall.py".

This appears to be a recent problem, and appears to be due to a missing "${EPREFIX}" in python.eclass.  With it inserted, all of the above problems are solved.

(P.S. On the subject of non-prefix aware eclasses, cvs.eclass also hard-codes the path to python on line 384.)
Comment 1 Fabian Groffen gentoo-dev 2010-01-11 11:38:03 UTC
thanks, both fixed
Comment 2 Stuart Shelton 2010-01-11 12:25:08 UTC
Oh - one more:

The latest bash-completion also lacks an EPREFIX on line 35 of $EPREFIX/etc/profile.d/bash-completion.sh:

$loaded_pre && source /usr/share/bash-completion/.post

... needs a prefix so as not to complain on each login.
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-11 17:40:00 UTC
I predict this is why I was seeing "bad marshal data" when using binpkgs. So, thanks. I'll confirm tomorrow.

bash-completion is a seperate issue (not eclass), I fixed it.

Comment 4 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-12 18:13:21 UTC
(In reply to comment #3)
> I predict this is why I was seeing "bad marshal data" when using binpkgs. So,
> thanks. I'll confirm tomorrow.

No luck, too bad.

> 
> bash-completion is a seperate issue (not eclass), I fixed it.
> 

Comment 5 Daa Jaa 2014-06-13 13:04:27 UTC
Please reopen this bug for this additional patch, needed on PREFIX installations without /usr/bin/env (e.g., Android):

--- old_gentoo_armv6l/usr/portage/eclass/python.eclass  2014-06-13 14:56:48.119883970 +0200
+++ gentoo_armv6l/usr/portage/eclass/python.eclass      2014-06-13 14:57:32.607355352 +0200
@@ -1,6 +1,6 @@
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.169 2014/02/06 05:34:07 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.169 2014/02/06 05:34:07 vapier Exp bug300582 reloaded$
 
 # @ECLASS: python.eclass
 # @MAINTAINER:
@@ -1285,7 +1285,7 @@
                fi
 
                cat << EOF > "${file}"
-#!/usr/bin/env python
+#!${EPREFIX}/usr/bin/env python
 # Gentoo '${file##*/}' wrapper script generated by python_generate_wrapper_scripts()
 
 import os

(patch needed in gentooandroid.sourceforge.net to make $EPREFIX/usr/bin/xml2po work)
Comment 6 Fabian Groffen gentoo-dev 2014-06-13 18:22:53 UTC
ugh! without /usr/bin/env many other things aren't going to work, I guess...
Comment 7 Daa Jaa 2014-07-07 20:32:25 UTC
gentooandroid.sf.net distributes my stage3 with a working emerge installation, and it has no /usr/bin/env!

I submit this patch above so that to make a stage1 that would work. Please reconsider it.

Last month, my stage3 emerged 153 packages, including evince, firefox, gnucash. For that, I on
ly needed to edit five *.ebuild files:
- =app-text/recode-3.6_p17-r2 adding >  use uncooperative-root && sed -i -e 's:^ #! /bin/sh\>: #! '"$EPREFIX/bin/sh"':w /dev/stderr' "${WORKDIR
}"/${PN}_${MY_PV}-${DEB_PATCH}.diff
- =sys-devel/automake-1.12.4.tbz2 adding > EAPI=5 ; IF_TOUCHED_WILL_BREAK_DEPENDENCIES=${WORKDIR}/automake-1.13.4/t/testsuite-part.am
- three more ebuilds, just because gcc without -Wl,-dynamic-linker=$EPREFIX/lib/ld-linux-armhf.so.3 still links to /lib; heroxbd's Android's project's has fixed that so I will instead realy on that.