Exemple #1
    def format_outname(self):
        """Formats an output filename.

          - If the `name` attribute is not set, one will be guessed.

          - (str) The output filename (not full path) for the archive.
        formatted = ""

        # Format timestamp.
        ts = arclib.format_ts(self.ts, self.ts_style)

        # Handle formatted name.
        if not self.name:
        formatted = self.name
        if ts:
            formatted = "%s-%s" % (ts, formatted)
        return formatted + ".zip"
Exemple #2
    def _create_log(self):
        """Creates a log file.

          - Log file will be created on the filesystem.
          - Attribute `logpath`` will be populated with the path to the created
            file, empty if no log created.
        # Bail if log already exists.
        if self.logpath:
        # Bail if log is not requested or there is no log text.
        if not self.logtxt:
        if self.no_log:

        # Create archive log file.
        log_ts = arclib.format_ts(self.ts, "expand")
        logdoc = adoclib.format_doc(self.name, self.logtxt, date=log_ts)
        self.logpath = os.path.join(os.path.abspath(self.outdir), self.logname)
        with open(self.logpath, "w") as fo:
            fo.write(logdoc + "\n")