From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python <gentoo-python@lists.gentoo.org>
Cc: python@gentoo.org, jlec@gentoo.org, gnome@gentoo.org
Subject: [gentoo-python] Mixing python-any-r1 (e.g. waf-utils.eclass) and python-single-r1 in a single ebuild
Date: Fri, 11 Apr 2014 17:43:02 +0200 [thread overview]
Message-ID: <20140411174302.5c63fdba@pomiot.lan> (raw)
[-- Attachment #1: Type: text/plain, Size: 2847 bytes --]
Hello, all.
If I recall correctly, jlec lately mentioned he'd like to use
python-any-r1 and python-single-r1. A particularly inevitable use case
for this would be ebuilds using waf, so I'll use that as an example.
The idea is pretty simple. Since the ebuilds in question use waf that
is in Python, the waf-utils.eclass inherits python-any-r1. However,
some of the ebuilds may install Python modules as well, and that asks
for python-single-r1. So the issue is how to make the two work together.
Possible solution: hierarchical eclass overrides
------------------------------------------------
Idea: if both python-any-r1 and python-single-r1 are inherited,
the latter transparently overrides the former. More specifically,
implementation selected for python-single-r1 is used for code designed
for python-any-r1.
Details:
1. PYTHON_COMPAT is declared before the inherits, so it should be always
set by ebuild. If we feel like the eclass needs to provide
the default, it may only do so if ebuild doesn't set its own
PYTHON_COMPAT. The eclass may also need to check ebuild's
PYTHON_COMPAT for conflicts with own supported impls (and die in that
case).
2. PYTHON_REQ_USE likewise. The eclass may append to it (but careful
with that).
3. ${PYTHON_DEPS}:
a. if python-single-r1 is inherited before python-any-r1 (waf-utils),
PYTHON_DEPS is set by the former and the latter doesn't change
it. Both waf-utils and the ebuild add PYTHON_DEPS, so the same
deps get added twice but there's no functional difference from
python-single-r1,
b. if python-single-r1 is inherited after waf-utils, the latter adds
dependency based on python-any-r1 and then the ebuild adds
another based on python-single-r1. With a bit of luck or good
programming, everything works fine. Worst case, additional
version of Python may get pulled build-time as a result of
any-of dep.
4. python_setup() gets exported (overriden) by python-single-r1. Since
it is called after the complete inherit chain, the correct version
is used.
5. python-any-r1_pkg_setup() just calls python-single-r1_pkg_setup().
6. python_check_deps() is not used.
7. python_gen_any_dep() is an issue I don't know how to solve:
a. if python-single-r1 is inherited before python-any-r1, it could
override it so that it generates just a single dependency
matching the syntax used for python-single-r1,
b. but if waf-utils is inherited first, the dep strings will be
generated before python-single-r1 is inherited,
c. possibly we could just ban python_gen_any_dep() and make it
export magical variable that will cause python-single-r1 inherit
to die.
Your thoughts?
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
reply other threads:[~2014-04-11 15:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140411174302.5c63fdba@pomiot.lan \
--to=mgorny@gentoo.org \
--cc=gentoo-python@lists.gentoo.org \
--cc=gnome@gentoo.org \
--cc=jlec@gentoo.org \
--cc=python@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox