build: switch to scss (#41672)
This commit is contained in:
parent
8a727ac703
commit
12e5181347
|
@ -6,3 +6,4 @@ db.sqlite3
|
||||||
django.mo
|
django.mo
|
||||||
/hobo.egg-info
|
/hobo.egg-info
|
||||||
local_settings.py
|
local_settings.py
|
||||||
|
*.css
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
recursive-include hobo/static *.css *.png *.js
|
recursive-include hobo/static *.scss *.png *.js
|
||||||
recursive-include hobo/templates *.html *.txt
|
recursive-include hobo/templates *.html *.txt
|
||||||
recursive-include hobo/debug/templates *.html *.txt
|
recursive-include hobo/debug/templates *.html *.txt
|
||||||
recursive-include hobo/franceconnect/templates *.html *.txt
|
recursive-include hobo/franceconnect/templates *.html *.txt
|
||||||
|
|
|
@ -2,7 +2,7 @@ Source: hobo
|
||||||
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
|
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
|
||||||
Section: python
|
Section: python
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), python3-setuptools, python3-all, python-django, python3-django, debhelper (>= 9), dh-python, dh-systemd
|
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), python3-setuptools, python3-all, python-django, python3-django, debhelper (>= 9), dh-python, dh-systemd, sassc
|
||||||
Standards-Version: 3.9.1
|
Standards-Version: 3.9.1
|
||||||
|
|
||||||
Package: python-hobo
|
Package: python-hobo
|
||||||
|
|
43
setup.py
43
setup.py
|
@ -9,6 +9,8 @@ import sys
|
||||||
|
|
||||||
from setuptools.command.install_lib import install_lib as _install_lib
|
from setuptools.command.install_lib import install_lib as _install_lib
|
||||||
from distutils.command.build import build as _build
|
from distutils.command.build import build as _build
|
||||||
|
from distutils.errors import CompileError
|
||||||
|
from distutils.spawn import find_executable
|
||||||
from distutils.command.sdist import sdist
|
from distutils.command.sdist import sdist
|
||||||
from distutils.cmd import Command
|
from distutils.cmd import Command
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
@ -74,8 +76,46 @@ class compile_translations(Command):
|
||||||
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
|
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
|
||||||
|
|
||||||
|
|
||||||
|
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 package in self.distribution.packages:
|
||||||
|
for package_path in ['hobo']:
|
||||||
|
for path, dirnames, filenames in os.walk(package_path):
|
||||||
|
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):
|
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):
|
class install_lib(_install_lib):
|
||||||
|
@ -117,6 +157,7 @@ setup(
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
cmdclass={
|
cmdclass={
|
||||||
'build': build,
|
'build': build,
|
||||||
|
'compile_scss': compile_scss,
|
||||||
'compile_translations': compile_translations,
|
'compile_translations': compile_translations,
|
||||||
'install_lib': install_lib,
|
'install_lib': install_lib,
|
||||||
'sdist': eo_sdist,
|
'sdist': eo_sdist,
|
||||||
|
|
Loading…
Reference in New Issue