mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-06 08:25:01 +01:00
pyinstaller: fix issue 459
This commit is contained in:
parent
817b562f4b
commit
d4d6e3f90b
3 changed files with 6 additions and 192 deletions
|
|
@ -1,2 +1 @@
|
|||
DIST PyInstaller-3.2.tar.gz 2775557 BLAKE2B fe928632c58b4c0c50b7491e26f1cf2dc58da197f0f709cef1e117b14b220f6f9e3d5996ad84cdf85cd93c3fa16be2c3458879981072d04b9c33a6ec819bac03 SHA512 568facc21e9ee06ff3f505c4e413d3a17329cfa219e62dca0a06ffe746e969b29137e8478113408f8db9c05b9ca69c6fc23bd8bf1396a9d821a911a60bb62e6b
|
||||
DIST PyInstaller-3.4.tar.gz 3487849 BLAKE2B 0f34ba04e9a9339a9a20b703759f635e64e65508f86a36a5054b61974e473dcb6c89d1262372bbaf710f8d4f0b6c3d6ba80bdc353da1db245ba24c10dbfa8822 SHA512 8a1e0065e8c7760ffcae906d3469914c98a69139658a3a85f1bb7b1a63265e33603314586897bf3b588400d2bdd48bb6ee06cef68c19232c4ec8a8df84e57330
|
||||
|
|
|
|||
|
|
@ -1,186 +0,0 @@
|
|||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=5
|
||||
|
||||
# PyInstaller assumes CPython internals and is hence currently incompatible with
|
||||
# alternative interpreters (e.g., PyPy).
|
||||
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
|
||||
|
||||
# "waf" requires a threading-enabled Python interpreter.
|
||||
PYTHON_REQ_USE='threads(+)'
|
||||
|
||||
# Order of operations is significant here. Since we explicitly call "waf-utils"
|
||||
# but *NOT* "distutils-r1" phase functions, ensure the latter remain the default
|
||||
# by inheriting the latter *AFTER* the former.
|
||||
inherit waf-utils distutils-r1
|
||||
|
||||
DESCRIPTION="Program converting Python programs into stand-alone executables"
|
||||
HOMEPAGE="http://www.pyinstaller.org"
|
||||
|
||||
LICENSE="pyinstaller"
|
||||
SLOT="0"
|
||||
|
||||
IUSE="clang debug doc leak-detector"
|
||||
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
||||
|
||||
#FIXME: Interestingly, PyInstaller itself has no hard or soft dependencies
|
||||
#excluding the expected build-time dependency of "setuptools". Its unit tests,
|
||||
#however, require an elaborate set of pure-Python packages, C-based Python
|
||||
#extensions, and system-wide shared libraries. It's fairly extreme --
|
||||
#sufficiently extreme, in fact, that we do *NOT* currently bother. For an
|
||||
#exhaustive list of such dependencies, see "tests/test-requirements.txt".
|
||||
|
||||
RDEPEND="${PYTHON_DEPS}"
|
||||
DEPEND="${RDEPEND}
|
||||
leak-detector? ( dev-libs/boehm-gc )
|
||||
clang? ( sys-devel/clang )
|
||||
!clang? ( sys-devel/gcc )
|
||||
"
|
||||
|
||||
# While the typical "waf" project permits "waf" to be run from outside the
|
||||
# directory containing "waf", PyInstaller requires "waf" to be run from inside
|
||||
# such directory in a relative manner. Ensure this.
|
||||
WAF_BINARY="./waf"
|
||||
|
||||
# Since the "waf" script bundled with PyInstaller does *NOT* support the
|
||||
# conventionel "--libdir" option, prevent such option from being passed.
|
||||
NO_WAF_LIBDIR=1
|
||||
|
||||
if [[ ${PV} == 9999 ]]; then
|
||||
inherit git-r3
|
||||
|
||||
EGIT_REPO_URI="https://github.com/pyinstaller/pyinstaller"
|
||||
EGIT_BRANCH="develop"
|
||||
SRC_URI=""
|
||||
KEYWORDS=""
|
||||
else
|
||||
MY_PN="PyInstaller"
|
||||
MY_P="${MY_PN}-${PV}"
|
||||
SRC_URI="https://github.com/pyinstaller/pyinstaller/releases/download/v${PV}/${MY_P}.tar.gz"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
fi
|
||||
|
||||
python_prepare_all() {
|
||||
#FIXME: This is almost certainly wrong. We almost certainly want to use
|
||||
#actual USE flags instead: e.g.,
|
||||
#
|
||||
# local arch_word_size
|
||||
# if use amd64; then
|
||||
# arch_word_size=64
|
||||
# elif use x86; then
|
||||
# arch_word_size=32
|
||||
# else
|
||||
# die "Architecture \"${ARCH}\" unsupported."
|
||||
# fi
|
||||
|
||||
# Word size for the current architecture. (There simply *MUST* be a more
|
||||
# Gentooish way of determining this. I couldn't find it. While we should
|
||||
# arguably test "[[ "$(getconf LONG_BIT)" == 64 ]]" instead, such magic is
|
||||
# arguably even kludgier. Your mileage may vary.)
|
||||
local arch_word_size
|
||||
case "${ARCH}" in
|
||||
amd64) arch_word_size=64;;
|
||||
*) arch_word_size=32;;
|
||||
esac
|
||||
|
||||
# Install only the Linux bootloader specific to:
|
||||
#
|
||||
# * The architecture of the current machine.
|
||||
# * The release type requested for the current installation. Specifically:
|
||||
# * If the "debug" USE flag is enabled, only install the "run_d" binary.
|
||||
# * Else, only install the "run" binary.
|
||||
local bootloader_basename='run'
|
||||
use debug && bootloader_basename+='_d'
|
||||
sed -i \
|
||||
-e '/.*bootloader\/\*\/*.*/s~\*/\*~Linux-'${arch_word_size}'bit/'${bootloader_basename}'~' \
|
||||
setup.py || die '"sed" failed.'
|
||||
|
||||
# Prevent badness during compilation. Specifically (in order):
|
||||
#
|
||||
# * Avoid stripping bootloader binaries.
|
||||
# * Prevent the bootloader from being compiled under:
|
||||
# * Hard-coded ${CFLAGS}.
|
||||
# * gcc option "-Werror", converting compiler warnings to errors and hence
|
||||
# failing on the first (inevitable) warning.
|
||||
sed -i \
|
||||
-e "s~\\(\\s*\\)features\\s*=\\s*'strip'$~\\1pass~" \
|
||||
-e "s~\\(\\s*\\)ctx.env.append_value('CFLAGS', '-O2')$~\\1pass~" \
|
||||
-e "/'CFLAGS',\\s*'-Werror'/d" \
|
||||
bootloader/wscript || die '"sed" failed.'
|
||||
|
||||
# Continue with the default behaviour.
|
||||
distutils-r1_python_prepare_all
|
||||
}
|
||||
|
||||
python_configure() {
|
||||
# CLI options to be passed to the "waf configure" command run below.
|
||||
local -a waf_configure_options; waf_configure_options=(
|
||||
# Since Gentoo is *NOT* LSB-compliant, a non-LSB-compliant bootloader
|
||||
# must be built. Sadly, doing so could reduce the portability of the
|
||||
# resulting bootloader and hence applications frozen under that
|
||||
# bootloader. Until Gentoo supplies an ebuild for building at least
|
||||
# version 4.0 of the LSB tools, there's little we can do here.
|
||||
--no-lsb
|
||||
)
|
||||
use debug && waf_configure_options+=( --debug )
|
||||
use clang && waf_configure_options+=( --clang )
|
||||
use leak-detector && waf_configure_options+=( --leak-detector )
|
||||
|
||||
# Configure the Linux bootloader.
|
||||
cd bootloader
|
||||
waf-utils_src_configure "${waf_configure_options[@]}"
|
||||
|
||||
# Continue with the default behaviour.
|
||||
cd "${S}"
|
||||
distutils-r1_python_configure
|
||||
}
|
||||
|
||||
python_compile() {
|
||||
# Compile the non-debug Linux bootloader. Ideally, we would simply call
|
||||
# waf-utils_src_compile() to do so. Unfortunately, that function attempts to
|
||||
# run the "build" WAF task, which for PyInstaller *ALWAYS* fails with the
|
||||
# following fatal error:
|
||||
#
|
||||
# Call "python waf all" to compile all bootloaders.
|
||||
#
|
||||
# Since the "waf-utils" eclass does *NOT* support running of alternative
|
||||
# tasks, we reimplement waf-utils_src_compile() to do so. (Since this is
|
||||
# lame, we should probably file a feature request with the author of the
|
||||
# "waf-utils" eclass.)
|
||||
cd bootloader
|
||||
local _mywafconfig
|
||||
[[ "${WAF_VERBOSE}" ]] && _mywafconfig="--verbose"
|
||||
local jobs="--jobs=$(makeopts_jobs)"
|
||||
echo "\"${WAF_BINARY}\" build_release ${_mywafconfig} ${jobs}"
|
||||
"${WAF_BINARY}" build_release ${_mywafconfig} ${jobs} ||
|
||||
die "Bootloader compilation failed."
|
||||
|
||||
# Move the binaries for such bootloader to "PyInstaller/bootloader" *BEFORE*
|
||||
# compiling the non-bootloader portion of PyInstaller, which requires such
|
||||
# binaries. (Note that the "install_release" task does *NOT* install files
|
||||
# to ${IMAGE}, despite the "install" in such task name.)
|
||||
"${WAF_BINARY}" install_release || die "Bootloader installation failed."
|
||||
|
||||
# Continue with the default behaviour.
|
||||
cd "${S}"
|
||||
distutils-r1_python_compile
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
distutils-r1_python_install_all
|
||||
|
||||
# Install plaintext documentation.
|
||||
dodoc README.rst doc/*.rst
|
||||
|
||||
# If requested, install non-plaintext documentation as well.
|
||||
if use doc; then
|
||||
# Install HTML documentation.
|
||||
dohtml -r doc/*
|
||||
|
||||
# Install PDF documentation.
|
||||
docinto pdf
|
||||
dodoc doc/*.pdf
|
||||
fi
|
||||
}
|
||||
|
|
@ -31,7 +31,10 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
|||
#sufficiently extreme, in fact, that we do *NOT* currently bother. For an
|
||||
#exhaustive list of such dependencies, see "tests/test-requirements.txt".
|
||||
|
||||
RDEPEND="${PYTHON_DEPS}"
|
||||
RDEPEND="${PYTHON_DEPS}
|
||||
>=dev-python/macholib-1.8[${PYTHON_USEDEP}]
|
||||
dev-python/altgraph[${PYTHON_USEDEP}]
|
||||
>=dev-python/pefile-2018.08.08[${PYTHON_USEDEP}]"
|
||||
DEPEND="${RDEPEND}
|
||||
leak-detector? ( dev-libs/boehm-gc )
|
||||
clang? ( sys-devel/clang )
|
||||
|
|
@ -61,7 +64,6 @@ else
|
|||
MY_PN="PyInstaller"
|
||||
MY_P="${MY_PN}-${PV}"
|
||||
SRC_URI="https://github.com/pyinstaller/pyinstaller/releases/download/v${PV}/${MY_P}.tar.gz"
|
||||
#https://github.com/pyinstaller/pyinstaller/issues/3981
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
fi
|
||||
|
|
@ -108,7 +110,6 @@ python_prepare_all() {
|
|||
# * Hard-coded ${CFLAGS}.
|
||||
# * gcc option "-Werror", converting compiler warnings to errors and hence
|
||||
# failing on the first (inevitable) warning.
|
||||
# -e "s~\\(\\s*\\)features\\s*=\\s*'strip'$~\\1pass~" \
|
||||
sed -i \
|
||||
-e "s~\\(\\s*\\)ctx.env.append_value('CFLAGS', '-O2')$~\\1pass~" \
|
||||
-e "/'CFLAGS',\\s*'-Werror'/d" \
|
||||
Loading…
Reference in a new issue