From 6d5f6e04f297555be2242bc625a08c05eaec69ec Mon Sep 17 00:00:00 2001 From: gordon Date: Wed, 17 Sep 2014 13:52:47 -0400 Subject: [PATCH] shlex.quote/pipes.quote is not compatible with Windows --- compressor/filters/base.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/compressor/filters/base.py b/compressor/filters/base.py index fcc56ab..f46c35c 100644 --- a/compressor/filters/base.py +++ b/compressor/filters/base.py @@ -3,10 +3,18 @@ import io import logging import subprocess -try: - from shlex import quote as shell_quote # Python 3 -except ImportError: - from pipes import quote as shell_quote # Python 2 +from platform import system + +if system() != "Windows": + try: + from shlex import quote as shell_quote # Python 3 + except ImportError: + from pipes import quote as shell_quote # Python 2 +else: + from subprocess import list2cmdline + def shell_quote(s): + # shlex.quote/pipes.quote is not compatible with Windows + return list2cmdline([s]) from django.core.exceptions import ImproperlyConfigured from django.core.files.temp import NamedTemporaryFile