varnish/varnish-5.0.0.fix_python24.el5.patch

69 lines
1.7 KiB
Diff
Raw Normal View History

--- lib/libvcc/vmodtool.py.orig 2016-09-14 14:39:29.159447283 +0200
+++ lib/libvcc/vmodtool.py 2016-09-14 14:46:33.446283000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2.4
#-
# Copyright (c) 2010-2016 Varnish Software
# All rights reserved.
@@ -33,8 +33,8 @@
vmod_${name}.rst -- Extracted documentation
"""
-# This script should work with both Python 2 and Python 3.
-from __future__ import print_function
+## This script should work with both Python 2 and Python 3.
+#from __future__ import print_function
import os
import sys
@@ -47,6 +47,16 @@
from pprint import pprint, pformat
from tempfile import mkstemp
+# __future__ print_function is not available on python2.4 in rhel5, so
+# make a local simple variant _print
+
+def _print(*objects, **kwargs):
+ sep = kwargs.get('sep', ' ')
+ end = kwargs.get('end', '\n')
+ out = kwargs.get('file', sys.stdout)
+ out.write(sep.join(objects) + end)
+
+
rstfmt=False
ctypes = {
@@ -150,11 +160,11 @@
def err(str, warn=True):
if opts.strict or not warn:
- print("ERROR: " + str, file = sys.stderr)
+ _print("ERROR: " + str, file = sys.stderr)
exit(1)
raise FormatError(str, "")
else:
- print("WARNING: " + str, file = sys.stderr)
+ _print("WARNING: " + str, file = sys.stderr)
def fmt_cstruct(fo, mn, x):
a = "\ttd_" + mn + "_" + x
@@ -359,7 +369,7 @@
self.parse()
def dump(self):
- print(type(self), self.line)
+ _print(type(self), self.line)
def rstfile(self, fo, man):
if self.rstlbl != None:
@@ -866,7 +876,7 @@
if not i_vcc:
i_vcc = "vmod.vcc"
else:
- print("ERROR: No vmod.vcc file supplied or found.",
+ _print("ERROR: No vmod.vcc file supplied or found.",
file=sys.stderr)
oparser.print_help()
exit(-1)