[gnome-shell-extensions] classic: Pre-generate stylesheet
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] classic: Pre-generate stylesheet
- Date: Mon, 28 Dec 2020 23:46:27 +0000 (UTC)
commit 669e7c32a2cbc87b2818490beae0a2e25e799845
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Dec 29 00:18:47 2020 +0100
classic: Pre-generate stylesheet
We follow the rule of not putting generated files under version
control, but that means drawing in additional build-time dependencies.
We can reduce those when building from a released tarball by
generating the stylesheets at dist time though, so do that.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/150>
data/meson.build | 23 ++++++++++++++---------
meson.build | 4 +++-
meson/generate-stylesheets.py | 13 +++++++++++++
3 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 4a02931..27f4287 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -76,15 +76,20 @@ theme_data = [
'gnome-classic-high-contrast.css'
]
-style = 'gnome-classic'
-custom_target(style + '.css',
- input: style + '.scss',
- output: style + '.css',
- depend_files: theme_sources,
- command: [sassc, '-a', '@INPUT@', '@OUTPUT@'],
- install: true,
- install_dir: themedir
-)
+stylesheet = 'gnome-classic.css'
+if fs.exists(stylesheet)
+ install_data(stylesheet, install_dir: themedir)
+else
+ sassc = find_program('sassc', required: true)
+ custom_target(stylesheet,
+ input: fs.replace_suffix(stylesheet, '.scss'),
+ output: stylesheet,
+ depend_files: theme_sources,
+ command: [sassc, '-a', '@INPUT@', '@OUTPUT@'],
+ install: true,
+ install_dir: themedir
+ )
+endif
install_data(theme_data, install_dir: themedir)
diff --git a/meson.build b/meson.build
index 9e99d74..f1a4108 100644
--- a/meson.build
+++ b/meson.build
@@ -6,6 +6,7 @@ project('gnome-shell-extensions',
gettext_domain = meson.project_name()
+fs = import('fs')
gnome = import('gnome')
i18n = import('i18n')
@@ -86,9 +87,10 @@ foreach e : enabled_extensions
endforeach
if classic_mode_enabled
- sassc = find_program('sassc', required: true)
subdir('data')
endif
subdir('extensions')
subdir('po')
+
+meson.add_dist_script('meson/generate-stylesheets.py')
diff --git a/meson/generate-stylesheets.py b/meson/generate-stylesheets.py
new file mode 100644
index 0000000..6e402b6
--- /dev/null
+++ b/meson/generate-stylesheets.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+import os
+from pathlib import PurePath
+import subprocess
+
+sourceroot = os.environ.get('MESON_SOURCE_ROOT')
+distroot = os.environ.get('MESON_DIST_ROOT')
+
+stylesheet_path = PurePath('data/gnome-classic.css')
+src = PurePath(sourceroot, stylesheet_path.with_suffix('.scss'))
+dst = PurePath(distroot, stylesheet_path)
+subprocess.call(['sassc', '-a', src, dst])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]