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