Projet

Général

Profil

0001-misc-use-scss-for-all-css-files-62936.patch

Frédéric Péters, 27 mars 2022 20:13

Télécharger (7,54 ko)

Voir les différences:

Subject: [PATCH] misc: use scss for all css files (#62936)

 .gitignore                                    |  2 +
 MANIFEST.in                                   |  7 ++--
 debian/control                                |  2 +-
 setup.py                                      | 41 ++++++++++++++++++-
 .../manager/css/{style.css => style.scss}     |  0
 .../css/{user_import.css => user_import.scss} |  0
 .../css/{css-tabs.css => css-tabs.scss}       |  0
 .../css/{password.css => password.scss}       |  0
 .../authentic2/css/{style.css => style.scss}  |  0
 ...datetimepicker.css => datetimepicker.scss} |  0
 .../css/{fc.css => fc.scss}                   |  0
 .../css/{style.css => style.scss}             |  0
 12 files changed, 47 insertions(+), 5 deletions(-)
 rename src/authentic2/manager/static/authentic2/manager/css/{style.css => style.scss} (100%)
 rename src/authentic2/manager/static/authentic2/manager/css/{user_import.css => user_import.scss} (100%)
 rename src/authentic2/static/authentic2/css/{css-tabs.css => css-tabs.scss} (100%)
 rename src/authentic2/static/authentic2/css/{password.css => password.scss} (100%)
 rename src/authentic2/static/authentic2/css/{style.css => style.scss} (100%)
 rename src/authentic2/static/css/{datetimepicker.css => datetimepicker.scss} (100%)
 rename src/authentic2_auth_fc/static/authentic2_auth_fc/css/{fc.css => fc.scss} (100%)
 rename src/authentic2_idp_oidc/static/authentic2_idp_oidc/css/{style.css => style.scss} (100%)
.gitignore
11 11
local_settings.py
12 12
log.log
13 13
authentic2/locale/fr/LC_MESSAGES/django.mo
14
*.css
15
*.css.map
14 16
local_settings.*
15 17
*.egg-info
16 18
*.mo
MANIFEST.in
7 7
include tox.ini .coveragerc
8 8

  
9 9
# static
10
recursive-include src/authentic2/static *.css *.js *.ico *.gif *.png *.jpg
11
recursive-include src/authentic2/manager/static *.css *.js *.png
12
recursive-include src/authentic2_auth_fc/static/authentic2_auth_fc *.css *.js *.png *.svg
10
recursive-include src/authentic2/static *.css *.scss *.js *.ico *.gif *.png *.jpg
11
recursive-include src/authentic2/manager/static *.css *.scss *.js *.png
12
recursive-include src/authentic2_auth_fc/static/authentic2_auth_fc *.css *.scss *.js *.png *.svg
13
recursive-include src/authentic2_idp_oidc/static/authentic2_idp_oidc *.css *.scss *.js *.png *.svg
13 14

  
14 15
# templates
15 16
recursive-include src/authentic2/templates *.html *.txt *.xml
debian/control
3 3
Priority: optional
4 4
Maintainer: Benjamin Dauvergne <bdauvergne@entrouvert.com>
5 5
Build-Depends-Indep: python3-all-dev
6
Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-django
6
Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-django, sassc
7 7
Standards-Version: 3.9.6
8 8
Homepage: http://dev.entrouvert.org/projects/authentic/
9 9

  
setup.py
10 10
import sys
11 11
from distutils.cmd import Command
12 12
from distutils.command.build import build as _build
13
from distutils.errors import CompileError
14
from distutils.spawn import find_executable
13 15

  
14 16
from setuptools import find_packages, setup
15 17
from setuptools.command.install_lib import install_lib as _install_lib
......
47 49
            os.chdir(curdir)
48 50

  
49 51

  
52
class compile_scss(Command):
53
    description = 'compile scss files into css files'
54
    user_options = []
55

  
56
    def initialize_options(self):
57
        pass
58

  
59
    def finalize_options(self):
60
        pass
61

  
62
    def run(self):
63
        sass_bin = None
64
        for program in ('sassc', 'sass'):
65
            sass_bin = find_executable(program)
66
            if sass_bin:
67
                break
68
        if not sass_bin:
69
            raise CompileError(
70
                'A sass compiler is required but none was found.  See sass-lang.com for choices.'
71
            )
72

  
73
        for path, dirnames, filenames in os.walk('src'):
74
            for filename in filenames:
75
                if not filename.endswith('.scss'):
76
                    continue
77
                if filename.startswith('_'):
78
                    continue
79
                subprocess.check_call(
80
                    [
81
                        sass_bin,
82
                        '%s/%s' % (path, filename),
83
                        '%s/%s' % (path, filename.replace('.scss', '.css')),
84
                    ]
85
                )
86

  
87

  
50 88
class build(_build):
51
    sub_commands = [('compile_translations', None)] + _build.sub_commands
89
    sub_commands = [('compile_translations', None), ('compile_scss', None)] + _build.sub_commands
52 90

  
53 91

  
54 92
class sdist(_sdist):
......
166 204
    cmdclass={
167 205
        'build': build,
168 206
        'install_lib': install_lib,
207
        'compile_scss': compile_scss,
169 208
        'compile_translations': compile_translations,
170 209
        'sdist': sdist,
171 210
    },