aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-07-20 06:03:59 +0300
committerMykyta Holubakha <hilobakho@gmail.com>2017-07-20 06:03:59 +0300
commit353a2e82f5f81d00279ce4c087be4625966f7db6 (patch)
tree76f63e9fd2b22575053f188c9997b9238424c0ba /pomu/package.py
parentImplemented user changes integration (diff)
downloadpomu-353a2e82f5f81d00279ce4c087be4625966f7db6.tar.gz
pomu-353a2e82f5f81d00279ce4c087be4625966f7db6.tar.bz2
pomu-353a2e82f5f81d00279ce4c087be4625966f7db6.zip
Added bugz package source module
package: allow merging files using direct binary data stopped using a temporary file in the URL handler added utility helpers to extract URLs from text and parse numeric ranges
Diffstat (limited to 'pomu/package.py')
-rw-r--r--pomu/package.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/pomu/package.py b/pomu/package.py
index e0714dd..2651774 100644
--- a/pomu/package.py
+++ b/pomu/package.py
@@ -81,11 +81,15 @@ class Package():
def merge_into(self, dst):
"""Merges contents of the package into a specified directory (dst)"""
for trg, src in self.filemap.items():
- wd, _ = path.split(trg)
+ wd, filename = path.split(trg)
dest = path.join(dst, wd)
try:
makedirs(dest, exist_ok=True)
- copy2(src, dest)
+ if isinstance(src, bytes):
+ with open(path.join(dest, filename), 'wb') as f:
+ f.write(src)
+ else:
+ copy2(src, dest)
except PermissionError:
return Result.Err('You do not have enough permissions')
return Result.Ok().and_(self.apply_patches())