Commit df1b9dd9 by Timothée Peignier

import some modules later to be able to run on GAE

parent cf113963
from __future__ import unicode_literals from __future__ import unicode_literals
import multiprocessing
import os import os
import subprocess
from concurrent import futures
from django.contrib.staticfiles import finders from django.contrib.staticfiles import finders
from django.core.files.base import ContentFile from django.core.files.base import ContentFile
...@@ -26,6 +22,8 @@ class Compiler(object): ...@@ -26,6 +22,8 @@ class Compiler(object):
return [to_class(compiler) for compiler in settings.PIPELINE_COMPILERS] return [to_class(compiler) for compiler in settings.PIPELINE_COMPILERS]
def compile(self, paths, force=False): def compile(self, paths, force=False):
import multiprocessing
from concurrent import futures
def _compile(input_path): def _compile(input_path):
for compiler in self.compilers: for compiler in self.compilers:
compiler = compiler(verbose=self.verbose, storage=self.storage) compiler = compiler(verbose=self.verbose, storage=self.storage)
...@@ -83,6 +81,7 @@ class CompilerBase(object): ...@@ -83,6 +81,7 @@ class CompilerBase(object):
class SubProcessCompiler(CompilerBase): class SubProcessCompiler(CompilerBase):
def execute_command(self, command, content=None, cwd=None): def execute_command(self, command, content=None, cwd=None):
import subprocess
pipe = subprocess.Popen(command, shell=True, cwd=cwd, pipe = subprocess.Popen(command, shell=True, cwd=cwd,
stdout=subprocess.PIPE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
......
...@@ -4,7 +4,6 @@ import base64 ...@@ -4,7 +4,6 @@ import base64
import os import os
import posixpath import posixpath
import re import re
import subprocess
from itertools import takewhile from itertools import takewhile
...@@ -227,6 +226,7 @@ class CompressorBase(object): ...@@ -227,6 +226,7 @@ class CompressorBase(object):
class SubProcessCompressor(CompressorBase): class SubProcessCompressor(CompressorBase):
def execute_command(self, command, content): def execute_command(self, command, content):
import subprocess
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)
if content: if 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