Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 217657 Details for
Bug 302525
python.eclass: Use prefix variables
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
prefix patch
python.eclass-prefix.patch (text/plain), 9.58 KB, created by
Fabian Groffen
on 2010-01-27 20:57:22 UTC
(
hide
)
Description:
prefix patch
Filename:
MIME Type:
Creator:
Fabian Groffen
Created:
2010-01-27 20:57:22 UTC
Size:
9.58 KB
patch
obsolete
>--- python.eclass >+++ python.eclass >@@ -9,6 +9,10 @@ > # @DESCRIPTION: > # Some useful functions for dealing with Python. > >+# Prefix note: >+# have python_get* return WITHOUT EPREFIX, since they should be relative to >+# EROOT, and sometimes are used with helpers >+ > inherit multilib > > if ! has "${EAPI:-0}" 0 1 2; then >@@ -145,15 +150,15 @@ > fi > > # Ensure that /usr/bin/python and /usr/bin/python-config are valid. >- if [[ "$(readlink /usr/bin/python)" != "python-wrapper" ]]; then >- eerror "'/usr/bin/python' is not valid symlink." >+ if [[ "$(readlink "${EPREFIX}"/usr/bin/python)" != "python-wrapper" ]]; then >+ eerror "'${EPREFIX}/usr/bin/python' is not valid symlink." > eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem." >- die "'/usr/bin/python' is not valid symlink" >+ die "'${EPREFIX}/usr/bin/python' is not valid symlink" > fi >- if [[ "$(</usr/bin/python-config)" != *"Gentoo python-config wrapper script"* ]]; then >- eerror "'/usr/bin/python-config' is not valid script" >+ if [[ "$(<"${EPREFIX}"/usr/bin/python-config)" != *"Gentoo python-config wrapper script"* ]]; then >+ eerror "'${EPREFIX}/usr/bin/python-config' is not valid script" > eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem." >- die "'/usr/bin/python-config' is not valid script" >+ die "'${EPREFIX}/usr/bin/python-config' is not valid script" > fi > > # USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 5. >@@ -205,14 +210,14 @@ > else > local python_version python2_version= python3_version= support_python_major_version > >- python_version="$(/usr/bin/python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" >+ python_version="$("${EPREFIX}"/usr/bin/python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" > > if has_version "=dev-lang/python-2*"; then >- if [[ "$(readlink /usr/bin/python2)" != "python2."* ]]; then >- die "'/usr/bin/python2' is not valid symlink" >+ if [[ "$(readlink "${EPREFIX}"/usr/bin/python2)" != "python2."* ]]; then >+ die "'${EPREFIX}/usr/bin/python2' is not valid symlink" > fi > >- python2_version="$(/usr/bin/python2 -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" >+ python2_version="$("${EPREFIX}"/usr/bin/python2 -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" > > for PYTHON_ABI in ${python2_supported_versions}; do > support_python_major_version="1" >@@ -235,11 +240,11 @@ > fi > > if has_version "=dev-lang/python-3*"; then >- if [[ "$(readlink /usr/bin/python3)" != "python3."* ]]; then >- die "'/usr/bin/python3' is not valid symlink" >+ if [[ "$(readlink "${EPREFIX}"/usr/bin/python3)" != "python3."* ]]; then >+ die "'${EPREFIX}/usr/bin/python3' is not valid symlink" > fi > >- python3_version="$(/usr/bin/python3 -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" >+ python3_version="$("${EPREFIX}"/usr/bin/python3 -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" > > for PYTHON_ABI in ${python3_supported_versions}; do > support_python_major_version="1" >@@ -262,12 +267,12 @@ > fi > > if [[ -n "${python2_version}" && "${python_version}" == "2."* && "${python_version}" != "${python2_version}" ]]; then >- eerror "Python wrapper is configured incorrectly or /usr/bin/python2 symlink" >+ eerror "Python wrapper is configured incorrectly or ${EPREFIX}/usr/bin/python2 symlink" > eerror "is set incorrectly. Use \`eselect python\` to fix configuration." > die "Incorrect configuration of Python" > fi > if [[ -n "${python3_version}" && "${python_version}" == "3."* && "${python_version}" != "${python3_version}" ]]; then >- eerror "Python wrapper is configured incorrectly or /usr/bin/python3 symlink" >+ eerror "Python wrapper is configured incorrectly or ${EPREFIX}/usr/bin/python3 symlink" > eerror "is set incorrectly. Use \`eselect python\` to fix configuration." > die "Incorrect configuration of Python" > fi >@@ -395,6 +400,13 @@ > elif [[ "${EBUILD_PHASE}" == "install" ]]; then > python_default_function() { > emake DESTDIR="${D}" install >+ # Remove .py[co] files from the installed image, >+ # python_mod_optimize will (re)generate them. Removing >+ # them here makes sure they don't end up in binpkgs, and >+ # fixes Bad Marshalling Data in Prefix when the offset >+ # was changed with a binpkg installation to match the >+ # target offset. We aim for consistency: bug #301915 >+ find "${D}" -name "*.py[co]" -delete > } > else > die "${FUNCNAME}(): '--default-function' option cannot be used in this ebuild phase" >@@ -681,7 +693,7 @@ > sys.exit(1) > else: > try: >- eselect_process = subprocess.Popen(["/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) >+ eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) > if eselect_process.wait() != 0: > raise ValueError > except (OSError, ValueError): >@@ -706,7 +718,7 @@ > else > cat << EOF >> "${file}" > try: >- eselect_process = subprocess.Popen(["/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) >+ eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) > if eselect_process.wait() != 0: > raise ValueError > except (OSError, ValueError): >@@ -742,7 +754,7 @@ > if [[ "$?" != "0" ]]; then > die "${FUNCNAME}(): Generation of '$1' failed" > fi >- fperms +x "${file#${D%/}}" || die "fperms '${file}' failed" >+ fperms +x "${file#${ED%/}}" || die "fperms '${file}' failed" > done > } > >@@ -860,7 +872,7 @@ > 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]]))')" >+ slot="$("${EPREFIX}"/usr/bin/python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" > elif [[ "${final_ABI}" == "1" ]]; then > if has "${EAPI:-0}" 0 1 2 3 4 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then > die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple versions of Python" >@@ -910,7 +922,7 @@ > echo -n "${slot}" > return > elif [[ "${absolute_path_output}" == "1" ]]; then >- echo -n "/usr/bin/python${slot}" >+ echo -n "${EPREFIX}/usr/bin/python${slot}" > else > echo -n "python${slot}" > fi >@@ -1123,7 +1135,7 @@ > if ! python -c "import Tkinter" >/dev/null 2>&1; then > eerror "You need to recompile python with Tkinter support." > eerror "Try adding: 'dev-lang/python tk'" >- eerror "in to /etc/portage/package.use" >+ eerror "in to ${EPREFIX}/etc/portage/package.use" > echo > die "missing tkinter support with installed python" > fi >@@ -1172,7 +1184,7 @@ > local dir file options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" PYTHON_ABI return_code root site_packages_absolute_dirs=() site_packages_dirs=() site_packages_absolute_files=() site_packages_files=() > > # Strip trailing slash from ROOT. >- root="${ROOT%/}" >+ root="${EROOT%/}" > > # Respect ROOT and options passed to compileall.py. > while (($#)); do >@@ -1188,7 +1200,7 @@ > ewarn "${FUNCNAME}: Ignoring option '$1'" > ;; > *) >- if ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then >+ if ! _python_implementation && [[ "$1" =~ ^"${EPREFIX}"/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then > die "${FUNCNAME} does not support absolute paths of directories/files in site-packages directories" > elif [[ "$1" =~ ^/ ]]; then > if [[ -d "${root}/$1" ]]; then >@@ -1270,7 +1282,7 @@ > local myroot mydirs=() myfiles=() myopts=() return_code="0" > > # strip trailing slash >- myroot="${ROOT%/}" >+ myroot="${EROOT%/}" > > # respect ROOT and options passed to compileall.py > while (($#)); do >@@ -1336,12 +1348,12 @@ > [[ ${EBUILD_PHASE} != "postrm" ]] && die "${FUNCNAME} should only be run in pkg_postrm()" > > # Strip trailing slash from ROOT. >- root="${ROOT%/}" >+ root="${EROOT%/}" > > if (($#)); then > if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then > while (($#)); do >- if ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then >+ if ! _python_implementation && [[ "$1" =~ ^"${EPREFIX}"/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then > die "${FUNCNAME} does not support absolute paths of directories/files in site-packages directories" > elif [[ "$1" =~ ^/ ]]; then > SEARCH_PATH+=("${root}/${1#/}") >@@ -1411,7 +1423,7 @@ > python_version() { > [[ -n "${PYVER}" ]] && return 0 > local tmpstr >- python="${python:-/usr/bin/python}" >+ python="${python:-${EPREFIX}/usr/bin/python}" > tmpstr="$(EPYTHON= ${python} -V 2>&1 )" > export PYVER_ALL="${tmpstr#Python }" > export PYVER_MAJOR="${PYVER_ALL:0:1}" >@@ -1443,7 +1455,7 @@ > die "${FUNCNAME} should only be run in pkg_postinst()" > > # strip trailing slash >- myroot="${ROOT%/}" >+ myroot="${EROOT%/}" > > # respect ROOT > for f in "$@"; do
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 302525
: 217657