コード例 #1
0
ファイル: component.py プロジェクト: ZeitOnline/batou
    def assert_file_is_current(self, reference, requirements=[], **kw):
        """Assert that the file given by the ``reference`` pathname has been
        created or updated after the given list of ``requirement`` file names,
        raise :py:class:`UpdateNeeded` otherwise.

        :param str reference: The file path you want to check for being
            current.

        :param list requirements: The list of filenames you want to check
            against.

        :param dict kw: Arguments that are passed through to
            ``last_update`` which can be used to use different time stamps
            than ``st_mtime``. See
            :py:meth:`batou.lib.file.File.last_updated` for possible values.

        :return: ``None``, if ``reference`` is as new or newer as all
            ``requirements``.

        :raises UpdateNeeded: if the reference file is older than any of the
            ``requirements``.

        """
        from batou.lib.file import Presence
        reference = Presence(reference)
        self |= reference
        reference.assert_component_is_current(
            [Presence(r) for r in requirements], **kw)
コード例 #2
0
ファイル: buildout.py プロジェクト: wosc/batou
 def verify(self):
     self.assert_file_is_current("bin/buildout")
     # XXX we can't be sure that all config objects are files!
     installed = Presence(".installed.cfg")
     self |= installed
     installed.assert_component_is_current([Presence("bin/buildout")] +
                                           self.config)
     self.assert_file_is_current(".batou.buildout.success",
                                 [".installed.cfg"])
     self.assert_no_subcomponent_changes()