""" Build support for CERN's root_ package -------------------------------------- """ import os.path import shutil from ApeTools import Config, Build class Root(Build.Package): def __init__(self, name): """Defines extra :attr:`enable` and :attr:`disable` list attributes and reads their values from the configuration. These attributes are used to determine the list of ``--enable-*`` and ``--disable-*`` arguments to :command:`./configure`. This implementation keeps the option lists in the configuration files shorter. """ Build.Package.__init__(self, name) self.setAttributes("enable disable configureArgs", Config.getlist) self.configureArgs += ["--disable-%s" % p for p in self.disable] + \ ["--enable-%s" % p for p in self.enable] def build(self, env): """Remove the :envvar:`ROOTSYS` environment variable before before calling :meth:`ApeTools.Build.Package.build` to build root_. """ try: del env["ROOTSYS"] except KeyError: pass Build.Package.build(self, env) def unpack(self): """Unpack root_. The top level directory in the tar-ball is always called ``root``. We rename it to ``root-``\ *version*. """ Build.Package.unpack(self) if Config.getboolean("ape", "dryRun"): return if os.path.exists(self.sourceDirectory): shutil.rmtree(self.sourceDirectory) shutil.move(os.path.join(os.path.dirname(self.sourceDirectory), "root"), self.sourceDirectory)