Skip to content

Commit

Permalink
Merge branch 'nopermissions'
Browse files Browse the repository at this point in the history
  • Loading branch information
gatl committed Jan 4, 2020
2 parents a9a1216 + 5912de9 commit 7fefef0
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions gogrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,23 +1368,26 @@ def cmd_import(src_dir, dest_dir, os_list, lang_list, skipextras, skipids, ids,
for f in file_list:
fname = os.path.basename(f)
info("calculating md5 for '%s'" % fname)
h = hashfile(f)
if h in md5_info:
title, fname = md5_info[h]
src_dir = os.path.join(dest_dir, title)
dest_file = os.path.join(src_dir, fname)
info('found a match! [%s] -> %s' % (h, fname))
if os.path.isfile(dest_file):
if h == hashfile(dest_file):
info('destination file already exists with the same md5 value. skipping copy.')
continue
info("copying to %s..." % dest_file)
if not os.path.isdir(src_dir):
os.makedirs(src_dir)
shutil.copy(f, dest_file)
if STORE_HASH:
with open(dest_file + '.md5', 'w') as hash_file:
hash_file.write(h)
try:
h = hashfile(f)
if h in md5_info:
title, fname = md5_info[h]
src_dir = os.path.join(dest_dir, title)
dest_file = os.path.join(src_dir, fname)
info('found a match! [%s] -> %s' % (h, fname))
if os.path.isfile(dest_file):
if h == hashfile(dest_file):
info('destination file already exists with the same md5 value. skipping copy.')
continue
info("copying to %s..." % dest_file)
if not os.path.isdir(src_dir):
os.makedirs(src_dir)
shutil.copy(f, dest_file)
if STORE_HASH:
with open(dest_file + '.md5', 'w') as hash_file:
hash_file.write(h)
except (PermissionError, OSError):
warn("could not read file '%s'. ignoring it." % f)


def cmd_download(savedir, skipextras, skipids, dryrun, ids, os_list, lang_list, skipgalaxy, skipstandalone, skipshared):
Expand Down

0 comments on commit 7fefef0

Please sign in to comment.