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

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

Re: [gnulib-tool-py] The root of the problem


From: Dmitriy Selyutin
Subject: Re: [gnulib-tool-py] The root of the problem
Date: Tue, 26 Jun 2012 14:25:37 +0400

Hi Bruno,

Here is the scheme how I imagine it in the most simple case:

1. User gives a list of modules which he wants to operate with.
2. For each module in $USER_MODULES:
  1). Check whether the name of the module contains in any module from $LIST_MODULES or $LIST_DEPENDENCIES (this allows to avoid GLModuleSystem.find before adding, so we gain a serious speedup). If not, we use GLModuleSystem.find on it and add GLModule instance to $LIST_MODULES.
  2). Get dependencies of the created instance. Then for each dependency (which is a string, like in a 1).) check if such string contains $LIST_MODULES or $LIST_DEPENDENCIES. If not, we use GLModuleSystem.find on it and add GLModule instance to $LIST_DEPENDENCIES.
  4) Go to the next module in list of $USER_MODULES.

I've thought that only two errors can happen here:
a) User module or dependency module does not exist.
b) User module or dependency module is broken.

These errors are easy to handle and don't require anything special. Do I miss something there?
In this case we don't ever need a cache, we just need two separated lists to store modules added by user and modules added as dependencies. Then when we do the actions we use combine user modules and depencies into one list and for each element in this list we use GLModule methods.

To add modulename to $LIST_MODULES and its dependencies to $LIST_DEPENDENCIES, we use GLModules.addModule(modulename).
To remove modulename from $LIST_MODULES and its dependencies from $LIST_DEPENDENCIES, we use GLModuleSystem.removeModule(modulename).
Of course $LIST_MODULES and $LIST_DEPENDENCIES will be not global variables, but attributes of the GLModuleSystem. I just used such names to make things more clear.

What do you think about such scheme? It is powerful, fast (mainly because we check for strings in $LIST_MODULES and $LIST_DEPENDENCIES) and not overcomplicated with those horrible for all us functions and compatibility layers.

reply via email to

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