Skip to content

Commit dbf37c9

Browse files
author
Jürgen Hermann
committed
Code using copyDigestedFile() that passes unit tests
1 parent 771d890 commit dbf37c9

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

roundup/init.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: init.py,v 1.16 2001-10-09 07:25:59 richard Exp $
18+
# $Id: init.py,v 1.17 2001-11-12 23:17:38 jhermann Exp $
1919

20-
import os, shutil, sys, errno
20+
import os, sys, errno
2121

2222
import roundup.instance, password
23+
from roundup import install_util
2324

2425
def copytree(src, dst, symlinks=0):
25-
"""Recursively copy a directory tree using copy2().
26+
"""Recursively copy a directory tree using copyDigestedFile().
2627
2728
The destination directory os allowed to exist.
2829
@@ -48,7 +49,7 @@ def copytree(src, dst, symlinks=0):
4849
elif os.path.isdir(srcname):
4950
copytree(srcname, dstname, symlinks)
5051
else:
51-
shutil.copy2(srcname, dstname)
52+
install_util.copyDigestedFile(srcname, dstname)
5253

5354
def init(instance_home, template, backend, adminpw):
5455
'''Initialise an instance using the named template and backend.
@@ -103,6 +104,10 @@ def init(instance_home, template, backend, adminpw):
103104

104105
#
105106
# $Log: not supported by cvs2svn $
107+
# Revision 1.16 2001/10/09 07:25:59 richard
108+
# Added the Password property type. See "pydoc roundup.password" for
109+
# implementation details. Have updated some of the documentation too.
110+
#
106111
# Revision 1.15 2001/08/07 00:24:42 richard
107112
# stupid typo
108113
#

roundup/install_util.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: install_util.py,v 1.4 2001-11-12 23:14:40 jhermann Exp $
18+
# $Id: install_util.py,v 1.5 2001-11-12 23:17:38 jhermann Exp $
1919

2020
import os, sha, shutil
2121

@@ -99,9 +99,9 @@ def copyDigestedFile(src, dst, copystat=1):
9999
dummy, ext = os.path.splitext(src)
100100
if ext not in digested_file_types:
101101
if copystat:
102-
return shutil.copy2(srcname, dstname)
102+
return shutil.copy2(src, dst)
103103
else:
104-
return shutil.copyfile(srcname, dstname)
104+
return shutil.copyfile(src, dst)
105105

106106
fsrc = None
107107
fdst = None
@@ -145,6 +145,9 @@ def test():
145145

146146
#
147147
# $Log: not supported by cvs2svn $
148+
# Revision 1.4 2001/11/12 23:14:40 jhermann
149+
# Copy function, and proper handling of unknown file types
150+
#
148151
# Revision 1.3 2001/11/12 22:38:48 richard
149152
# bleah typo
150153
#

0 commit comments

Comments
 (0)