Added python-exec-2.4.6-r2 package.

This commit is contained in:
László Valkó 2021-02-01 01:17:17 +01:00
parent c909ba542f
commit 1cbcd7e4a1
3 changed files with 152 additions and 0 deletions

View file

@ -0,0 +1,3 @@
DIST python-exec-2.4.6.tar.bz2 87634 BLAKE2B 7b6de8ad0e0603fafd3284e6e3c5247ad83f145ab4db6728914318ae8e6f5aaa3c0247f4e01238fca11519ef72fb1b11436aea7e2b8c988b8717b3f6a2a43c37 SHA512 e05eaf01b83de196a10933636ab6b1a5489a421592df49b8b58eabd0e732de970f902744cd3a06b5ab530a6d69fe6dfa8f270fbb09b9fe3df4ae04d516828050
EBUILD python-exec-2.4.6-r2.ebuild 4111 BLAKE2B c70a015b3c9bf6df3b8ad5ee1f27969d90be6648404c2f07b6f42bbb72ef28f35d16d753e7d1e36ab0b77e918c56101e9d9e72340a833fe74bd6730f1c5b8e32 SHA512 1e32339a0c067d75dbd6f258640db3561124f6dcda20c14e30e7936985c35a84dc2e5be4348f209eed22b17841047cf30f79869b38cec90d40a81b4ea951fa94
MISC metadata.xml 791 BLAKE2B ba836a4142e78972a7a6b603749bb4df0fe99cf0f054e286d9ede512db5cdab18f18fa484036e9ef7e19c20afcf1c94b70d0f813e7790dbd9decda996dd53713 SHA512 be18445f875537d03532d2ab30241951c2abc0929b382c351eda05003fd84cd84c545018941117bec5a2f74e2e2a1dd17b60bb2dae99eb81909826947ceabba9

View file

@ -0,0 +1,23 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>python@gentoo.org</email>
<name>Python</name>
</maintainer>
<upstream>
<maintainer status="active">
<email>mgorny@gentoo.org</email>
<name>Michał Górny</name>
</maintainer>
<bugs-to>https://github.com/mgorny/python-exec/issues/</bugs-to>
<remote-id type="github">mgorny/python-exec</remote-id>
</upstream>
<use>
<flag name="native-symlinks">
Install generic symlinks like python and python3. If this flag
is disabled, only versioned python3.X executables will
be available to end users and ebuilds not using python eclasses.
</flag>
</use>
</pkgmetadata>

View file

@ -0,0 +1,126 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit xpython-utils-r1
DESCRIPTION="Python script wrapper"
HOMEPAGE="https://github.com/mgorny/python-exec/"
SRC_URI="https://github.com/mgorny/python-exec/releases/download/v${PV}/${P}.tar.bz2"
LICENSE="BSD-2"
SLOT="2"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
# Internal Python project hack. Do not copy it. Ever.
IUSE="${_PYTHON_ALL_IMPLS[@]/#/python_targets_}"
RDEPEND="!<=dev-lang/python-2.7.18-r3:2.7"
src_configure() {
local pyimpls=() i EPYTHON
for i in "${_PYTHON_ALL_IMPLS[@]}"; do
if use "python_targets_${i}"; then
_python_export "${i}" EPYTHON
pyimpls+=( "${EPYTHON}" )
fi
done
local myconf=(
--with-fallback-path="${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin"
--with-python-impls="${pyimpls[*]}"
)
econf "${myconf[@]}"
}
src_install() {
default
# Prepare and own the template
insinto /etc/python-exec
newins - python-exec.conf \
< <(sed -n -e '/^#/p' config/python-exec.conf.example)
local programs=( python python3 )
local scripts=( python-config python3-config 2to3 idle pydoc pyvenv )
local f
for f in "${programs[@]}"; do
# symlink the C wrapper for python to avoid shebang recursion
# bug #568974
dosym python-exec2c /usr/bin/"${f}"
done
for f in "${scripts[@]}"; do
# those are python scripts (except for new python-configs)
# so symlink them via the python wrapper
dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}"
done
}
pkg_preinst() {
if [[ -e ${EROOT}/etc/python-exec/python-exec.conf ]]; then
# preserve current configuration
cp "${EROOT}"/etc/python-exec/python-exec.conf \
"${ED}"/etc/python-exec/python-exec.conf || die
else
# preserve previous Python version preference
local py old_pythons=()
local config_base=${EROOT}/etc/env.d/python
# start with the 'global' preference (2 vs 3)
if [[ -f ${config_base}/config ]]; then
old_pythons+=( "$(<${config_base}/config)" )
fi
# then try specific py3 selection
for py in 3; do
local target=
if [[ -f ${config_base}/python${py} ]]; then
# try the newer config files
target=$(<${config_base}/python${py})
elif [[ -L ${EROOT}/usr/bin/python${py} ]]; then
# check the older symlink format
target=$(readlink "${EROOT}/usr/bin/python${py}")
# check if it's actually old eselect symlink
[[ ${target} == python?.? ]] || target=
fi
# add the extra target if found and != global
if [[ ${target} && ${old_pythons[0]} != ${target} ]]; then
old_pythons+=( "${target}" )
fi
done
if [[ ${old_pythons[@]} ]]; then
elog "You seem to have just upgraded into the new version of python-exec"
elog "that uses python-exec.conf for configuration. The ebuild has attempted"
elog "to convert your previous configuration to the new format, resulting"
elog "in the following preferences (most preferred version first):"
elog
for py in "${old_pythons[@]}"; do
elog " ${py}"
done
elog
elog "Those interpreters will be preferred when running Python scripts or"
elog "calling wrapped Python executables (python, python2, pydoc...)."
elog "If none of the preferred interpreters are supported, python-exec will"
elog "fall back to the newest supported Python version."
elog
elog "Please note that due to the ambiguous character of the old settings,"
elog "you may want to modify the preference list yourself. In order to do so,"
elog "open the following file in your favorite editor:"
elog
elog " ${EROOT}/etc/python-exec/python-exec.conf"
elog
elog "For more information on the new configuration format, please read"
elog "the comment on top of the installed configuration file."
local IFS=$'\n'
echo "${old_pythons[*]}" \
>> "${ED}"/etc/python-exec/python-exec.conf || die
fi
fi
}