summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/task/build_less.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2014-02-28 08:49:38 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2014-02-28 08:49:38 -0300
commit2828399ba5cbb14502b023d4de1ba02f13dd5055 (patch)
tree38012b6bacaa508ca56fb6f4ba87b912bb54b8c9 /nikola/plugins/task/build_less.py
parentca94afc07df55cb7fc6fe3b4f3011877b7881195 (diff)
Imported Upstream version 6.3.0upstream/6.3.0
Diffstat (limited to 'nikola/plugins/task/build_less.py')
-rw-r--r--nikola/plugins/task/build_less.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/nikola/plugins/task/build_less.py b/nikola/plugins/task/build_less.py
index 8889cbe..14a53f9 100644
--- a/nikola/plugins/task/build_less.py
+++ b/nikola/plugins/task/build_less.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2013 Roberto Alsina and others.
+# Copyright © 2012-2014 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -29,6 +29,7 @@ from __future__ import unicode_literals
import codecs
import glob
import os
+import sys
import subprocess
from nikola.plugin_categories import Task
@@ -41,10 +42,10 @@ class BuildLess(Task):
name = "build_less"
sources_folder = "less"
sources_ext = ".less"
- compiler_name = "lessc"
def gen_tasks(self):
"""Generate CSS out of LESS sources."""
+ self.compiler_name = self.site.config['LESS_COMPILER']
kw = {
'cache_folder': self.site.config['CACHE_FOLDER'],
@@ -79,7 +80,13 @@ class BuildLess(Task):
def compile_target(target, dst):
utils.makedirs(dst_dir)
src = os.path.join(kw['cache_folder'], self.sources_folder, target)
- compiled = subprocess.check_output([self.compiler_name, src])
+ run_in_shell = sys.platform == 'win32'
+ try:
+ compiled = subprocess.check_output([self.compiler_name, src], shell=run_in_shell)
+ except OSError:
+ utils.req_missing([self.compiler_name],
+ 'build LESS files (and use this theme)',
+ False, False)
with open(dst, "wb+") as outf:
outf.write(compiled)