Projet

Général

Profil

0001-build-switch-to-scss-41672.patch

Frédéric Péters, 14 avril 2020 13:21

Télécharger (4,3 ko)

Voir les différences:

Subject: [PATCH] build: switch to scss (#41672)

 .gitignore                                |  1 +
 MANIFEST.in                               |  2 +-
 debian/control                            |  2 +-
 hobo/static/css/{style.css => style.scss} |  0
 setup.py                                  | 43 ++++++++++++++++++++++-
 5 files changed, 45 insertions(+), 3 deletions(-)
 rename hobo/static/css/{style.css => style.scss} (100%)
.gitignore
6 6
django.mo
7 7
/hobo.egg-info
8 8
local_settings.py
9
*.css
MANIFEST.in
1
recursive-include hobo/static *.css *.png *.js
1
recursive-include hobo/static *.scss *.png *.js
2 2
recursive-include hobo/templates *.html *.txt
3 3
recursive-include hobo/debug/templates *.html *.txt
4 4
recursive-include hobo/franceconnect/templates *.html *.txt
debian/control
2 2
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
3 3
Section: python
4 4
Priority: optional
5
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
5
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
6 6
Standards-Version: 3.9.1
7 7

  
8 8
Package: python-hobo
setup.py
9 9

  
10 10
from setuptools.command.install_lib import install_lib as _install_lib
11 11
from distutils.command.build import build as _build
12
from distutils.errors import CompileError
13
from distutils.spawn import find_executable
12 14
from distutils.command.sdist import sdist
13 15
from distutils.cmd import Command
14 16
from setuptools import setup, find_packages
......
74 76
            sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
75 77

  
76 78

  
79
class compile_scss(Command):
80
    description = 'compile scss files into css files'
81
    user_options = []
82

  
83
    def initialize_options(self):
84
        pass
85

  
86
    def finalize_options(self):
87
        pass
88

  
89
    def run(self):
90
        sass_bin = None
91
        for program in ('sassc', 'sass'):
92
            sass_bin = find_executable(program)
93
            if sass_bin:
94
                break
95
        if not sass_bin:
96
            raise CompileError(
97
                'A sass compiler is required but none was found.  See sass-lang.com for choices.'
98
            )
99

  
100
        for package in self.distribution.packages:
101
            for package_path in ['hobo']:
102
                for path, dirnames, filenames in os.walk(package_path):
103
                    for filename in filenames:
104
                        if not filename.endswith('.scss'):
105
                            continue
106
                        if filename.startswith('_'):
107
                            continue
108
                        subprocess.check_call(
109
                            [
110
                                sass_bin,
111
                                '%s/%s' % (path, filename),
112
                                '%s/%s' % (path, filename.replace('.scss', '.css')),
113
                            ]
114
                        )
115

  
116

  
77 117
class build(_build):
78
    sub_commands = [('compile_translations', None)] + _build.sub_commands
118
    sub_commands = [('compile_translations', None), ('compile_scss', None)] + _build.sub_commands
79 119

  
80 120

  
81 121
class install_lib(_install_lib):
......
117 157
    zip_safe=False,
118 158
    cmdclass={
119 159
        'build': build,
160
        'compile_scss': compile_scss,
120 161
        'compile_translations': compile_translations,
121 162
        'install_lib': install_lib,
122 163
        'sdist': eo_sdist,
123
-