Try to install pyScss in setup.py if not available and don't fail hard if not available

This commit is contained in:
Fabio Manganiello 2019-12-02 00:15:46 +01:00
parent 346b1be924
commit 526136be36

View file

@ -3,6 +3,8 @@
import errno
import os
import re
import subprocess
import sys
import distutils.cmd
from distutils.command.build import build
from setuptools import setup, find_packages
@ -18,7 +20,18 @@ class WebBuildCommand(distutils.cmd.Command):
@classmethod
def generate_css_files(cls):
try:
from scss import Compiler
except ImportError:
print('pyScss not found, trying to install it')
cmd = [sys.executable, '-m', 'pip', 'install', 'pyScss']
try:
subprocess.call(cmd)
except Exception as e:
print(('pyScss install command failed: {}: {}. You will have to generate ' +
'the CSS files manually through python setup.py build install').format(' '.join(cmd), str(e)))
return
print('Building CSS files')
base_path = path(os.path.join('platypush','backend','http','static','css'))