File: compile_jupyter_less.py

package info (click to toggle)
python-msmb-theme 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 428 kB
  • sloc: python: 1,295; javascript: 17; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 707 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import subprocess
import os

os.chdir("notebook")

# Check for clean submodule
unclean = "Please clean up your `notebook/` submodule!"
gitout = subprocess.check_output(['git', 'clean', '-ndx'])
if gitout == b'Would remove notebook/static/components/\n':
    pass
elif gitout == b'':
    subprocess.check_call([
        'npm', 'install', '-g', 'bower', 'less', 'less-plugin-clean-css'
    ])
    subprocess.check_call(['bower', 'install'])
else:
    print(gitout)
    raise RuntimeError(unclean)

print("Calling lessc")
subprocess.check_call([
    'lessc',
    '--clean-css',
    '--include-path="./notebook/static"',
    'notebook/static/style/style.less',
    '../msmb_theme/static/css/jupyter.min.css'
])