Commit e91165b0 authored by bescoto's avatar bescoto

Now date in rdiff-backup script changed automatically


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@383 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent f2dd600f
......@@ -57,8 +57,13 @@ def MakeFAQ():
html_fp.write("\n</body></html>")
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)
......
#!/usr/bin/env python
# rdiff-backup -- Mirror files while keeping incremental changes
# Version $version released October 5, 2002
# Copyright (C) 2001, 2002 Ben Escoto <bescoto@stanford.edu>
# Version $version released $date
# Copyright (C) 2001, 2002, 2003 Ben Escoto <bescoto@stanford.edu>
#
# 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment