From 2b45f542a5fa4145674b9380bfacd284e8d03d8e Mon Sep 17 00:00:00 2001 From: bescoto Date: Fri, 8 Aug 2003 19:39:13 +0000 Subject: Now date in rdiff-backup script changed automatically git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@383 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/dist/makedist | 17 ++++++++++++++--- rdiff-backup/rdiff-backup | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/rdiff-backup/dist/makedist b/rdiff-backup/dist/makedist index 95c2cb5..926b686 100755 --- a/rdiff-backup/dist/makedist +++ b/rdiff-backup/dist/makedist @@ -57,8 +57,13 @@ def MakeFAQ(): html_fp.write("\n") html_fp.close() -def VersionedCopy(source, dest): - """Copy source to dest, substituting $version with version""" +def VersionedCopy(source, dest, munge_date = 0): + """Copy source to dest, substituting $version with version + + If munge_date is true, also replace $date with string like "August + 8, 2003". + + """ fin = open(source, "rb") inbuf = fin.read() assert not fin.close() @@ -68,6 +73,12 @@ def VersionedCopy(source, dest): assert not re.search("\$version", outbuf), \ "Two $version strings found in the same file %s" % (source,) + if munge_date: + inbuf = outbuf + outbuf = re.sub("\$date", time.strftime("%B %d, %Y"), inbuf, 1) + if outbuf == inbuf: assert 0, "No $date string replaced" + assert not re.search("\$date", outbuf), "Two $date strings found" + fout = open(dest, "wb") fout.write(outbuf) assert not fout.close() @@ -103,7 +114,7 @@ def MakeTar(): VersionedCopy("%s/Globals.py" % (SourceDir,), "%s/rdiff_backup/Globals.py" % (tardir,)) - VersionedCopy("rdiff-backup", "%s/rdiff-backup" % (tardir,)) + VersionedCopy("rdiff-backup", "%s/rdiff-backup" % (tardir,), 1) VersionedCopy(DistDir + "/setup.py", "%s/setup.py" % (tardir,)) os.chmod(os.path.join(tardir, "setup.py"), 0755) diff --git a/rdiff-backup/rdiff-backup b/rdiff-backup/rdiff-backup index 0aafb65..48c67df 100755 --- a/rdiff-backup/rdiff-backup +++ b/rdiff-backup/rdiff-backup @@ -1,7 +1,7 @@ #!/usr/bin/env python # rdiff-backup -- Mirror files while keeping incremental changes -# Version $version released October 5, 2002 -# Copyright (C) 2001, 2002 Ben Escoto +# Version $version released $date +# Copyright (C) 2001, 2002, 2003 Ben Escoto # # This program is licensed under the GNU General Public License (GPL). # you can redistribute it and/or modify it under the terms of the GNU -- cgit v1.2.1