Monday, January 25, 2010

Distractions

I've been distracted away form porthole code lately. Well not completely, I do have an ulterior motive. I am working on gentoolkit code again. Namely a modular rewrite of eclean.

eclean was an all in one python script that contained a number of unwieldy methods and functions which made it difficult to modify and nearly impossible to create test functions for. One of the primary reasons I started on it was to split the back-end functioning code from the output printing code similar to most of the newly redone equery modules. That way the code can be used by other applications. So, I began by separating the script into a python package containing 5 files and a nearly empty script that just loads and calls the main() .

Those 5 files being:
  1. cli.py to handle all command line interface argument parsing and start the requested action.
  2. search.py with all the search related methods and functions which determine the files to be cleaned.
  3. exclude.py containing the exclusion file parsing and handling code.
  4. output.py for the screen output and user interaction.
  5. clean.py to handle the actual cleaning process.
The end result should be one that has a number of automatic tests run on it to check that any code modifications are performing correctly as well as code that will be easier to maintain.
It will also then be possible for the code to be used in other apps such as a planned plug-in module for porthole. :)

No comments:

Post a Comment