Commit 91f9f0fc authored by Ondřej Nový's avatar Ondřej Nový

Convert git repository from git-dpm to gbp layout

parent 153fbccc
# see git-dpm(1) from git-dpm package
1a34ea7f229fa51a9080f6d65deff962e001d4e3
1a34ea7f229fa51a9080f6d65deff962e001d4e3
95305858f135c1d42935beaa9003327a3f1d3fd1
95305858f135c1d42935beaa9003327a3f1d3fd1
pyfiglet_0.7.4+dfsg.orig.tar.gz
71164afd6eb5b98d2aea01378d98315c7edf2746
19196
debianTag="debian/%e%v"
patchedTag="patched/%e%v"
upstreamTag="upstream/%e%u"
......@@ -6,6 +6,7 @@ pyfiglet (0.7.4+dfsg-3) UNRELEASED; urgency=medium
* d/tests: Use AUTOPKGTEST_TMP instead of ADTTMP
* d/control: Remove ancient X-Python-Version field
* d/control: Remove ancient X-Python3-Version field
* Convert git repository from git-dpm to gbp layout
-- Ondřej Nový <novy@ondrej.org> Tue, 29 Mar 2016 21:49:18 +0200
......
......@@ -7,7 +7,7 @@ Python FIGlet adaption
from __future__ import print_function, unicode_literals
import os.path
import pkg_resources
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 os.path.isfile(os.path.join('/usr/share/figlet', fn)):
data = open(os.path.join('/usr/share/figlet', fn), 'rb').read()
if pkg_resources.resource_exists('pyfiglet.fonts', fn):
data = pkg_resources.resource_string('pyfiglet.fonts', fn)
data = data.decode('UTF-8', 'replace')
return data
else:
......@@ -108,7 +108,7 @@ class FigletFont(object):
def isValidFont(cls, font):
if not font.endswith(('.flf', '.tlf')):
return False
f = open(os.path.join('/usr/share/figlet', font), 'rb')
f = pkg_resources.resource_stream('pyfiglet.fonts', font)
header = f.readline().decode('UTF-8', 'replace')
f.close()
return cls.reMagicNumber.search(header)
......@@ -116,7 +116,7 @@ class FigletFont(object):
@classmethod
def getFonts(cls):
return [font.rsplit('.', 2)[0] for font
in os.listdir('/usr/share/figlet')
in pkg_resources.resource_listdir('pyfiglet', 'fonts')
if cls.isValidFont(font)]
@classmethod
......@@ -791,8 +791,7 @@ def main():
parser.print_help()
return 1
if sys.version_info < (3,):
args = [arg.decode('UTF-8') for arg in args]
args = map(lambda arg: arg.decode(sys.stdout.encoding), args)
text = ' '.join(args)
......
......@@ -34,15 +34,13 @@ class Test(object):
self.failed = []
self.oked = []
self.skip = ['runic','pyramid','eftifont'] # known bug..
self.skip += ['emboss', 'emboss2', 'future', 'letter', 'pagga',
'smblock', 'smbraille', 'wideterm']
self.f = Figlet()
def outputUsingFigletorToilet(self, text, font, fontpath):
if os.path.isfile(fontpath + '.flf'):
cmd = ('figlet', '-d', '/usr/share/figlet', '-f', font, text)
cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, text)
elif os.path.isfile(fontpath + '.tlf'):
cmd = ('toilet', '-d', '/usr/share/figlet', '-f', font, text)
cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, text)
else:
raise Exception('Missing font file: '+fontpath)
......@@ -73,7 +71,7 @@ class Test(object):
def check_font(self, text, font):
if font in self.skip:
return
fontpath = os.path.join('/usr/share/figlet', font)
fontpath = os.path.join('pyfiglet', 'fonts', font)
self.f.setFont(font=font)
......
......@@ -46,5 +46,11 @@ setup(
author='Peter Waller (Thanks to Christopher Jones and Stefano Rivera)',
author_email='peter.waller@gmail.com',
url='https://github.com/pwaller/pyfiglet',
packages=['pyfiglet'],
packages=['pyfiglet', 'pyfiglet.fonts'],
package_data={'pyfiglet.fonts': ['*.flf']},
entry_points={
'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