Mercurial > piecrust2
comparison piecrust/processing/less.py @ 17:de6a296744f7
The LESS compiler must be launched in a shell on Windows.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 18 Aug 2014 16:53:08 -0700 |
parents | 343d08ef5668 |
children | 1c13f3389fcb |
comparison
equal
deleted
inserted
replaced
16:3a13b43e77c1 | 17:de6a296744f7 |
---|---|
1 import os | 1 import os |
2 import os.path | 2 import os.path |
3 import json | 3 import json |
4 import hashlib | 4 import hashlib |
5 import logging | 5 import logging |
6 import platform | |
6 import subprocess | 7 import subprocess |
7 from piecrust.processing.base import SimpleFileProcessor | 8 from piecrust.processing.base import SimpleFileProcessor |
8 from piecrust.processing.tree import FORCE_BUILD | 9 from piecrust.processing.tree import FORCE_BUILD |
9 | 10 |
10 | 11 |
50 args = [self._conf['bin'], '--source-map=%s' % map_path] | 51 args = [self._conf['bin'], '--source-map=%s' % map_path] |
51 args += self._conf['options'] | 52 args += self._conf['options'] |
52 args.append(in_path) | 53 args.append(in_path) |
53 args.append(out_path) | 54 args.append(out_path) |
54 logger.debug("Processing LESS file: %s" % args) | 55 logger.debug("Processing LESS file: %s" % args) |
55 retcode = subprocess.call(args) | 56 |
57 # On Windows, we need to run the process in a shell environment | |
58 # otherwise it looks like `PATH` isn't taken into account. | |
59 shell=(platform.system() == 'Windows') | |
60 try: | |
61 retcode = subprocess.call(args, shell=shell) | |
62 except FileNotFoundError as ex: | |
63 logger.error("Tried running LESS processor with command: %s" % | |
64 args) | |
65 raise Exception("Error running LESS processor. " | |
66 "Did you install it?") from ex | |
56 if retcode != 0: | 67 if retcode != 0: |
57 raise Exception("Error occured in LESS compiler. Please check " | 68 raise Exception("Error occured in LESS compiler. Please check " |
58 "log messages above for more information.") | 69 "log messages above for more information.") |
59 return True | 70 return True |
60 | 71 |