Adding binary support to the embed rule.
This commit is contained in:
parent
ec2fa7efcc
commit
4d216b57f0
|
@ -336,12 +336,14 @@ class _EmbedFilesRuleTask(Task):
|
||||||
def execute(self):
|
def execute(self):
|
||||||
with io.open(self.output_path, 'wt') as out_file:
|
with io.open(self.output_path, 'wt') as out_file:
|
||||||
for src_path in self.src_paths:
|
for src_path in self.src_paths:
|
||||||
with io.open(src_path, 'rt') as in_file:
|
with io.open(src_path, 'rb') as in_file:
|
||||||
raw_str = in_file.read()
|
raw_str = in_file.read()
|
||||||
|
|
||||||
encoded_str = raw_str
|
encoded_str = raw_str
|
||||||
if self.encoding == 'base64':
|
if self.encoding == 'base64':
|
||||||
encoded_str = unicode(base64.b64encode(encoded_str))
|
encoded_str = unicode(base64.b64encode(encoded_str))
|
||||||
|
else:
|
||||||
|
encoded_str = unicode(raw_str)
|
||||||
|
|
||||||
replaced_str = encoded_str
|
replaced_str = encoded_str
|
||||||
for pair in self.replace_chars:
|
for pair in self.replace_chars:
|
||||||
|
|
Loading…
Reference in New Issue