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

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

Re: [gnulib-tool-py] func_modules_transitive_closure


From: Dmitriy Selyutin
Subject: Re: [gnulib-tool-py] func_modules_transitive_closure
Date: Sat, 30 Jun 2012 11:49:44 +0400

Hi Bruno,

Thank you very much for such beautiful explanation! I've made the first sketch of this behaviour in Python in the last commit (except for the last part), so can I ask you to look through code quickly to see if I've understood you correctly. I've done two parts of three; also see remarks below.


  def execute(self, dryrun=False):
    '''Run the GLImport and perform necessary actions. If dryrun is True, then
    only print what would have been done.'''
    system = self.modulesystem
    modules = self.getModules()
    avoids = self.getAvoids()
    dependencies = list()
   
    if not self.checkDependencies():
     
      if not self.getTestFlags():
        for module in modules:
          if module not in avoids:
            module = system.find(module)
            dependencies += module.getDependencies()
        dependencies = [dep.split('[')[0].strip() for dep in dependencies]
        dependencies = sorted(set(dependencies))
     
      else: # if self.getTestFlags()
        for module in modules:
          if module not in avoids:
            module = system.find(module)
            status = module.getStatus()
           
            if system.exists(module.getTestsName()):
              if self.checkTestFlag(TESTS['tests']):
                dependencies += [module.getTestsName()]
           
            elif status == 'obsolete':
              if self.checkTestFlag(TESTS['obsolete']):
                dependencies += module.getDependencies()
           
            elif status == 'c++-test':
              if self.checkTestFlag(TESTS['c++-test']):
                dependencies += module.getDependencies()
           
            elif status == 'longrunning-test':
              if self.checkTestFlag(TESTS['longrunning-test']):
                dependencies += module.getDependencies()
           
            elif status == 'privileged-test':
              if self.checkTestFlag(TESTS['privileged-test']):
                dependencies += module.getDependencies()
           
            elif status == 'unportable-test':
              if self.checkTestFlag(TESTS['unportable-test']):
                dependencies += module.getDependencies()
           
            elif status.endswith('-test'):
              if self.checkTestFlag(TESTS['all']):
                dependencies += [module.getDependencies()]
     
    pprint(dependencies)


As you see here we get dependencies and print them. After I finish the third part, I'll change the script to make it calculate the sum of the user-defined modules and their dependencies.
As you can see from GLModuleSystem module, I've improved cache technique, because each GLModuleSystem instance now has it's own cache too. It takes 0.16 seconds on my laptop make all necessary calculations for m4 package in '--import' mode (see gnulib-tool.py), so I think we've already won a lot of time comparing with the old gnulib-tool.

reply via email to

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