comparison fetch.py @ 48:bedef9761af9

finishing cpytree
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 15 Nov 2011 15:03:47 -0800
parents 72d461e2ccbd
children 45f7a0f80e6a
comparison
equal deleted inserted replaced
47:72d461e2ccbd 48:bedef9761af9
40 os.makedirs(dst) 40 os.makedirs(dst)
41 41
42 src = os.path.realpath(src) 42 src = os.path.realpath(src)
43 for dirpath, dirnames, filenames in os.walk(src): 43 for dirpath, dirnames, filenames in os.walk(src):
44 for d in dirnames: 44 for d in dirnames:
45 pass 45 path = os.path.join(dirpath, d)
46 _dst = os.path.join(dst, os.path.relpath(path, src)) # XXX depends on python 2.5 relpath
47 if os.path.exists(_dst):
48 assert os.path.isdir(_dst), "%s is a file, %s is a directory" % (src, dst)
49 else:
50 os.makedirs(_dst)
46 for f in filenames: 51 for f in filenames:
47 path = os.path.join(dirpath, f) 52 path = os.path.join(dirpath, f)
48 _dst = os.path.join(dst, os.path.relpath(path, src)) 53 _dst = os.path.join(dst, os.path.relpath(path, src)) # XXX depends on python 2.5 relpath
49 import pdb; pdb.set_trace() 54 shutil.copy2(path, _dst)
50 # shutil.copy2(path
51 import pdb; pdb.set_trace()
52 55
53 class Fetcher(object): 56 class Fetcher(object):
54 """abstract base class for resource fetchers""" 57 """abstract base class for resource fetchers"""
55 58
56 @classmethod 59 @classmethod