diff --git a/setup.py b/setup.py index 9f67b4d..ecc0639 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,8 @@ import tempfile import xml.etree.ElementTree as ET from distutils.cmd import Command +from distutils.errors import CompileError +from distutils.spawn import find_executable from setuptools.command.install_lib import install_lib as _install_lib from distutils.command.build import build as _build from distutils.command.sdist import sdist @@ -87,6 +89,14 @@ class compile_scss(Command): pass def run(self): + sass_bin = None + for program in ('sass', 'sassc'): + sass_bin = find_executable(program) + if sass_bin: + break + if not sass_bin: + raise CompileError('A sass compiler is required but none was found. See sass-lang.com for choices.') + for package in self.distribution.packages: for package_path in __import__(package).__path__: for path, dirnames, filenames in os.walk(package_path): @@ -95,8 +105,8 @@ class compile_scss(Command): continue if filename.startswith('_'): continue - subprocess.check_call(['sass', '%s/%s:%s/%s' % ( - path, filename, path, filename.replace('.scss', '.css'))]) + subprocess.check_call([sass_bin, '%s/%s' % (path, filename), + '%s/%s' % (path, filename.replace('.scss', '.css'))]) class build_icons(Command):