os.chmod(cls.CACHE_DIR, 0o700)
def __init__(self, file_spec):
- try:
- self.cache_file = open(file_spec, 'a+')
- except TypeError:
- file_spec = self.make_path(file_spec)
- self.cache_file = open(file_spec, 'a+')
+ self.cache_file = open(file_spec, 'a+')
self._lock_file(self.cache_file)
self.filename = self.cache_file.name
else:
return writer
+ def preresume_hook(self):
+ print >>sys.stderr, "arv-put: Resuming previous upload. Bypass with the --no-resume option."
+
def checkpoint_state(self):
if self.cache is None:
return
def human_progress(bytes_written, bytes_expected):
if bytes_expected:
- return "\r{}M / {}M {:.1f}% ".format(
+ return "\r{}M / {}M {:.1%} ".format(
bytes_written >> 20, bytes_expected >> 20,
- bytes_written / bytes_expected)
+ float(bytes_written) / bytes_expected)
else:
return "\r{} ".format(bytes_written)
reporter = None
try:
- resume_cache = ResumeCache(args)
+ resume_cache = ResumeCache(ResumeCache.make_path(args))
if not args.resume:
resume_cache.restart()
except ResumeCacheConflict: