[Kimchi-devel] [PATCH WOK 1/2] Add Fontawesome font as dependency and expose the .ttf file on server

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Thu Sep 17 19:33:44 UTC 2015


Reviewed-By: Paulo Vital <pvital at linux.vnet.ibm.com>

On Wed, 2015-09-16 at 12:42 -0300, Aline Manera wrote:
> All the font files will be exposed in /fonts URI
> 
> 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       | 21 +++++++++++++++++++++
>  4 files changed, 25 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 82a6c8b..bdc4db5 100644
> --- a/src/wok/config.py.in
> +++ b/src/wok/config.py.in
> @@ -27,6 +27,14 @@ __release__ = "@wokrelease@"
> 
>  DEFAULT_LOG_LEVEL = "debug"
> 
> +FONT_FILES = {'fontawesome': ['fontawesome-webfont.ttf']}
> +
> +FONTS_PATH = {
> +    'fontawesome':
> +        ['/usr/share/fonts/fontawesome',
> +         '/usr/share/fonts/truetype/font-awesome',
> +         '/usr/share/fonts/truetype']}
> +
> 
>  def get_object_store():
>      return os.path.join(paths.state_dir, 'objectstore')
> @@ -120,6 +128,19 @@ class UIConfig(dict):
>                  ui_configs['/' + sub_dir].update({
>                      'tools.expires.on': True,
>                      'tools.expires.secs': self.CACHEEXPIRES})
> +
> +        for font, files in FONT_FILES.iteritems():
> +            paths = FONTS_PATH[font]
> +            for path in paths:
> +                for filename in files:
> +                    font_file = os.path.join(path, filename)
> +                    if os.path.exists(font_file):
> +                        ui_configs['/fonts/%s' % filename] = {
> +                            'tools.staticfile.on': True,
> +                            'tools.staticfile.filename': font_file,
> +                            'tools.wokauth.on': False,
> +                            'tools.nocache.on': False}
> +
>          self.update(ui_configs)
> 
> 




More information about the Kimchi-devel mailing list