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

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

[gnulib-tool-py] Module does not exist: error or warning?


From: Dmitriy Selyutin
Subject: [gnulib-tool-py] Module does not exist: error or warning?
Date: Fri, 22 Jun 2012 01:46:29 +0400

Hello everyone!

Since I've successfully passed exams I can now return to work. First I began to write a code for getting modules from cache, combining them with user-defined modules and then processing them using different functions. And first of all I've created checkModule method, which returns True or False depending on whether module was found in either gnulib root directory (DIRS['root'] from constants) or localdir directory. We have a couple of methods that normally shall test module name when we add a module (see addModule/addAvoid, removeModule/removeAvoid, setModules/setAvoids, resetModules/resetAvoids methods). Such methods should normally do something if module does not exist.

I can see three possible variants:
  1. We can move code where such things can happen to run(self) method (or method with similar name, I haven't decided yet). If error happens, we catch it and then print warning that module was not found (just look to m4 package to see an example where package has 'exit' method which does not exist).
  2. We can use warnings module, which is default module for Python. However, it has one disadvantage: Python provides ugly mechanism to catch them, so I'd rather prefer to raise an error instead of generating a warning.
  3. We can simply print a message instead of generating error. This way is the easiest, but some users who wants to make their own scripts would rather prefer to catch errors or leave them when they create new class which is based on the GNULibImport class (if they need to have such class).

I'd rather prefer the first method, because we can save users a possibility to catch errors or not as they like in their scripts.

What do you think? I would be glad to hear your views. Thanks!

reply via email to

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