Hello, developers. I would like to do some redesign of waf-utils that aims at improving Python compatibility. In order to prepare for this, I'd like to commit some extra QA warnings. Please review the attached patch.
The goal is to require using of another (proper) python eclass along
with waf-utils. Currently, the code has some implicit Python magic
which may work or not work randomly, and some ebuilds are mixing it
with Python eclasses to improve things a bit. Sadly, the two things
don't integrate as well as they could.
After the final change, the ebuilds will be obligated to:
1. set PYTHON_COMPAT to state which implementations their waf scripts
(and the package, if relevant) support,
2. set PYTHON_REQ_USE as appropriate for waf (and the package),
3. inherit and use proper eclass -- python-any-r1, python-single-r1 or
python-r1.
A few examples:
a. build-time Python dependency only (waf or waf + some other scripts):
PYTHON_COMPAT=( python2_7 python3_4 )
PYTHON_REQ_USE='threads(+)' # required by waf
inherit python-any-r1
DEPEND=${PYTHON_DEPS}
pkg_setup() { python-any-r1_pkg_setup; } # if necessary
b. simple runtime dep on python (+ build-time due to waf)
PYTHON_COMPAT=( python2_7 ) # package supports 2.7 only
PYTHON_REQ_USE='threads(+),ssl(+)' # threads by waf, ssl by pkg
inherit python-single-r1
RDEPEND=${PYTHON_DEPS}
DEPEND=${RDEPEND}
REQUIRED_USE=${PYTHON_REQUIRED_USE}
pkg_setup() { python-single-r1_pkg_setup; }
c. conditional runtime dep + build-time dep due to waf
PYTHON_COMPAT=( python2_7 )
PYTHON_REQ_USE='threads(+),ssl(+)'
inherit python-single-r1
RDEPEND="python? ( ${PYTHON_DEPS} )"
DEPEND=${PYTHON_DEPS}
REQUIRED_USE=${PYTHON_REQUIRED_USE} # note: uncond due to build dep
pkg_setup() { python-single-r1_pkg_setup; } # has MERGE_TYPE inside
# but if you needed python during binpkg pre/post*, you'd do:
# pkg_setup() {
# if [[ ${MERGE_TYPE} != binary ]] || use python; then
# python_setup
# fi
# }
--
Best regards,
Michał Górny
Index: waf-utils.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/waf-utils.eclass,v
retrieving revision 1.19
diff -u -B -r1.19 waf-utils.eclass
--- waf-utils.eclass 16 Apr 2014 11:33:18 -0000 1.19
+++ waf-utils.eclass 26 Dec 2014 10:41:28 -0000
@@ -41,6 +41,21 @@
waf-utils_src_configure() {
debug-print-function ${FUNCNAME} "$@"
+ if [[ ! ${_PYTHON_ANY_R1} && ! ${_PYTHON_SINGLE_R1} && ! ${_PYTHON_R1} ]]; then
+ eqawarn "Using waf-utils.eclass without any python-r1 suite eclass is not supported"
+ eqawarn "and will be banned on YYYY-MM-DD. Please make sure to configure and inherit"
+ eqawarn "appropriate -r1 eclass. For example, if the package requires Python only"
+ eqawarn "at build time (because of waf) and supports only Python 2.7, you can use:"
+ eqawarn
+ eqawarn ' PYTHON_COMPAT=( python2_7 )'
+ eqawarn ' PYTHON_REQ_USE="threads(+)"'
+ eqawarn ' inherit python-any-r1 waf-utils'
+ eqawarn ' DEPEND="${PYTHON_DEPS}"'
+ elif [[ ${PYTHON_REQ_USE} != *threads* ]]; then
+ eqawarn "Waf requires threading support in Python. To accomodate this requirement,"
+ eqawarn "please add 'threads(+)' to PYTHON_REQ_USE variable (above inherit line)."
+ fi
+
local libdir=""
# @ECLASS-VARIABLE: WAF_BINARY
pgpAWmcVZd7im.pgp
Description: OpenPGP digital signature
