You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

264 lines
9.4 KiB

  1. From c0b16bbad9b8e396bdb64c638a3540547acfa3a5 Mon Sep 17 00:00:00 2001
  2. From: Pjotr Prins <pjotr.public01@thebird.nl>
  3. Date: Sat, 13 Feb 2016 13:39:03 +0100
  4. Subject: [PATCH 1/2] Applied Deb patch
  5. ---
  6. Formtools.py | 1 -
  7. HTMLcalendar.py | 9 ++++-----
  8. HTMLgen.py | 6 +++---
  9. HTMLtest.py | 12 ++++++------
  10. HTMLutil.py | 19 +++++++++----------
  11. ImagePaletteH.py | 2 +-
  12. Makefile | 10 ++++++++++
  13. NavLinks.py | 1 -
  14. barchart.py | 1 -
  15. colorcube.py | 1 -
  16. 10 files changed, 33 insertions(+), 29 deletions(-)
  17. diff --git a/Formtools.py b/Formtools.py
  18. index bb598f4..1dabccd 100644
  19. --- a/Formtools.py
  20. +++ b/Formtools.py
  21. @@ -1,4 +1,3 @@
  22. -#! /usr/bin/env python
  23. "Provide some supporting classes to simplify Input Forms with HTMLgen"
  24. #'$Id: Formtools.py,v 1.1 1999/04/19 23:45:36 friedric Exp friedric $'
  25. # COPYRIGHT (C) 1999 ROBIN FRIEDRICH email: Robin.Friedrich@pdq.net
  26. diff --git a/HTMLcalendar.py b/HTMLcalendar.py
  27. index 3a03915..35edf27 100644
  28. --- a/HTMLcalendar.py
  29. +++ b/HTMLcalendar.py
  30. @@ -1,4 +1,3 @@
  31. -#!/usr/bin/env python
  32. # COPYRIGHT (C) 1997 ROBIN FRIEDRICH
  33. # Permission to use, copy, modify, and distribute this software and its
  34. # documentation for any purpose and without fee is hereby granted,
  35. @@ -212,12 +211,12 @@ def makeint(value):
  36. return value
  37. else:
  38. raise TypeError, ('cannot convert to int', value)
  39. -import regex
  40. -datepat = regex.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field
  41. +import re
  42. +datepat = re.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field
  43. '\([0-9][0-9]?\)[/-]?' #second 2 char date field
  44. '\([12][0-9][0-9][0-9]\)?[ \t]*:') #optional year field
  45. -daypat = regex.compile('^ *\('+string.join(day_name,'\|')+'\)')
  46. -timepat = regex.compile('\([0-9][0-9]?\):\([0-9][0-9]\)')
  47. +daypat = re.compile('^ *\('+string.join(day_name,'\|')+'\)')
  48. +timepat = re.compile('\([0-9][0-9]?\):\([0-9][0-9]\)')
  49. def read_appt_file(filename):
  50. """Parsing function.
  51. diff --git a/HTMLgen.py b/HTMLgen.py
  52. index 10ecd28..dbdbd81 100644
  53. --- a/HTMLgen.py
  54. +++ b/HTMLgen.py
  55. @@ -284,7 +284,7 @@ class SimpleDocument(BasicDocument):
  56. if self.meta: s.append(str(self.meta))
  57. if self.base: s.append(str(self.base))
  58. if self.stylesheet:
  59. - s.append('\n <LINK rel=stylesheet href="%s" type=text/css title="%s">\n' \
  60. + s.append('\n <LINK rel=stylesheet href="%s" type="text/css" title="%s">\n' \
  61. % (self.stylesheet, self.stylesheet))
  62. if self.style:
  63. s.append('\n<STYLE>\n<!--\n%s\n-->\n</style>\n' % self.style)
  64. @@ -1083,7 +1083,7 @@ class List(UserList.UserList):
  65. Overloaded by child classes to represent other list styles.
  66. """
  67. - return '%s<LI>%s\n' % (self.pad*self.lvl, item)
  68. + return '%s<LI>%s</LI>\n' % (self.pad*self.lvl, item)
  69. def start_element(self):
  70. """Generic creator for the HTML element opening tag.
  71. @@ -2463,7 +2463,7 @@ class URL:
  72. import urlparse
  73. self.unparse = urlparse.urlunparse
  74. self.proto, self.node, self.path, self.params, self.query, self.fragment = \
  75. - urlparse(url)
  76. + urlparse.urlparse(url)
  77. self.dir, self.file = self.split(self.path)
  78. def split(self, p):
  79. diff --git a/HTMLtest.py b/HTMLtest.py
  80. index 5850a04..283233f 100755
  81. --- a/HTMLtest.py
  82. +++ b/HTMLtest.py
  83. @@ -1,8 +1,8 @@
  84. -#!/bin/env python
  85. +#!/usr/bin/env python
  86. """Test script which generates the online documentation for HTMLgen.
  87. """
  88. -import string, regex, regsub, os, time, glob
  89. +import string, re, os, time, glob
  90. from HTMLcolors import *
  91. from HTMLgen import *
  92. import HTMLgen #only so I can pick off the __version__
  93. @@ -232,11 +232,11 @@ def sample1(filename, aft=None, fore=None, top=None, home=None):
  94. doc.email = 'jefferson@montecello.virginia.gov'
  95. doc.logo = ('../image/eagle21.gif', 64, 54)
  96. # parse Declaration of Independence
  97. - re_hline = regex.compile('^--+$')
  98. - re_title = regex.compile('^Title:\(.*$\)')
  99. + re_hline = re.compile('^--+$')
  100. + re_title = re.compile('^Title:\(.*$\)')
  101. font2 = Font(size='+2')
  102. s = open(os.path.join(datadir, 'DoI.txt')).read()
  103. - paragraphs = regsub.split(s, '\n\([\t ]*\n\)+')
  104. + paragraphs = re.split(s, '\n\([\t ]*\n\)+')
  105. for para in paragraphs:
  106. if not para: continue
  107. if re_title.search(para) > -1:
  108. @@ -263,7 +263,7 @@ def sample2(filename, aft=None, fore=None, top=None, home=None):
  109. #Ok parse that file
  110. f = open(mpath(os.path.join(datadir, 'parrot.txt')))
  111. line = f.readline()
  112. - re_dialog = regex.compile('\(^[OC].*:\)\(.*\)')
  113. + re_dialog = re.compile('\(^[OC].*:\)\(.*\)')
  114. while line:
  115. if re_dialog.search(line) > -1:
  116. role, prose = re_dialog.group(1,2)
  117. diff --git a/HTMLutil.py b/HTMLutil.py
  118. index 2baf168..9a877e5 100755
  119. --- a/HTMLutil.py
  120. +++ b/HTMLutil.py
  121. @@ -1,4 +1,3 @@
  122. -#!/usr/bin/env python
  123. """This module provides utility functions/classes associated with HTMLgen.
  124. This is functionality use by HTMLgen script writers rather than by HTMLgen
  125. @@ -19,7 +18,7 @@ itself. (i.e. HTMLgen.py is not dependant on this module.)
  126. # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  127. # PERFORMANCE OF THIS SOFTWARE.
  128. __version__ = '$Id: HTMLutil.py,v 1.3 1998/05/28 20:14:52 friedric Exp $'
  129. -import string, regex, os
  130. +import string, re, os
  131. import HTMLgen, HTMLcolors
  132. from types import *
  133. @@ -79,7 +78,7 @@ def been_marked(text):
  134. """Determine if the text have been marked by a previous gsub.
  135. (ugly hack but it works)
  136. """
  137. - if regex.search('\(</?FONT\)\|\(</?STRONG\)', text) > -1:
  138. + if re.search('\(</?FONT\)\|\(</?STRONG\)', text) > -1:
  139. return 1
  140. else:
  141. return 0
  142. @@ -125,13 +124,13 @@ def global_substitute(search_func, repl_func, s):
  143. not_backslash = "[^\\\\]"
  144. triple_single = "'''"
  145. triple_double = '"""'
  146. -_doc_start_re = regex.compile(
  147. +_doc_start_re = re.compile(
  148. "\(^\|" + not_backslash + "\)" # bol or not backslash
  149. + "\(" + triple_single + "\|" + triple_double + "\)" )
  150. single_re = not_backslash + triple_single
  151. double_re = not_backslash + triple_double
  152. -_triple_re = { triple_single : regex.compile(single_re),
  153. - triple_double : regex.compile(double_re) }
  154. +_triple_re = { triple_single : re.compile(single_re),
  155. + triple_double : re.compile(double_re) }
  156. del not_backslash, triple_single, triple_double, \
  157. single_re, double_re
  158. @@ -150,13 +149,13 @@ def find_docstring( s, begin=0):
  159. return (None, None)
  160. return startquote, quotefinder.regs[0][1]
  161. -string_re = regex.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)')
  162. +string_re = re.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)')
  163. def find_string_literal( s, begin=0 ):
  164. if string_re.search(s, begin) > -1:
  165. return string_re.regs[1]
  166. return (None, None)
  167. -comment_re = regex.compile('#.*$')
  168. +comment_re = re.compile('#.*$')
  169. def find_comment( s, begin=0 ):
  170. while comment_re.search(s, begin) > -1:
  171. if been_marked(comment_re.group(0)):
  172. @@ -166,13 +165,13 @@ def find_comment( s, begin=0 ):
  173. return (None, None)
  174. Name = '[a-zA-Z_][a-zA-Z0-9_]*'
  175. -func_re = regex.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*(')
  176. +func_re = re.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*(')
  177. def find_function( s, begin=0 ):
  178. if func_re.search(s, begin) > -1:
  179. return func_re.regs[1]
  180. return (None, None)
  181. -class_re = regex.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]')
  182. +class_re = re.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]')
  183. def find_class( s, begin=0 ):
  184. if class_re.search(s, begin) > -1:
  185. return class_re.regs[1]
  186. diff --git a/ImagePaletteH.py b/ImagePaletteH.py
  187. index 83bb867..e723847 100644
  188. --- a/ImagePaletteH.py
  189. +++ b/ImagePaletteH.py
  190. @@ -70,7 +70,7 @@ def negative(mode = "RGB"):
  191. return ImagePalette(mode, palette * len(mode))
  192. def random(mode = "RGB"):
  193. - from whrandom import randint
  194. +# from whrandom import randint
  195. palette = map(lambda a: randint(0, 255), [0]*256*len(mode))
  196. return ImagePalette(mode, palette)
  197. diff --git a/Makefile b/Makefile
  198. index 1788fa6..e1ec846 100644
  199. --- a/Makefile
  200. +++ b/Makefile
  201. @@ -62,6 +62,16 @@ install: compileall
  202. python installp.py -f $(MODULES) $(MODULESC) $(PIL) $(PILC)
  203. @echo Installation of $(PACKAGE) done.
  204. +debinstall:
  205. + if [ -z "$(PYLIBDIR)" ]; then \
  206. + echo "Unset PYLIBDIR."; \
  207. + exit 1; \
  208. + fi; \
  209. + for f in $(MODULES) $(PIL); do \
  210. + install -m 644 $$f $(PYLIBDIR)/; \
  211. + done
  212. + @echo Installation of $(PACKAGE) done.
  213. +
  214. checkin:
  215. ci -u $(MODULES) $(PIL) $(EXTRAS) $(TEST) Makefile
  216. diff --git a/NavLinks.py b/NavLinks.py
  217. index fcecbb3..51ef774 100644
  218. --- a/NavLinks.py
  219. +++ b/NavLinks.py
  220. @@ -1,4 +1,3 @@
  221. -#!/usr/bin/env python
  222. #'$Id: NavLinks.py,v 1.1 1999/02/04 04:54:29 friedric Exp friedric $'
  223. # COPYRIGHT (C) 1999 ROBIN FRIEDRICH email:Robin.Friedrich@pdq.net
  224. # Permission to use, copy, modify, and distribute this software and
  225. diff --git a/barchart.py b/barchart.py
  226. index 882cde5..a901fe4 100755
  227. --- a/barchart.py
  228. +++ b/barchart.py
  229. @@ -1,4 +1,3 @@
  230. -#!/usr/bin/env python
  231. """Provides BarChart class which creates HTML 1D bar charts,
  232. and StackedBarChart class to deal with multiple data plotting
  233. diff --git a/colorcube.py b/colorcube.py
  234. index be91154..94fa7dd 100644
  235. --- a/colorcube.py
  236. +++ b/colorcube.py
  237. @@ -1,4 +1,3 @@
  238. -#!/usr/bin/env python
  239. """Utility to generate a table of browser safe colors.
  240. """
  241. --
  242. 2.1.4