misc: switch style file to scss (#63229)
This commit is contained in:
parent
1f748deb73
commit
b3c74899bb
|
@ -11,3 +11,6 @@ passerelle.egg-info/
|
|||
.coverage
|
||||
coverage.xml
|
||||
junit-py*.xml
|
||||
.sass-cache/
|
||||
passerelle/static/css/style.css
|
||||
passerelle/static/css/style.css.map
|
||||
|
|
|
@ -6,6 +6,7 @@ Build-Depends: debhelper-compat (= 12),
|
|||
python3-django,
|
||||
python3-setuptools,
|
||||
python3-all,
|
||||
sassc,
|
||||
dh-python
|
||||
Standards-Version: 3.9.6
|
||||
Homepage: https://dev.entrouvert.org/projects/passerelle
|
||||
|
|
41
setup.py
41
setup.py
|
@ -5,6 +5,8 @@ import subprocess
|
|||
import sys
|
||||
from distutils.cmd import Command
|
||||
from distutils.command.build import build as _build
|
||||
from distutils.errors import CompileError
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools.command.install_lib import install_lib as _install_lib
|
||||
|
@ -77,8 +79,44 @@ class compile_translations(Command):
|
|||
os.chdir(curdir)
|
||||
|
||||
|
||||
class compile_scss(Command):
|
||||
description = 'compile scss files into css files'
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
sass_bin = None
|
||||
for program in ('sassc', 'sass'):
|
||||
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 path, dirnames, filenames in os.walk('passerelle'):
|
||||
for filename in filenames:
|
||||
if not filename.endswith('.scss'):
|
||||
continue
|
||||
if filename.startswith('_'):
|
||||
continue
|
||||
subprocess.check_call(
|
||||
[
|
||||
sass_bin,
|
||||
'%s/%s' % (path, filename),
|
||||
'%s/%s' % (path, filename.replace('.scss', '.css')),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class build(_build):
|
||||
sub_commands = [('compile_translations', None)] + _build.sub_commands
|
||||
sub_commands = [('compile_translations', None), ('compile_scss', None)] + _build.sub_commands
|
||||
|
||||
|
||||
class install_lib(_install_lib):
|
||||
|
@ -128,6 +166,7 @@ setup(
|
|||
],
|
||||
cmdclass={
|
||||
'build': build,
|
||||
'compile_scss': compile_scss,
|
||||
'compile_translations': compile_translations,
|
||||
'install_lib': install_lib,
|
||||
'sdist': eo_sdist,
|
||||
|
|
Loading…
Reference in New Issue