[Kimchi-devel] [PATCH WOK] Add fontawesome-fonts as dependency and expose .ttf file on web server

Aline Manera alinefm at linux.vnet.ibm.com
Fri Sep 11 18:30:50 UTC 2015


Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 contrib/DEBIAN/control.in  |  3 ++-
 contrib/wok.spec.fedora.in |  1 +
 contrib/wok.spec.suse.in   |  1 +
 src/wok/config.py.in       | 19 +++++++++++++++++++
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in
index ef4e0c2..5d65bd0 100644
--- a/contrib/DEBIAN/control.in
+++ b/contrib/DEBIAN/control.in
@@ -15,7 +15,8 @@ Depends: python-cherrypy3 (>= 3.2.0),
          python-lxml,
          nginx,
          python-ldap,
-         spice-html5
+         spice-html5,
+         fonts-font-awesome
 Build-Depends: libxslt,
                openssl,
                python-lxml
diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in
index 30319a9..e82f946 100644
--- a/contrib/wok.spec.fedora.in
+++ b/contrib/wok.spec.fedora.in
@@ -19,6 +19,7 @@ Requires:	python-jsonschema >= 1.3.0
 Requires:	python-lxml
 Requires:	nginx
 Requires:	python-ldap
+Requires:	fontawesome-fonts
 BuildRequires:	libxslt
 BuildRequires:	openssl
 BuildRequires:	python-lxml
diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in
index 63bdce3..0e9117e 100644
--- a/contrib/wok.spec.suse.in
+++ b/contrib/wok.spec.suse.in
@@ -20,6 +20,7 @@ Requires:	python-ldap
 Requires:	python-lxml
 Requires:	python-xml
 Requires:	nginx
+Requires:	fontawesome-fonts
 BuildRequires:	libxslt-tools
 BuildRequires:	openssl
 BuildRequires:	python-lxml
diff --git a/src/wok/config.py.in b/src/wok/config.py.in
index 08da028..6b8951d 100644
--- a/src/wok/config.py.in
+++ b/src/wok/config.py.in
@@ -60,6 +60,18 @@ class Paths(object):
             self.plugins_dir = self.add_prefix('plugins')
             self.mo_dir = self.add_prefix('mo')
 
+        self.fontawesome_file = None
+        for path in ['/usr/share/fonts/fontawesome',
+                     '/usr/share/fonts/truetype/font-awesome',
+                     '/usr/share/fonts/truetype']:
+            if os.path.exists(path):
+                self.fontawesome_file = os.path.join(path,
+                                                     'fontawesome-webfont.ttf')
+                break
+
+        if self.fontawesome_file is None:
+            raise Exception("Font Awesome is not installed.")
+
     def get_prefix(self):
         if __file__.startswith("/"):
             base = os.path.dirname(__file__)
@@ -120,6 +132,13 @@ class UIConfig(dict):
                 ui_configs['/' + sub_dir].update({
                     'tools.expires.on': True,
                     'tools.expires.secs': self.CACHEEXPIRES})
+
+        ui_configs['/fontawesome/font/fontawesome-webfont.ttf'] = {
+            'tools.staticfile.on': True,
+            'tools.staticfile.filename': paths.fontawesome_file,
+            'tools.wokauth.on': False,
+            'tools.nocache.on': False}
+
         self.update(ui_configs)
 
 
-- 
2.1.0




More information about the Kimchi-devel mailing list