mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-30 18:12:08 +02:00
bump(sys-apps/portage): bump to a version on the mirrors
This commit is contained in:
parent
7bd6a483ad
commit
61ea6f3969
@ -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/sys-apps/portage/portage-2.1.11.58.ebuild,v 1.1 2013/03/22 02:41:18 zmedico Exp $
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.63.ebuild,v 1.1 2013/05/03 21:08:22 zmedico Exp $
|
||||
|
||||
# Require EAPI 2 since we now require at least python-2.6 (for python 3
|
||||
# syntax support) which also requires EAPI 2.
|
||||
@ -10,7 +10,7 @@ PYTHON_COMPAT=(
|
||||
python3_1 python3_2 python3_3 python3_4
|
||||
python2_6 python2_7
|
||||
)
|
||||
inherit eutils python
|
||||
inherit eutils multilib
|
||||
|
||||
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
|
||||
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
|
||||
@ -117,8 +117,61 @@ compatible_python_is_selected() {
|
||||
}
|
||||
|
||||
current_python_has_xattr() {
|
||||
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
|
||||
/usr/bin/python -c 'import xattr' 2>/dev/null
|
||||
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
|
||||
local PYTHON=/usr/bin/${EPYTHON}
|
||||
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
|
||||
"${PYTHON}" -c 'import xattr' 2>/dev/null
|
||||
}
|
||||
|
||||
call_with_python_impl() {
|
||||
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
|
||||
env EPYTHON=${EPYTHON} "$@"
|
||||
}
|
||||
|
||||
get_python_interpreter() {
|
||||
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
|
||||
local impl=$1 python
|
||||
case "${impl}" in
|
||||
python*)
|
||||
python=${impl/_/.}
|
||||
;;
|
||||
pypy*)
|
||||
python=${impl/_/.}
|
||||
python=${python/pypy/pypy-c}
|
||||
;;
|
||||
*)
|
||||
die "Unrecognized python target: ${impl}"
|
||||
esac
|
||||
echo ${python}
|
||||
}
|
||||
|
||||
get_python_sitedir() {
|
||||
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
|
||||
local impl=$1
|
||||
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
|
||||
[[ -d ${ROOT}${site_dir} ]] || \
|
||||
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
|
||||
echo "${site_dir}"
|
||||
}
|
||||
|
||||
python_compileall() {
|
||||
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
|
||||
local d=$1 PYTHON=/usr/bin/${EPYTHON}
|
||||
local d_image=${D}${d#/}
|
||||
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
|
||||
case "${EPYTHON}" in
|
||||
python*)
|
||||
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
|
||||
# Note: Using -OO breaks emaint, since it requires __doc__,
|
||||
# and __doc__ is None when -OO is used.
|
||||
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
|
||||
;;
|
||||
pypy*)
|
||||
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
|
||||
;;
|
||||
*)
|
||||
die "Unrecognized EPYTHON value: ${EPYTHON}"
|
||||
esac
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
@ -155,12 +208,16 @@ pkg_setup() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# We use EPYTHON to designate the active python interpreter,
|
||||
# but we only export when needed, via call_with_python_impl.
|
||||
EPYTHON=python
|
||||
export -n EPYTHON
|
||||
if use python3; then
|
||||
python_set_active_version 3
|
||||
EPYTHON=python3
|
||||
elif use python2; then
|
||||
python_set_active_version 2
|
||||
EPYTHON=python2
|
||||
elif use pypy2_0; then
|
||||
python_set_active_version 2.7-pypy-2.0
|
||||
EPYTHON=pypy-c2.0
|
||||
fi
|
||||
}
|
||||
|
||||
@ -193,15 +250,23 @@ src_prepare() {
|
||||
|| die "failed to append to make.globals"
|
||||
fi
|
||||
|
||||
local set_shebang=
|
||||
if use python3; then
|
||||
einfo "Converting shebangs for python3..."
|
||||
python_convert_shebangs -r 3 .
|
||||
set_shebang=python3
|
||||
elif use python2; then
|
||||
einfo "Converting shebangs for python2..."
|
||||
python_convert_shebangs -r 2 .
|
||||
set_shebang=python2
|
||||
elif use pypy2_0; then
|
||||
einfo "Converting shebangs for pypy-c2.0..."
|
||||
python_convert_shebangs -r 2.7-pypy-2.0 .
|
||||
set_shebang=pypy-c2.0
|
||||
fi
|
||||
if [[ -n ${set_shebang} ]] ; then
|
||||
einfo "Converting shebangs for ${set_shebang}..."
|
||||
while read -r -d $'\0' ; do
|
||||
local shebang=$(head -n1 "$REPLY")
|
||||
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
|
||||
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
|
||||
die "sed failed"
|
||||
fi
|
||||
done < <(find . -type f -print0)
|
||||
fi
|
||||
|
||||
cd "${S}/cnf" || die
|
||||
@ -218,20 +283,24 @@ src_prepare() {
|
||||
|
||||
src_compile() {
|
||||
if use doc; then
|
||||
call_with_python_impl \
|
||||
emake docbook || die
|
||||
fi
|
||||
|
||||
if use epydoc; then
|
||||
einfo "Generating api docs"
|
||||
call_with_python_impl \
|
||||
emake epydoc || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_test() {
|
||||
call_with_python_impl \
|
||||
emake test || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
call_with_python_impl \
|
||||
emake DESTDIR="${D}" \
|
||||
sysconfdir="/etc" \
|
||||
prefix="/usr" \
|
||||
@ -252,17 +321,23 @@ src_install() {
|
||||
# (this used to be done with PYTHONPATH setting in /etc/env.d).
|
||||
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
|
||||
# site-packages, and compile with the corresponding interpreter.
|
||||
local impl files mod_dir dest_mod_dir python relative_path files x
|
||||
local impl files mod_dir dest_mod_dir python relative_path x
|
||||
for impl in "${PYTHON_COMPAT[@]}" ; do
|
||||
use "python_targets_${impl}" || continue
|
||||
if use build && [[ ${ROOT} == / &&
|
||||
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then
|
||||
# Tolerate --nodeps at beginning of stage1 for catalyst
|
||||
ewarn "skipping python_targets_${impl}, interpreter not found"
|
||||
continue
|
||||
fi
|
||||
while read -r mod_dir ; do
|
||||
cd "${S}/pym/${mod_dir}" || die
|
||||
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
|
||||
files=$(echo *.py)
|
||||
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
|
||||
# __pycache__ directories contain no py files
|
||||
continue
|
||||
fi
|
||||
dest_mod_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages/${mod_dir}
|
||||
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
|
||||
dodir "${dest_mod_dir}" || die
|
||||
relative_path=../../../lib/portage/pym/${mod_dir}
|
||||
x=/${mod_dir}
|
||||
@ -274,22 +349,15 @@ src_install() {
|
||||
dosym "${relative_path}/${x}" \
|
||||
"${dest_mod_dir}/${x}" || die
|
||||
done
|
||||
done < <(cd "${S}"/pym || die ; find * -type d ! -path "portage/tests*")
|
||||
dest_mod_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
|
||||
case "${impl}" in
|
||||
python*)
|
||||
python=${impl/_/.}
|
||||
python=/usr/bin/${python}
|
||||
"${python}" -m compileall -q -f -d "${dest_mod_dir}" "${D}${dest_mod_dir#/}" || die
|
||||
"${python}" -OO -m compileall -q -f -d "${dest_mod_dir}" "${D}${dest_mod_dir#/}" || die
|
||||
;;
|
||||
pypy*)
|
||||
python=${impl/_/.}
|
||||
python=/usr/bin/${python/pypy/pypy-c}
|
||||
"${python}" -m compileall -q -f -d "${dest_mod_dir}" "${D}${dest_mod_dir#/}" || die
|
||||
;;
|
||||
esac
|
||||
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
|
||||
cd "${S}" || die
|
||||
EPYTHON=$(get_python_interpreter ${impl}) \
|
||||
python_compileall "$(get_python_sitedir ${impl})"
|
||||
done
|
||||
|
||||
# Compile /usr/lib/portage/pym with the active interpreter, since portage
|
||||
# internal commands force this directory to the beginning of sys.path.
|
||||
python_compileall /usr/lib/portage/pym
|
||||
}
|
||||
|
||||
pkg_preinst() {
|
||||
@ -325,7 +393,3 @@ pkg_preinst() {
|
||||
ewarn "files that have not been modified since they were installed."
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
python_mod_cleanup /usr/lib/portage/pym
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user