fixed some things with the tmpfile object.
This commit is contained in:
parent
67094fc415
commit
3d402e980a
|
@ -45,14 +45,13 @@ class TmpDir:
|
||||||
def __init__(self, srcDir):
|
def __init__(self, srcDir):
|
||||||
logging.debug('making tmp file')
|
logging.debug('making tmp file')
|
||||||
self.tmpDir = tempfile.TemporaryDirectory()
|
self.tmpDir = tempfile.TemporaryDirectory()
|
||||||
self.ignorePattern = shutil.ignore_patterns('*.adoc')
|
self.ignorePattern = shutil.ignore_patterns('*.adoc', '.git', '.gitignore')
|
||||||
shutil.copytree(srcDir, self.tmpDir, ignore = shutil.ignore_patterns('*.adoc'), symlinks=False)
|
shutil.copytree(srcDir, self.tmpDir, ignore = self.ignorePattern, symlinks=False)
|
||||||
|
|
||||||
def copy_self_to(self, destDir):
|
def copy_self_to(self, destDir):
|
||||||
shutil.copytree(self.tmpDir, destDir, symlinks=False)
|
shutil.copytree(self.tmpDir, destDir, symlinks=False)
|
||||||
|
|
||||||
def compress_and_copy_self_to(self, destPath):
|
def compress_and_copy_self_to(self, destPath):
|
||||||
tarFile=tarfile.open(name=Path(destPath).resolve, mode='x:gz', dereference=True)
|
|
||||||
tarFile = shutil.make_archive(Path(destPath).resolve(), 'gztar', self.tmpDir)
|
tarFile = shutil.make_archive(Path(destPath).resolve(), 'gztar', self.tmpDir)
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
|
Loading…
Reference in a new issue