This commit is contained in:
parent
577d0d5357
commit
6366631583
|
@ -1,5 +1,5 @@
|
|||
# static
|
||||
recursive-include scrutiny/static *.css *.js *.ico *.gif *.png *.jpg
|
||||
recursive-include scrutiny/static *.scss *.css *.js *.ico *.gif *.png *.jpg
|
||||
|
||||
# templates
|
||||
recursive-include scrutiny/templates *.html
|
||||
|
|
|
@ -6,6 +6,7 @@ Build-Depends: debhelper-compat (= 12),
|
|||
dh-python,
|
||||
python3-all,
|
||||
python3-setuptools,
|
||||
sassc,
|
||||
Standards-Version: 3.9.6
|
||||
|
||||
Package: python3-scrutiny
|
||||
|
|
48
setup.py
48
setup.py
|
@ -2,7 +2,11 @@
|
|||
|
||||
import os
|
||||
import subprocess
|
||||
from distutils.cmd import Command
|
||||
from distutils.command.build import build as _build
|
||||
from distutils.command.sdist import sdist
|
||||
from distutils.errors import CompileError
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
@ -47,6 +51,48 @@ def get_version():
|
|||
return '0.0'
|
||||
|
||||
|
||||
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 __import__(package).__path__:
|
||||
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):
|
||||
sub_commands = [('compile_scss', None)] + _build.sub_commands
|
||||
|
||||
|
||||
setup(
|
||||
name='scrutiny',
|
||||
version=get_version(),
|
||||
|
@ -63,6 +109,8 @@ setup(
|
|||
'gadjo',
|
||||
],
|
||||
cmdclass={
|
||||
'build': build,
|
||||
'compile_scss': compile_scss,
|
||||
'sdist': eo_sdist,
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue