0001-misc-use-scss-for-all-css-files-62936.patch
.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 |
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 |
}, |