mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Use print() function in both Python 2 and Python 3
This commit is contained in:
@@ -101,7 +101,7 @@ def parse_cipher(ciph):
|
||||
fwsec, = m.groups()
|
||||
return Ciphersuite(ciph, fwsec, "CHACHA20", "256", "POLY1305", "n/a")
|
||||
|
||||
print "/* Couldn't parse %s ! */"%ciph
|
||||
print("/* Couldn't parse %s ! */"%ciph)
|
||||
return None
|
||||
|
||||
|
||||
@@ -125,12 +125,12 @@ for c in ALL_CIPHERS:
|
||||
colon = ' ":"'
|
||||
|
||||
if c.name in MANDATORY:
|
||||
print "%s/* Required */"%indent
|
||||
print '%s%s%s'%(indent,c.name,colon)
|
||||
print("%s/* Required */"%indent)
|
||||
print('%s%s%s'%(indent,c.name,colon))
|
||||
else:
|
||||
print "#ifdef %s"%c.name
|
||||
print '%s%s%s'%(indent,c.name,colon)
|
||||
print "#endif"
|
||||
print("#ifdef %s"%c.name)
|
||||
print('%s%s%s'%(indent,c.name,colon))
|
||||
print("#endif")
|
||||
|
||||
print '%s;'%indent
|
||||
print('%s;'%indent)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import re
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print >>sys.stderr, "Syntax: get_mozilla_ciphers.py <firefox-source-dir> <openssl-source-dir>"
|
||||
print("Syntax: get_mozilla_ciphers.py <firefox-source-dir> <openssl-source-dir>", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
ff_root = sys.argv[1]
|
||||
@@ -176,13 +176,13 @@ for fl in oSSLinclude:
|
||||
fp.close()
|
||||
|
||||
# Now generate the output.
|
||||
print """\
|
||||
print("""\
|
||||
/* This is an include file used to define the list of ciphers clients should
|
||||
* advertise. Before including it, you should define the CIPHER and XCIPHER
|
||||
* macros.
|
||||
*
|
||||
* This file was automatically generated by get_mozilla_ciphers.py.
|
||||
*/"""
|
||||
*/""")
|
||||
# Go in order by the order in CipherPrefs
|
||||
for firefox_macro in firefox_ciphers:
|
||||
|
||||
@@ -215,4 +215,4 @@ for firefox_macro in firefox_ciphers:
|
||||
#else
|
||||
XCIPHER(%(hex)s, %(macro)s)
|
||||
#endif""" % format
|
||||
print res
|
||||
print(res)
|
||||
|
||||
@@ -30,6 +30,11 @@ import slow_ed25519
|
||||
import slownacl_curve25519
|
||||
import ed25519_exts_ref
|
||||
|
||||
try:
|
||||
xrange # Python 2
|
||||
except NameError:
|
||||
xrange = range # Python 3
|
||||
|
||||
# Pull in the openssl stuff we need.
|
||||
|
||||
crypt = ctypes.CDLL(ctypes.util.find_library('crypto'))
|
||||
@@ -303,10 +308,10 @@ def signdesc(body, args_out=None):
|
||||
return body.rstrip()
|
||||
|
||||
def print_c_string(ident, body):
|
||||
print "static const char %s[] =" % ident
|
||||
print("static const char %s[] =" % ident)
|
||||
for line in body.split("\n"):
|
||||
print ' "%s\\n"' %(line)
|
||||
print " ;"
|
||||
print(' "%s\\n"' %(line))
|
||||
print(" ;")
|
||||
|
||||
def emit_ri(name, body):
|
||||
info = OnDemandKeys()
|
||||
@@ -320,8 +325,8 @@ def emit_ei(name, body):
|
||||
body = info.sign_desc(body)
|
||||
print_c_string("EX_EI_%s"%name.upper(), body)
|
||||
|
||||
print 'const char EX_EI_{NAME}_FP[] = "{d.RSA_FINGERPRINT_NOSPACE}";'.format(
|
||||
d=info, NAME=name.upper())
|
||||
print('const char EX_EI_{NAME}_FP[] = "{d.RSA_FINGERPRINT_NOSPACE}";'.format(
|
||||
d=info, NAME=name.upper()))
|
||||
print_c_string("EX_EI_%s_KEY"%name.upper(), info.RSA_IDENTITY)
|
||||
|
||||
def analyze(s):
|
||||
|
||||
Reference in New Issue
Block a user