From 3ef9175c7e9af26c63be444c60c2d1c1c90e7d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= <sybren@stuvel.eu> Date: Thu, 10 Jan 2019 14:55:47 +0100 Subject: [PATCH] Windows compatibility fixes --- flamenco_worker/commands.py | 9 +++++++-- tests/abstract_worker_test.py | 21 ++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/flamenco_worker/commands.py b/flamenco_worker/commands.py index 4cd97d2b..588b0481 100644 --- a/flamenco_worker/commands.py +++ b/flamenco_worker/commands.py @@ -920,6 +920,10 @@ class MergeProgressiveRendersCommand(AbstractSubprocessCommand): if '"' in output: return 'Double quotes are not allowed in filenames: %r' % output + settings['input1'] = Path(input1).as_posix() + settings['input2'] = Path(input2).as_posix() + settings['output'] = Path(output).as_posix() + _, err = self._setting(settings, 'weight1', True, int) if err: return err @@ -937,7 +941,7 @@ class MergeProgressiveRendersCommand(AbstractSubprocessCommand): '--enable-autoexec', '-noaudio', '--background', - str(blendpath), + blendpath.as_posix(), ] # set up node properties and render settings. @@ -948,7 +952,7 @@ class MergeProgressiveRendersCommand(AbstractSubprocessCommand): tmppath = Path(tmpdir) assert tmppath.exists() - settings['tmpdir'] = tmpdir + settings['tmpdir'] = tmppath.as_posix() cmd += [ '--python-expr', MERGE_EXR_PYTHON % settings ] @@ -968,6 +972,7 @@ class MergeProgressiveRendersCommand(AbstractSubprocessCommand): self._log.info('Moving %s to %s', src, dst) + assert src.exists() assert src.is_file() assert not dst.exists() or dst.is_file() assert dst.exists() or dst.parent.exists() diff --git a/tests/abstract_worker_test.py b/tests/abstract_worker_test.py index 582a8a15..6eebb39f 100644 --- a/tests/abstract_worker_test.py +++ b/tests/abstract_worker_test.py @@ -1,28 +1,27 @@ +import logging +import os +import pathlib +import platform +import shutil import unittest class AbstractWorkerTest(unittest.TestCase): @classmethod def setUpClass(cls): - import logging - logging.basicConfig( level=logging.DEBUG, format='%(asctime)-15s %(levelname)8s %(name)s %(message)s', ) - def find_blender_cmd(self): - import os - import platform - + def find_blender_cmd(self) -> str: if platform.system() == 'Windows': blender = 'blender.exe' else: blender = 'blender' - for path in os.getenv('PATH').split(os.path.pathsep): - full_path = path + os.sep + blender - if os.path.exists(full_path): - return full_path + found = shutil.which(blender) + if found is None: + self.fail(f'Unable to find {blender!r} executable on $PATH') - self.fail('Unable to find "blender" executable on $PATH') + return pathlib.Path(found).as_posix() -- GitLab