예제 #1
0
    def format_outname(self):
        """Formats an output filename.

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

        :Returns:
          - (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:
            self.guess_name()
        formatted = self.name
        if ts:
            formatted = "%s-%s" % (ts, formatted)
        return formatted + ".zip"
예제 #2
0
    def format_outname(self):
        """Formats an output filename.

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

        :Returns:
          - (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:
            self.guess_name()
        formatted = self.name
        if ts:
            formatted = "%s-%s" % (ts, formatted)
        return formatted + ".zip"
예제 #3
0
    def _create_log(self):
        """Creates a log file.

        :Postconditions:
          - 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:
            return
        # Bail if log is not requested or there is no log text.
        if not self.logtxt:
            return
        if self.no_log:
            return

        # 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")
예제 #4
0
    def _create_log(self):
        """Creates a log file.

        :Postconditions:
          - 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:
            return
        # Bail if log is not requested or there is no log text.
        if not self.logtxt:
            return
        if self.no_log:
            return

        # 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")