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

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

[gnulib-tool-py] Proposal: GLConfig class


From: Dmitriy Selyutin
Subject: [gnulib-tool-py] Proposal: GLConfig class
Date: Fri, 3 Aug 2012 03:19:15 +0200

Hi Bruno,

since almost every GL* class or method of such class need some variables (auxdir, localdir, etc.) and we have to transmit different variable to different variables, I'd like to intoduce a new class that just stores all settings (by default they are all set to None). That's absolutely standalone class, which doesn't have parents or inheritors and just used as intermediate class to store variables. If we implement such class, we can just transfer its copy to every GL* class instead of transfering a lot of variables. We also need to test each time variable, which requires a time and vastly increases size of code.


BEFORE
class GLEmiter(object):
  def __init__(self, destdir, localdir, auxdir,
  sourcebase='lib', m4base='m4', testsbase='tests', pobase='po'):
    # Here we set these variables to their self analogues
    pass

  def lib_Makefile_am(self, modules, podomain, witness_c_macro, conddeps,
    libtool=False, libname='libgnu', makefile='Makefile.am', macro_prefix='gl',
    actioncmd='', for_test=False, include_guard_prefix='GL', ac_version=2.59):
      # Here we combinate self* variables with those which were transfered to method
      amsnippet2 = module.getAutomakeSnippet_Unconditional(self.auxdir, ac_version)

AFTER
class GLEmiter(object):
  def __init__(self, config):
    self.config = config

  def lib_Makefile_am(self):
    # We just get the necessary variables from GLConfig, e.g.
    auxdir = self.config.getAuxDir()


I think it can really help us to clean code and ensure its transparency. What do you think? Its a pity that we need to spend time on such things, but it can really simplificate my work.

--
With best regards,
Dmitriy Selyutin

E-mail: address@hidden
Phone: +7(985)334-07-70


reply via email to

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