# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4; encoding:utf8 -*- # # Copyright 2002 Ben Escoto # Copyright 2007 Kenneth Loafman # # This file is part of duplicity. # # Duplicity is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # Duplicity is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with duplicity; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA u"""Produce and parse the names of duplicity's backup files""" from builtins import str from builtins import range from builtins import object import re from duplicity import dup_time from duplicity import config import sys full_vol_re = None full_vol_re_short = None full_manifest_re = None full_manifest_re_short = None inc_vol_re = None inc_vol_re_short = None inc_manifest_re = None inc_manifest_re_short = None full_sig_re = None full_sig_re_short = None new_sig_re = None new_sig_re_short = None def prepare_regex(force=False): global full_vol_re global full_vol_re_short global full_manifest_re global full_manifest_re_short global inc_vol_re global inc_vol_re_short global inc_manifest_re global inc_manifest_re_short global full_sig_re global full_sig_re_short global new_sig_re global new_sig_re_short # we force regex re-generation in unit tests because file prefixes might have changed if full_vol_re and not force: return full_vol_re = re.compile(b"^" + config.file_prefix + config.file_prefix_archive + b"duplicity-full" b"\\.(?P