gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnulib-tool-py] Modules and avoids: migrate to GNULibMode class


From: Dmitriy Selyutin
Subject: Re: [gnulib-tool-py] Modules and avoids: migrate to GNULibMode class
Date: Sun, 24 Jun 2012 06:31:58 +0400

Hi Bruno,

> GNULibModuleSystem can inherit from this class, or GNULibModule can contain
> a reference to a GNULibModuleSystem.
How do you feel, wouldn't it be good to use such model (note that I've
renamed classes to GL* instead of GNULib; in the parenthesis you can
see the parent of each class):

1). GLFileSystem(GLMode): func_lookup_file. It has one argument:
localdir. It also uses DIRS['root'] constant. In __init__ it
calculates the path of the original or patched file and saves it as
attribute of this class (e.g. GLFileSystem.path). May be we could add
something here? I really dislike an idea to create class for only one
action, but it is even more ugly to create function when we've decided
to use classes everywhere.

2). GLModuleSystem(GLMode): I'm completely confused between
GLModuleList, GLModule and GLModuleSystem classes. What this class
shall do?

3). GLModule(object?). It has arguments: module, localdir,
macro_prefix (something else?). I don't think that setting of the
localdir and macro_prefix for each file could make Python slow, so I
suggest to leave them here. When we need to iterate through list of
modules we can use such construction:

modulelist = [GLModule for module in ['yesno', 'xsize', 'xsublist']]

That will return a list of GLModule instances. Then we can do what we
want, e.g. print maintainer for each module:

for module in modulelist:
  print(module.getMaintainer())


And the last (see 2). too): where we will place getAllModules method?
May be GLInfo will be good for this aim?
P.S. I will begin to change GLModule class tomorrow, since it is 6:30
A.M. in Russia and I have to make a break. I'll write you tomorrow.
Good night!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]