Mercurial > hg > fetch
changeset 48:bedef9761af9
finishing cpytree
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 15 Nov 2011 15:03:47 -0800 |
parents | 72d461e2ccbd |
children | 278f377026c6 |
files | fetch.py |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/fetch.py Tue Nov 15 15:00:10 2011 -0800 +++ b/fetch.py Tue Nov 15 15:03:47 2011 -0800 @@ -42,13 +42,16 @@ src = os.path.realpath(src) for dirpath, dirnames, filenames in os.walk(src): for d in dirnames: - pass + path = os.path.join(dirpath, d) + _dst = os.path.join(dst, os.path.relpath(path, src)) # XXX depends on python 2.5 relpath + if os.path.exists(_dst): + assert os.path.isdir(_dst), "%s is a file, %s is a directory" % (src, dst) + else: + os.makedirs(_dst) for f in filenames: path = os.path.join(dirpath, f) - _dst = os.path.join(dst, os.path.relpath(path, src)) - import pdb; pdb.set_trace() -# shutil.copy2(path - import pdb; pdb.set_trace() + _dst = os.path.join(dst, os.path.relpath(path, src)) # XXX depends on python 2.5 relpath + shutil.copy2(path, _dst) class Fetcher(object): """abstract base class for resource fetchers"""