Commit 05c849f0 authored by Stefano Rivera's avatar Stefano Rivera Committed by SVN-Git Migration

Use Debian's figlet fonts.

 Look in /usr/share/figlet rather than using pkg_resources to find fonts.
Forwarded: not-needed
Last-Update: 2014-07-26

Patch-Name: font-location.diff
parent 95305858
......@@ -7,7 +7,7 @@ Python FIGlet adaption
from __future__ import print_function, unicode_literals
import pkg_resources
import os.path
import re
import sys
from optparse import OptionParser
......@@ -97,8 +97,8 @@ class FigletFont(object):
for extension in ('tlf', 'flf'):
fn = '%s.%s' % (font, extension)
if pkg_resources.resource_exists('pyfiglet.fonts', fn):
data = pkg_resources.resource_string('pyfiglet.fonts', fn)
if os.path.isfile(os.path.join('/usr/share/figlet', fn)):
data = open(os.path.join('/usr/share/figlet', fn), 'rb').read()
data = data.decode('UTF-8', 'replace')
return data
......@@ -108,7 +108,7 @@ class FigletFont(object):
def isValidFont(cls, font):
if not font.endswith(('.flf', '.tlf')):
return False
f = pkg_resources.resource_stream('pyfiglet.fonts', font)
f = open(os.path.join('/usr/share/figlet', font), 'rb')
header = f.readline().decode('UTF-8', 'replace')
......@@ -116,7 +116,7 @@ class FigletFont(object):
def getFonts(cls):
return [font.rsplit('.', 2)[0] for font
in pkg_resources.resource_listdir('pyfiglet', 'fonts')
in os.listdir('/usr/share/figlet')
if cls.isValidFont(font)]
......@@ -38,9 +38,9 @@ class Test(object):
def outputUsingFigletorToilet(self, text, font, fontpath):
if os.path.isfile(fontpath + '.flf'):
cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, text)
cmd = ('figlet', '-d', '/usr/share/figlet', '-f', font, text)
elif os.path.isfile(fontpath + '.tlf'):
cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, text)
cmd = ('toilet', '-d', '/usr/share/figlet', '-f', font, text)
raise Exception('Missing font file: '+fontpath)
......@@ -71,7 +71,7 @@ class Test(object):
def check_font(self, text, font):
if font in self.skip:
fontpath = os.path.join('pyfiglet', 'fonts', font)
fontpath = os.path.join('/usr/share/figlet', font)
......@@ -46,8 +46,7 @@ setup(
author='Peter Waller (Thanks to Christopher Jones and Stefano Rivera)',
packages=['pyfiglet', 'pyfiglet.fonts'],
package_data={'pyfiglet.fonts': ['*.flf']},
'console_scripts': [
'pyfiglet = pyfiglet:main',
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment