[Python-modules-commits] r11305 - in packages/pyfiglet/trunk/debian/patches (3 files)
stefanor-guest at users.alioth.debian.org
stefanor-guest at users.alioth.debian.org
Mon Jan 25 19:00:32 UTC 2010
Date: Monday, January 25, 2010 @ 19:00:16
Author: stefanor-guest
Revision: 11305
Add toilet .tlf reading support
Added:
packages/pyfiglet/trunk/debian/patches/dir-error-path.diff
packages/pyfiglet/trunk/debian/patches/tlf-support.diff
Modified:
packages/pyfiglet/trunk/debian/patches/series
Added: packages/pyfiglet/trunk/debian/patches/dir-error-path.diff
===================================================================
--- packages/pyfiglet/trunk/debian/patches/dir-error-path.diff (rev 0)
+++ packages/pyfiglet/trunk/debian/patches/dir-error-path.diff 2010-01-25 19:00:16 UTC (rev 11305)
@@ -0,0 +1,24 @@
+Description: The directory-tree handling code is poorer quality than the Zip
+ file code. This corrects some non-existant variable accessing.
+Author: Stefano Rivera <stefano at rivera.za.net>
+Forwarded: https://sourceforge.net/tracker/?func=detail&aid=2939614&group_id=200820&atid=975076
+Last Update: 2010-01-25
+
+--- a/pyfiglet.py
++++ b/pyfiglet.py
+@@ -104,13 +104,13 @@
+
+ header = data.pop(0)
+ if self.reMagicNumber.search(header) is None:
+- raise FontError, '%s is not a valid figlet font' % fontPath
++ raise FontError, '%s is not a valid figlet font' % self.font
+
+ header = self.reMagicNumber.sub('', header)
+ header = header.split()
+
+ if len(header) < 6:
+- raise FontError, 'malformed header for %s' % fontPath
++ raise FontError, 'malformed header for %s' % self.font
+
+ hardBlank = header[0]
+ height, baseLine, maxLength, oldLayout, commentLines = map(int, header[1:6])
Modified: packages/pyfiglet/trunk/debian/patches/series
===================================================================
--- packages/pyfiglet/trunk/debian/patches/series 2010-01-25 18:57:58 UTC (rev 11304)
+++ packages/pyfiglet/trunk/debian/patches/series 2010-01-25 19:00:16 UTC (rev 11305)
@@ -1 +1,3 @@
+dir-error-path.diff
+tlf-support.diff
setup.py.diff
Added: packages/pyfiglet/trunk/debian/patches/tlf-support.diff
===================================================================
--- packages/pyfiglet/trunk/debian/patches/tlf-support.diff (rev 0)
+++ packages/pyfiglet/trunk/debian/patches/tlf-support.diff 2010-01-25 19:00:16 UTC (rev 11305)
@@ -0,0 +1,79 @@
+Description: Add support for toilet's .tlf files.
+ There are .tlf files which are compatible with figlet.
+Author: Stefano Rivera <stefano at rivera.za.net>
+Forwarded: https://sourceforge.net/tracker/?func=detail&aid=2939616&group_id=200820&atid=975076
+Last Update: 2010-01-25
+
+--- a/pyfiglet.py
++++ b/pyfiglet.py
+@@ -62,7 +62,7 @@
+ self.width = {}
+ self.data = None
+
+- self.reMagicNumber = re.compile(r'^flf2.')
++ self.reMagicNumber = re.compile(r'^[ft]lf2.')
+ self.reEndMarker = re.compile(r'(.)\s*$')
+
+ self.readFontFile()
+@@ -73,8 +73,11 @@
+ a superclass to create different font sources.
+ """
+ def readFontFile(self):
+- fontPath = '%s/%s.flf' % (self.dir, self.font)
+- if os.path.exists(fontPath) is False:
++ for ext in ('flf', 'tlf'):
++ fontPath = '%s/%s.%s' % (self.dir, self.font, ext)
++ if os.path.exists(fontPath):
++ break
++ else:
+ raise FontNotFound, "%s doesn't exist" % fontPath
+
+ try:
+@@ -86,7 +89,8 @@
+ finally: fo.close()
+
+ def getFonts(self):
+- return [font[:-4] for font in os.walk(self.dir).next()[2] if font.endswith('.flf')]
++ return [font[:-4] for font in os.walk(self.dir).next()[2]
++ if font.endswith('.flf') or font.endswith('.tlf')]
+
+
+
+@@ -228,25 +232,27 @@
+ if os.path.exists(self.zipfile) is False:
+ raise FontNotFound, "%s doesn't exist" % self.zipfile
+
+- fontPath = 'fonts/%s.flf' % self.font
++ for ext in ('.flf', '.tlf'):
++ fontPath = 'fonts/%s.%s' % (self.font, ext)
+
+- try:
+- z = ZipFile(self.zipfile, 'r')
+- files = z.namelist()
+- if fontPath not in files:
+- raise FontNotFound, '%s not found in %s' % (self.font, self.zipfile)
++ try:
++ z = ZipFile(self.zipfile, 'r')
++ files = z.namelist()
++ if fontPath not in files:
++ raise FontNotFound, '%s not found in %s' % (self.font, self.zipfile)
+
+- self.data = z.read(fontPath)
++ self.data = z.read(fontPath)
+
+- except Exception, e:
+- raise FontError, "couldn't open %s: %s" % (fontPath, e)
++ except Exception, e:
++ raise FontError, "couldn't open %s: %s" % (fontPath, e)
+
+ def getFonts(self):
+ if os.path.exists(self.zipfile) is False:
+ raise FontNotFound, "%s doesn't exist" % self.zipfile
+
+ z = ZipFile(self.zipfile, 'r')
+- return [font[6:-4] for font in z.namelist() if font.endswith('.flf')]
++ return [font[6:-4] for font in z.namelist()
++ if font.endswith('.flf') and font.endswith('.tlf')]
+
+
+
More information about the Python-modules-commits
mailing list