setup: add support for sassc sass compiler (#13515)
This commit is contained in:
parent
8bf9dc3b3b
commit
59ac6e68b8
14
setup.py
14
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):
|
||||
|
|
Loading…
Reference in New Issue