From 9b627d9a3013cc65191e467db74b6072f90c9979 Mon Sep 17 00:00:00 2001
From: Dan Callaghan <dcallagh@redhat.com>
Date: Tue, 6 Sep 2016 16:52:55 +1000
Subject: [PATCH 5/6] Fix sass filter to change directory as needed
Currently the cwd argument to _apply_sass is being ignored, this was
accidentally dropped in refactoring in commit fbe1b8b.
Restore the previous behaviour by adding a cwd argument for the
ExternalTool#subprocess method.
Fixes #466.
---
src/webassets/filter/__init__.py | 5 ++++-
src/webassets/filter/sass.py | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/webassets/filter/__init__.py b/src/webassets/filter/__init__.py
index f3797b6..80b10be 100644
--- a/src/webassets/filter/__init__.py
+++ b/src/webassets/filter/__init__.py
@@ -456,11 +456,13 @@ def replace(arg):
self.subprocess(argv, out, data=data)
@classmethod
- def subprocess(cls, argv, out, data=None):
+ def subprocess(cls, argv, out, data=None, cwd=None):
"""Execute the commandline given by the list in ``argv``.
If a byestring is given via ``data``, it is piped into data.
+ If ``cwd`` is not None, the process will be executed in that directory.
+
``argv`` may contain two placeholders:
``{input}``
@@ -511,6 +513,7 @@ def created(self):
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
+ cwd=cwd,
shell=os.name == 'nt')
except OSError:
raise FilterError('Program file not found: %s.' % argv[0])
diff --git a/src/webassets/filter/sass.py b/src/webassets/filter/sass.py
index 68f6920..3dd45f5 100644
--- a/src/webassets/filter/sass.py
+++ b/src/webassets/filter/sass.py
@@ -187,7 +187,7 @@ def _apply_sass(self, _in, out, cd=None):
abs_path = self.resolve_path(lib)
args.extend(['-r', abs_path])
- return self.subprocess(args, out, _in)
+ return self.subprocess(args, out, _in, cwd=child_cwd)
def input(self, _in, out, source_path, output_path, **kw):
if self.as_output:
--
2.7.4