Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [RFC] Naming Conventions
Date: Sat, 22 Jul 2006 23:39:14
Message-Id: 20060722233813.GB12423@seldon
In Reply to: Re: [gentoo-portage-dev] [RFC] Naming Conventions by Zac Medico
1 On Sat, Jul 22, 2006 at 04:25:01PM -0700, Zac Medico wrote:
2 > Chris White wrote:
3 > > 1) Create aliases to the new functions, then at some
4 > > yet-to-be-determined point, kill the aliases and bomb on the scripts
5 > > (this suffers from procrastination).
6 > >
7 > > 2) Make an official release with the new function names and no aliases,
8 > > as well as the soon to come docs. I sort of like this method because
9 > > those with official portage tools can adjust their scripts, and simply
10 > > alter the depend atoms for >= (new API versions) and <= (old versions),
11 > > effectively forcing/preventing upgrades.
12 >
13 > I vote for #1 because it's smoother and easier (which is good for me especially because I do releases). The disruptive change proposed in #2 seems like it would cause unnecessary problems with no practical advantage over #1.
14
15 Suggest you mark the aliases funcs in some way in the code so that
16 they can be spotted via scanning.
17
18 Use a convience func;
19
20 def alias_func(alias_name, alised_func):
21 def f(alias_name, aliased_func, *a, **kw):
22 import warnings
23 warnings.warn("don't use %s, use %s" % (alias_name, alias_func.__name__)
24 return aliased_func(*a, **kw)
25 return f
26
27 pkgsplit = alias_func('pkgsplit', PkgSplit)
28
29 upshot, you can puke warnings via it, and you've got something to scan
30 the actual namespace for; makes it quite a bit easier to switch off
31 the aliases.
32 ~harring