def compress(self, input_path): try: if os.path.abspath(input_path) == os.path.abspath(self.file_path): return gf.copytree(input_path, self.file_path) except Exception as exc: self.log_exc(u"Cannot compress unpacked", exc, True, OSError)
def test_copytree(self): orig = gf.tmp_directory() tmp_path = os.path.join(orig, "foo.bar") with io.open(tmp_path, "w", encoding="utf-8") as tmp_file: tmp_file.write(u"Foo bar") dest = gf.tmp_directory() gf.copytree(orig, dest) self.assertTrue(gf.file_exists(os.path.join(dest, "foo.bar"))) gf.delete_directory(dest) gf.delete_directory(orig)
def compress(self, input_path): if os.path.abspath(input_path) == os.path.abspath(self.file_path): return gf.copytree(input_path, self.file_path)
def decompress(self, output_path): if os.path.abspath(output_path) == os.path.abspath(self.file_path): return gf.copytree(self.file_path, output_path)