Commit 9305f9de authored by Stefano Rivera's avatar Stefano Rivera

Imported Debian patch 0.7.4+dfsg-1

......@@ -7,6 +7,9 @@ python:
- "3.4"
- "pypy"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq toilet figlet
script: PYTHONPATH=. python pyfiglet/test.py
- "sudo apt-get update -qq"
- "sudo apt-get install -qq toilet figlet"
install:
- "pip install -r requirements.txt || true"
- "pip install ."
script: python pyfiglet/test.py
......@@ -60,19 +60,6 @@ USAGE
print f.renderText('text to render')
pyfiglet also supports reading fonts from a zip archive. pyfiglet
comes with a file called fonts.zip which includes all of the default
fonts FIGlet comes with as well as the standard collection of user-
contributed fonts. By default, pyfiglet uses this for fonts. Specifying
a directory (on the commandline or in the Figlet() object) will override
this behavior. You may also specify a zipfile to use with -z or zipfile=PATH
in the Figlet() constructor.
If you wish to add/remove fonts or create your own font package, be aware
that there *must* be a folder in the root of the zipfile called "fonts". You
can examine the bunlded fonts.zip to see how it should be packaged.
AUTHOR
pyfiglet is a *port* of FIGlet, and much of the code is directly translated
......@@ -113,6 +100,14 @@ LICENSE
CHANGELOG
2015-05-27 0.7.4
#43 Don't leak file handles
2015-04-14 0.7.3
#41 Add newline and text wrapping support
2014-09-14 0.7.2
#35 Add this CHANGELOG
......
pyfiglet (0.7.4+dfsg-1) unstable; urgency=medium
* New upstream release.
* Refresh patches.
* debian/watch:
- Switch to dversionmangle and repacksuffix, now that it exists.
- Switch from the deprecated githubredir.d.n to github's tag view.
* figlet is now free, and in main:
- Drop patch debian-defaults.
- Build-Depend on figlet, for tests.
- Recommend figlet, as well as toilet-fonts.
* Patch bad-toilet-fonts: The test suite upstream has got stricter, but
fails on some toilet fonts. Skip them.
* Drop XS-Testsuite field, now unnecessary.
* Bump copyright years.
-- Stefano Rivera <stefanor@debian.org> Fri, 03 Jul 2015 21:25:36 -0700
pyfiglet (0.7.2+dfsg-1) unstable; urgency=medium
* New upstream bugfix release.
......
......@@ -6,6 +6,7 @@ Uploaders: Stefano Rivera <stefanor@debian.org>
Build-Depends:
debhelper (>= 8.1),
dh-python,
figlet,
python-all (>= 2.6),
python-setuptools,
python3-all,
......@@ -13,7 +14,6 @@ Build-Depends:
toilet
X-Python-Version: >= 2.6
X-Python3-Version: >= 3.1
XS-Testsuite: autopkgtest
Standards-Version: 3.9.6
Homepage: https://github.com/pwaller/pyfiglet
Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/pyfiglet/trunk/
......@@ -22,8 +22,7 @@ Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/pyfiglet/t
Package: python-pyfiglet
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}
Recommends: toilet-fonts
Suggests: figlet
Recommends: figlet, toilet-fonts
Description: Python port of the FIGlet specification
FIGLet is a program that creates large characters out of ordinary screen
characters. It takes ASCII text and renders it in ASCII art fonts.
......@@ -34,8 +33,7 @@ Description: Python port of the FIGlet specification
Package: python3-pyfiglet
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}
Recommends: toilet-fonts
Suggests: figlet
Recommends: figlet, toilet-fonts
Breaks: python-pyfiglet (<< 0.7.1)
Replaces: python-pyfiglet (<< 0.7.1)
Description: Python 3 port of the FIGlet specification
......
......@@ -19,12 +19,12 @@ Comment:
Files: *
Copyright: 2007, Christopher Jones <cjones@gmail.com>,
2011-2014, Peter Waller <peter.waller@gmail.com>,
2011-2014, Stefano Rivera <stefanor@debian.org>
2011-2015, Peter Waller <peter.waller@gmail.com>,
2011-2015, Stefano Rivera <stefanor@debian.org>
License: GPL-2+
Files: debian/*
Copyright: 2010-2014, Stefano Rivera <stefanor@debian.org>
Copyright: 2010-2015, Stefano Rivera <stefanor@debian.org>
License: GPL-2+
License: GPL-2+
......
Description: Skip some toilet fonts from the test suite.
They don't all pass, beacuse pyfiglet doesn't have perfect .tlf handling yet.
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: https://github.com/pwaller/pyfiglet/pull/44
Last-Updated: 2015-07-03
--- a/pyfiglet/test.py
+++ b/pyfiglet/test.py
@@ -34,6 +34,8 @@
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):
......@@ -6,7 +6,7 @@ Last-Update: 2011-05-29
--- a/pyfiglet/__init__.py
+++ b/pyfiglet/__init__.py
@@ -35,7 +35,7 @@
@@ -36,7 +36,7 @@
"""
......
......@@ -6,7 +6,7 @@ Last-Update: 2014-07-26
--- a/pyfiglet/__init__.py
+++ b/pyfiglet/__init__.py
@@ -6,7 +6,7 @@
@@ -7,7 +7,7 @@
from __future__ import print_function, unicode_literals
......@@ -15,7 +15,7 @@ Last-Update: 2014-07-26
import re
import sys
from optparse import OptionParser
@@ -92,8 +92,8 @@
@@ -97,8 +97,8 @@
"""
for extension in ('tlf', 'flf'):
fn = '%s.%s' % (font, extension)
......@@ -26,15 +26,16 @@ Last-Update: 2014-07-26
data = data.decode('UTF-8', 'replace')
return data
else:
@@ -103,14 +103,14 @@
@@ -108,7 +108,7 @@
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')
f.close()
return cls.reMagicNumber.search(header)
@@ -116,7 +116,7 @@
@classmethod
def getFonts(cls):
return [font.rsplit('.', 2)[0] for font
......@@ -57,18 +58,24 @@ Last-Update: 2014-07-26
'pyfiglet = pyfiglet:main',
--- a/pyfiglet/test.py
+++ b/pyfiglet/test.py
@@ -39,11 +39,11 @@
outputPyfiglet = f.renderText('foo')
@@ -38,9 +38,9 @@
- fontpath = os.path.join('pyfiglet', 'fonts', font)
+ fontpath = os.path.join('/usr/share/figlet', font)
def outputUsingFigletorToilet(self, text, font, fontpath):
if os.path.isfile(fontpath + '.flf'):
- cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, 'foo')
+ cmd = ('figlet', '-d', '/usr/share/figlet', '-f', font, 'foo')
- 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, 'foo')
+ cmd = ('toilet', '-d', '/usr/share/figlet', '-f', font, 'foo')
- cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, text)
+ cmd = ('toilet', '-d', '/usr/share/figlet', '-f', font, text)
else:
raise Exception('Missing font file: '+fontpath)
@@ -71,7 +71,7 @@
def check_font(self, text, font):
if font in self.skip:
return
- fontpath = os.path.join('pyfiglet', 'fonts', font)
+ fontpath = os.path.join('/usr/share/figlet', font)
self.f.setFont(font=font)
debian-defaults.diff
font-location.diff
no-entry-points.diff
bad-toilet-fonts.diff
......@@ -5,7 +5,7 @@ Tests: smoketest3
Depends: python3-pyfiglet, toilet-fonts
Tests: suite
Depends: python-all, python-pyfiglet, toilet
Depends: python-all, python-pyfiglet, figlet, toilet
Tests: suite3
Depends: python3-all, python3-pyfiglet, toilet
Depends: python3-all, python3-pyfiglet, figlet, toilet
version=3
opts=uversionmangle=s/$/\+dfsg/ \
http://githubredir.debian.net/github/pwaller/pyfiglet/(.*).tar.gz
opts=dversionmangle=s/\+dfsg$//,repacksuffix=+dfsg \
https://github.com/pwaller/pyfiglet/tags \
.*/([0-9.]+).tar.gz
This diff is collapsed.
......@@ -6,49 +6,77 @@ import sys
from optparse import OptionParser
from pyfiglet import Figlet
from subprocess import Popen, PIPE
try:
from colorama import init
init(strip=not sys.stdout.isatty())
from termcolor import cprint
except:
def cprint(text, color):
print(text)
__version__ = '0.1'
def fail(text):
cprint(text, 'red')
def win(text):
cprint(text, 'green')
def dump(text):
for line in text.split('\n'):
print(repr(line))
def main():
parser = OptionParser(version=__version__)
parser.add_option('-s', '--show', action='store_true', default=False,
help='pause at each failure and compare output '
'(default: %default)')
opts, args = parser.parse_args()
f = Figlet()
ok = 0
fail = 0
failed = []
skip = ['runic'] # known bug..
for font in f.getFonts():
if font in skip:
continue
f.setFont(font=font)
outputPyfiglet = f.renderText('foo')
fontpath = os.path.join('pyfiglet', 'fonts', font)
class Test(object):
def __init__(self, opts):
self.opts = opts
self.ok = 0
self.fail = 0
self.failed = []
self.oked = []
self.skip = ['runic','pyramid','eftifont'] # known bug..
self.f = Figlet()
def outputUsingFigletorToilet(self, text, font, fontpath):
if os.path.isfile(fontpath + '.flf'):
cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, 'foo')
cmd = ('figlet', '-d', 'pyfiglet/fonts', '-f', font, text)
elif os.path.isfile(fontpath + '.tlf'):
cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, 'foo')
cmd = ('toilet', '-d', 'pyfiglet/fonts', '-f', font, text)
else:
raise Exception('Missing font file: '+fontpath)
p = Popen(cmd, bufsize=1, stdout=PIPE)
outputFiglet = p.communicate()[0].decode('UTF-8')
p = Popen(cmd, bufsize=4096, stdout=PIPE)
outputFiglet = p.communicate()[0].decode('utf8')
return outputFiglet
def validate_font_output(self, font, outputFiglet, outputPyfiglet):
if outputPyfiglet == outputFiglet:
win('[OK] %s' % font)
self.ok += 1
self.oked.append(font)
return
fail('[FAIL] %s' % font)
self.fail += 1
self.failed.append(font)
self.show_result(outputFiglet, outputPyfiglet, font)
def show_result(self, outputFiglet, outputPyfiglet, font):
if self.opts.show is True:
print('[PYTHON] *** %s\n\n' % font)
dump(outputPyfiglet)
print('[FIGLET] *** %s\n\n' % font)
dump(outputFiglet)
raw_input()
def check_font(self, text, font):
if font in self.skip:
return
fontpath = os.path.join('pyfiglet', 'fonts', font)
self.f.setFont(font=font)
outputPyfiglet = self.f.renderText(text)
outputFiglet = self.outputUsingFigletorToilet(text, font, fontpath)
# Our TLF rendering isn't perfect, yet
strict = os.path.isfile(fontpath + '.flf')
......@@ -56,27 +84,44 @@ def main():
outputPyfiglet = outputPyfiglet.strip('\n')
outputFiglet = outputFiglet.strip('\n')
if outputPyfiglet == outputFiglet:
print('[OK] %s' % font)
ok += 1
continue
self.validate_font_output(font, outputFiglet, outputPyfiglet)
print('[FAIL] %s' % font)
fail += 1
failed.append(font)
if opts.show is True:
print('[PYTHON] *** %s\n\n' % font)
dump(outputPyfiglet)
print('[FIGLET] *** %s\n\n' % font)
dump(outputFiglet)
raw_input()
def check_text(self, text):
for font in self.f.getFonts():
self.check_font(text, font)
def check_result(self):
print('OK = %d, FAIL = %d' % (self.ok, self.fail))
if len(self.failed) > 0:
print('FAILED = %s' % repr(self.failed))
return self.failed, self.oked
print('OK = %d, FAIL = %d' % (ok, fail))
if len(failed) > 0:
print('FAILED = %s' % repr(failed))
def banner(text):
cprint(Figlet().renderText(text), "blue")
def main():
parser = OptionParser(version=__version__)
return 0
parser.add_option('-s', '--show', action='store_true', default=False,
help='pause at each failure and compare output '
'(default: %default)')
opts, args = parser.parse_args()
test = Test(opts)
banner("TESTING one word")
test.check_text("foo")
banner("TESTING cut at space")
test.check_text("This is a very long text with many spaces and little words")
banner("TESTING cut at last char")
test.check_text("Averylongwordthatwillbecutatsomepoint I hope")
banner("TESTING explicit new line")
test.check_text("this text\nuse new line")
if len(test.check_result()[0]) == 0:
return 0
else:
return 1
if __name__ == '__main__':
......
__version__ = '0.7.2'
__version__ = '0.7.4'
#!/bin/bash
set -eux
pyfiglet -f $2 "$1" > /tmp/pyfiglet
figlet -d pyfiglet/fonts -f $2 "$1"> /tmp/figlet
vimdiff /tmp/figlet /tmp/pyfiglet
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