Commit fee90f9b by Timothée Peignier

searching for find the real culprit, while releasing too fast

parent 57b17ba2
...@@ -36,13 +36,13 @@ class Compiler(object): ...@@ -36,13 +36,13 @@ class Compiler(object):
def read_file(self, path): def read_file(self, path):
file = storage.open(path, 'rb') file = storage.open(path, 'rb')
content = file.read().decode('utf-8') content = file.read()
file.close() file.close()
return content return content
def save_file(self, path, content): def save_file(self, path, content):
file = storage.open(path, 'wb') file = storage.open(path, 'wb')
file.write(content.encode('utf-8')) file.write(content)
file.close() file.close()
...@@ -58,7 +58,7 @@ class CompilerBase(object): ...@@ -58,7 +58,7 @@ class CompilerBase(object):
def save_file(self, path, content): def save_file(self, path, content):
file = storage.open(path, 'wb') file = storage.open(path, 'wb')
file.write(content.encode('utf-8')) file.write(content)
file.close() file.close()
return path return path
...@@ -71,10 +71,10 @@ class SubProcessCompiler(CompilerBase): ...@@ -71,10 +71,10 @@ class SubProcessCompiler(CompilerBase):
def execute_command(self, command, content): def execute_command(self, command, content):
pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE) stdin=subprocess.PIPE, stderr=subprocess.PIPE)
pipe.stdin.write(content.encode('utf-8')) pipe.stdin.write(content)
pipe.stdin.close() pipe.stdin.close()
compressed_content = pipe.stdout.read().decode('utf-8') compressed_content = pipe.stdout.read()
pipe.stdout.close() pipe.stdout.close()
error = pipe.stderr.read() error = pipe.stderr.read()
......
...@@ -13,7 +13,7 @@ class LessCompiler(CompilerBase): ...@@ -13,7 +13,7 @@ class LessCompiler(CompilerBase):
def compile_file(self, content): def compile_file(self, content):
tmp_file = tempfile.NamedTemporaryFile(mode='w+b') tmp_file = tempfile.NamedTemporaryFile(mode='w+b')
tmp_file.write(content.encode('utf-8')) tmp_file.write(content)
tmp_file.flush() tmp_file.flush()
output_file = tempfile.NamedTemporaryFile(mode='w+b') output_file = tempfile.NamedTemporaryFile(mode='w+b')
...@@ -25,7 +25,7 @@ class LessCompiler(CompilerBase): ...@@ -25,7 +25,7 @@ class LessCompiler(CompilerBase):
command_output = os.popen(command).read() command_output = os.popen(command).read()
compiled_content = output_file.read().decode('utf-8') compiled_content = output_file.read()
output_file.close() output_file.close()
tmp_file.close() tmp_file.close()
......
...@@ -197,7 +197,7 @@ class Compressor(object): ...@@ -197,7 +197,7 @@ class Compressor(object):
def read_file(self, path): def read_file(self, path):
"""Read file content in binary mode""" """Read file content in binary mode"""
file = storage.open(path, 'rb') file = storage.open(path, 'rb')
content = file.read().decode('utf-8') content = file.read()
file.close() file.close()
return content return content
...@@ -222,10 +222,10 @@ class SubProcessCompressor(CompressorBase): ...@@ -222,10 +222,10 @@ class SubProcessCompressor(CompressorBase):
def execute_command(self, command, content): def execute_command(self, command, content):
pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE) stdin=subprocess.PIPE, stderr=subprocess.PIPE)
pipe.stdin.write(content.encode('utf-8')) pipe.stdin.write(content)
pipe.stdin.close() pipe.stdin.close()
compressed_content = pipe.stdout.read().decode('utf-8') compressed_content = pipe.stdout.read()
pipe.stdout.close() pipe.stdout.close()
error = pipe.stderr.read() error = pipe.stderr.read()
......
...@@ -11,7 +11,7 @@ warnings.simplefilter('ignore', RuntimeWarning) ...@@ -11,7 +11,7 @@ warnings.simplefilter('ignore', RuntimeWarning)
class CSSTidyCompressor(CompressorBase): class CSSTidyCompressor(CompressorBase):
def compress_css(self, css): def compress_css(self, css):
tmp_file = tempfile.NamedTemporaryFile(mode='w+b') tmp_file = tempfile.NamedTemporaryFile(mode='w+b')
tmp_file.write(css.encode('utf-8')) tmp_file.write(css)
tmp_file.flush() tmp_file.flush()
output_file = tempfile.NamedTemporaryFile(mode='w+b') output_file = tempfile.NamedTemporaryFile(mode='w+b')
...@@ -23,7 +23,7 @@ class CSSTidyCompressor(CompressorBase): ...@@ -23,7 +23,7 @@ class CSSTidyCompressor(CompressorBase):
command_output = os.popen(command).read() command_output = os.popen(command).read()
filtered_css = output_file.read().decode('utf-8') filtered_css = output_file.read()
output_file.close() output_file.close()
tmp_file.close() tmp_file.close()
......
...@@ -73,7 +73,7 @@ class Packager(object): ...@@ -73,7 +73,7 @@ class Packager(object):
def save_file(self, path, content): def save_file(self, path, content):
file = storage.open(path, 'wb') file = storage.open(path, 'wb')
file.write(content.encode('utf-8')) file.write(content)
file.close() file.close()
return path return path
...@@ -90,7 +90,7 @@ class Packager(object): ...@@ -90,7 +90,7 @@ class Packager(object):
for pattern in config[name]['source_filenames']: for pattern in config[name]['source_filenames']:
for path in glob(pattern): for path in glob(pattern):
if not path in paths: if not path in paths:
paths.append(path) paths.append(str(path))
packages[name]['paths'] = [path for path in paths if not path.endswith(settings.PIPELINE_TEMPLATE_EXT)] packages[name]['paths'] = [path for path in paths if not path.endswith(settings.PIPELINE_TEMPLATE_EXT)]
packages[name]['templates'] = [path for path in paths if path.endswith(settings.PIPELINE_TEMPLATE_EXT)] packages[name]['templates'] = [path for path in paths if path.endswith(settings.PIPELINE_TEMPLATE_EXT)]
packages[name]['output'] = config[name]['output_filename'] packages[name]['output'] = config[name]['output_filename']
......
...@@ -29,7 +29,7 @@ class HashVersioningBase(VersioningBase): ...@@ -29,7 +29,7 @@ class HashVersioningBase(VersioningBase):
def read_file(self, path): def read_file(self, path):
"""Read file content in binary mode""" """Read file content in binary mode"""
file = storage.open(path, 'rb') file = storage.open(path, 'rb')
content = file.read().decode('utf-8') content = file.read()
file.close() file.close()
return content return content
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment