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

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

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


From: Dmitriy Selyutin
Subject: [gnulib-tool-py] Modules and avoids: migrate to GNULibMode class
Date: Fri, 22 Jun 2012 02:11:25 +0400

Hello everyone,

in addition to previous question I want to ask another question which has no influence on work of the gnulib-tool, but has some influence on users who want to create their own scripts using pygnulib module. As you know there are two classes: GNULibMode and GNULibImport, where GNULibMode class is the parent for GNULibImport class. As you can see from the code there are some code which operates with modules (see latest commit).
  1. GNULibMode:
    1). getAllModules method gets names of the all available modules and returns them as tuple.
    2). checkModule tests whether module exists in gnulib or localdir modules directories and returns bool.
  2. GNULibImport has all methods which are used to change list of modules and avoids; these methods need checkModule method from GNULibMode class.

Don't you think it would be better to move all actions which operates with modules to GNULibMode parent class? I think it makes things clearer. We will set self.args['modules'] and self.args['avoids'] inside the GNULibMode.__init__ method (they both will be empty lists by default); all actions which must be done in GNULibImport.__init__ method will be done overriding default values of the parent class. The advantage of this way is that user can create new class which operates with modules using either GNULibMode (if he wants to create the most base class which can, however, operate with modules) or GNULibImport class (which already does some actions at the modules and avoids, so user has to work not with the empty values, but with the values as they appear after creation of the GNULibImport instance; i.e. it will set modules and avoids from cache by default for some modes and then add modules and avoids which were entered by user).

What do you think? I think that moving the most part of the modules/avoids code could provide users more possibilities to construct their own scripts, but the final decision is yours, so we need to discuss it. Thanks!

reply via email to

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