Try to install pyScss in setup.py if not available and don't fail hard if not available
This commit is contained in:
parent
346b1be924
commit
526136be36
1 changed files with 14 additions and 1 deletions
13
setup.py
13
setup.py
|
@ -3,6 +3,8 @@
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
import distutils.cmd
|
import distutils.cmd
|
||||||
from distutils.command.build import build
|
from distutils.command.build import build
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
@ -18,7 +20,18 @@ class WebBuildCommand(distutils.cmd.Command):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def generate_css_files(cls):
|
def generate_css_files(cls):
|
||||||
|
try:
|
||||||
from scss import Compiler
|
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')
|
print('Building CSS files')
|
||||||
base_path = path(os.path.join('platypush','backend','http','static','css'))
|
base_path = path(os.path.join('platypush','backend','http','static','css'))
|
||||||
|
|
Loading…
Reference in a new issue