diff --git a/.gitignore b/.gitignore index 4173c1a83..79139bcb1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ authentic.egg-info local_settings.py log.log authentic2/locale/fr/LC_MESSAGES/django.mo +*.css +*.css.map local_settings.* *.egg-info *.mo diff --git a/MANIFEST.in b/MANIFEST.in index a19b3f34b..3dd23bde1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,9 +7,10 @@ recursive-exclude tests_rbac *.pyc include tox.ini .coveragerc # static -recursive-include src/authentic2/static *.css *.js *.ico *.gif *.png *.jpg -recursive-include src/authentic2/manager/static *.css *.js *.png -recursive-include src/authentic2_auth_fc/static/authentic2_auth_fc *.css *.js *.png *.svg +recursive-include src/authentic2/static *.css *.scss *.js *.ico *.gif *.png *.jpg +recursive-include src/authentic2/manager/static *.css *.scss *.js *.png +recursive-include src/authentic2_auth_fc/static/authentic2_auth_fc *.css *.scss *.js *.png *.svg +recursive-include src/authentic2_idp_oidc/static/authentic2_idp_oidc *.css *.scss *.js *.png *.svg # templates recursive-include src/authentic2/templates *.html *.txt *.xml diff --git a/debian/control b/debian/control index 0658c66f6..921700b11 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: python Priority: optional Maintainer: Benjamin Dauvergne Build-Depends-Indep: python3-all-dev -Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-django +Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-django, sassc Standards-Version: 3.9.6 Homepage: http://dev.entrouvert.org/projects/authentic/ diff --git a/setup.py b/setup.py index 6b66c4f70..f1c1ee2dd 100755 --- a/setup.py +++ b/setup.py @@ -10,6 +10,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 @@ -47,8 +49,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('src'): + 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 sdist(_sdist): @@ -166,6 +204,7 @@ setup( cmdclass={ 'build': build, 'install_lib': install_lib, + 'compile_scss': compile_scss, 'compile_translations': compile_translations, 'sdist': sdist, }, diff --git a/src/authentic2/manager/static/authentic2/manager/css/style.css b/src/authentic2/manager/static/authentic2/manager/css/style.scss similarity index 100% rename from src/authentic2/manager/static/authentic2/manager/css/style.css rename to src/authentic2/manager/static/authentic2/manager/css/style.scss diff --git a/src/authentic2/manager/static/authentic2/manager/css/user_import.css b/src/authentic2/manager/static/authentic2/manager/css/user_import.scss similarity index 100% rename from src/authentic2/manager/static/authentic2/manager/css/user_import.css rename to src/authentic2/manager/static/authentic2/manager/css/user_import.scss diff --git a/src/authentic2/static/authentic2/css/css-tabs.css b/src/authentic2/static/authentic2/css/css-tabs.scss similarity index 100% rename from src/authentic2/static/authentic2/css/css-tabs.css rename to src/authentic2/static/authentic2/css/css-tabs.scss diff --git a/src/authentic2/static/authentic2/css/password.css b/src/authentic2/static/authentic2/css/password.scss similarity index 100% rename from src/authentic2/static/authentic2/css/password.css rename to src/authentic2/static/authentic2/css/password.scss diff --git a/src/authentic2/static/authentic2/css/style.css b/src/authentic2/static/authentic2/css/style.scss similarity index 100% rename from src/authentic2/static/authentic2/css/style.css rename to src/authentic2/static/authentic2/css/style.scss diff --git a/src/authentic2/static/css/datetimepicker.css b/src/authentic2/static/css/datetimepicker.scss similarity index 100% rename from src/authentic2/static/css/datetimepicker.css rename to src/authentic2/static/css/datetimepicker.scss diff --git a/src/authentic2_auth_fc/static/authentic2_auth_fc/css/fc.css b/src/authentic2_auth_fc/static/authentic2_auth_fc/css/fc.scss similarity index 100% rename from src/authentic2_auth_fc/static/authentic2_auth_fc/css/fc.css rename to src/authentic2_auth_fc/static/authentic2_auth_fc/css/fc.scss diff --git a/src/authentic2_idp_oidc/static/authentic2_idp_oidc/css/style.css b/src/authentic2_idp_oidc/static/authentic2_idp_oidc/css/style.scss similarity index 100% rename from src/authentic2_idp_oidc/static/authentic2_idp_oidc/css/style.css rename to src/authentic2_idp_oidc/static/authentic2_idp_oidc/css/style.scss