File tree Expand file tree Collapse file tree 3 files changed +19
-22
lines changed Expand file tree Collapse file tree 3 files changed +19
-22
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/python
1
+ #!/usr/bin/env python
2
2
#
3
3
# This is a simple web server (listening to port 5911) that takes the
4
4
# X-UA-Device header into consideration when producing content.
5
5
#
6
6
# Author: Lasse Karstensen <[email protected] >, February 2012.
7
+ #
8
+ from __future__ import print_function
7
9
from BaseHTTPServer import HTTPServer , BaseHTTPRequestHandler
8
10
from socket import AF_INET6
9
11
from pprint import pformat
@@ -59,13 +61,10 @@ def do_GET(self):
59
61
self .wfile .write ("<p>This page was generated %s.</p>" % (datetime .datetime .now ().isoformat ()))
60
62
self .wfile .write (TAIL_CONTENT )
61
63
62
- def main () :
64
+ if __name__ == "__main__" :
63
65
server_address = ('' , 5911 )
64
66
HTTPServer .allow_reuse_address = True
65
67
HTTPServer .address_family = AF_INET6
66
68
httpd = HTTPServer (server_address , requesthandler )
67
- print "Listening on %s:%s." % server_address
69
+ print ( "Listening on %s:%s." % server_address )
68
70
httpd .serve_forever ()
69
-
70
- if __name__ == "__main__" :
71
- main ()
Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
"""
3
3
Parse the list of manually classified User-Agent strings and
4
4
prepare a varnishtest test case that verifies the correct classification.
25
25
client c1 -run
26
26
"""
27
27
28
- def main () :
28
+ if __name__ == "__main__" :
29
29
inputfile = argv [1 ]
30
- print HEADER
30
+ print ( HEADER )
31
31
for line in open (inputfile ):
32
32
line = line .strip ()
33
33
if line .startswith ("#" ) or len (line ) == 0 :
@@ -36,10 +36,8 @@ def main():
36
36
37
37
classid , uastring = line .split ("\t " , 1 )
38
38
39
- print "\t txreq -hdr \" User-Agent: %s\" " % uastring
40
- print "\t rxresp"
41
- print "\t expect resp.http.X-UA-Device == \" %s\" \n " % classid
42
- print TAILER
39
+ print ( "\t txreq -hdr \" User-Agent: %s\" " % uastring )
40
+ print ( "\t rxresp" )
41
+ print ( "\t expect resp.http.X-UA-Device == \" %s\" \n " % classid )
42
+ print ( TAILER )
43
43
44
- if __name__ == "__main__" :
45
- main ()
Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
"""
3
3
Pick out the examples from the installation documentation and
4
4
build a VTC test case around it.
@@ -60,9 +60,9 @@ def parse(inputfile):
60
60
assert section is not None
61
61
assert line .startswith (".. endsnippet-%s" % section )
62
62
except AssertionError :
63
- print section , line
64
- print buf
65
- print req
63
+ print ( section , line )
64
+ print ( buf )
65
+ print ( req )
66
66
raise
67
67
68
68
yield section , "" .join (buf ), " " .join (req )
@@ -82,6 +82,6 @@ def parse(inputfile):
82
82
rstfile = argv [1 ]
83
83
for name , testsnippet , req in parse (rstfile ):
84
84
with open ("snippet-%s.vtc" % name , "w+" ) as fp :
85
- print >> fp , header (name )
86
- print >> fp , testsnippet
87
- print >> fp , tailer (req )
85
+ print ( header (name ), file = fp )
86
+ print ( testsnippet , file = fp )
87
+ print ( tailer (req ), file = fp )
You can’t perform that action at this time.
0 commit comments