Commit 85a09744 by Timothée Peignier

use concurrent.futures to be compatible with python3

parent d7021669
...@@ -4,7 +4,7 @@ import multiprocessing ...@@ -4,7 +4,7 @@ import multiprocessing
import os import os
import subprocess import subprocess
from multiprocessing.pool import ThreadPool 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
...@@ -20,7 +20,7 @@ class Compiler(object): ...@@ -20,7 +20,7 @@ class Compiler(object):
def __init__(self, storage=default_storage, verbose=False): def __init__(self, storage=default_storage, verbose=False):
self.storage = storage self.storage = storage
self.verbose = verbose self.verbose = verbose
self.pool = ThreadPool(processes=multiprocessing.cpu_count()) self.executor = futures.ThreadPoolExecutor(max_workers=multiprocessing.cpu_count())
@property @property
def compilers(self): def compilers(self):
...@@ -47,7 +47,7 @@ class Compiler(object): ...@@ -47,7 +47,7 @@ class Compiler(object):
return output_path return output_path
else: else:
return input_path return input_path
return self.pool.map(_compile, paths) return self.executor.map(_compile, paths)
def output_path(self, path, extension): def output_path(self, path, extension):
path = os.path.splitext(path) path = os.path.splitext(path)
......
...@@ -14,6 +14,10 @@ setup( ...@@ -14,6 +14,10 @@ setup(
license='MIT', license='MIT',
packages=find_packages(), packages=find_packages(),
zip_safe=False, zip_safe=False,
install_requires=[
'futures>=2.1.3',
'Django>=1.4.2'
],
include_package_data=True, include_package_data=True,
classifiers=[ classifiers=[
'Environment :: Web Environment', 'Environment :: Web Environment',
......
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