public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Planned changes to waf-utils.eclass
@ 2014-12-26 10:55 Michał Górny
  2014-12-26 11:26 ` Pacho Ramos
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2014-12-26 10:55 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 2121 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: waf-utils.eclass.diff --]
[-- Type: text/x-patch, Size: 1330 bytes --]

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] Planned changes to waf-utils.eclass
  2014-12-26 10:55 [gentoo-dev] Planned changes to waf-utils.eclass Michał Górny
@ 2014-12-26 11:26 ` Pacho Ramos
  2014-12-26 13:42   ` Michał Górny
  0 siblings, 1 reply; 3+ messages in thread
From: Pacho Ramos @ 2014-12-26 11:26 UTC (permalink / raw
  To: gentoo-dev

El vie, 26-12-2014 a las 11:55 +0100, Michał Górny escribió:
[...]
> A few examples:
[...]

I see the eqawarnings are only pointing to the first example, did you
consider copying all this examples to a wiki page and, then, point
people to there from the qa warnings to let them know all the
possibilities without needing to search for this mail thread? 

Thanks a lot :)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] Planned changes to waf-utils.eclass
  2014-12-26 11:26 ` Pacho Ramos
@ 2014-12-26 13:42   ` Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2014-12-26 13:42 UTC (permalink / raw
  To: Pacho Ramos; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

Dnia 2014-12-26, o godz. 12:26:32
Pacho Ramos <pacho@gentoo.org> napisał(a):

> El vie, 26-12-2014 a las 11:55 +0100, Michał Górny escribió:
> [...]
> > A few examples:
> [...]
> 
> I see the eqawarnings are only pointing to the first example, did you
> consider copying all this examples to a wiki page and, then, point
> people to there from the qa warnings to let them know all the
> possibilities without needing to search for this mail thread? 

https://wiki.gentoo.org/wiki/Project:Python/waf-utils_integration

Done :).

-- 
Best regards,
Michał Górny

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-26 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-26 10:55 [gentoo-dev] Planned changes to waf-utils.eclass Michał Górny
2014-12-26 11:26 ` Pacho Ramos
2014-12-26 13:42   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox