change print for python3

This commit is contained in:
Jakobus Schürz 2021-10-31 11:58:12 +01:00
parent a6205344b1
commit daadb52b9c
3 changed files with 11 additions and 7 deletions

View file

@ -40,9 +40,9 @@
- can't trust "~"::
[0 tv@musti ~]$ sudo python -c 'import os; print os.path.expanduser("~")'
[0 tv@musti ~]$ sudo python -c 'import os; print(os.path.expanduser("~"))'
/home/tv
[0 tv@musti ~]$ sudo -H python -c 'import os; print os.path.expanduser("~")'
[0 tv@musti ~]$ sudo -H python -c 'import os; print(os.path.expanduser("~"))'
/root
- command line options

View file

@ -91,8 +91,9 @@ def generate_project_list_fp(config, fp):
else:
response.append(owner)
line = ' '.join([urllib.quote_plus(s) for s in response])
print >>fp, line
line = ' '.join([urllib.parse.quote_plus(s) for s in response])
#print >>fp, line
print(line, end="", file=fp)
def generate_project_list(config, path):
"""
@ -159,7 +160,8 @@ def set_descriptions(config):
tmp = '%s.%d.tmp' % (path, os.getpid())
f = open(tmp, 'w')
try:
print >>f, description
#print >>f, description
print(description, end="", file=f)
finally:
f.close()
os.rename(tmp, path)

View file

@ -76,11 +76,13 @@ def writeAuthorizedKeys(path, keydir):
try:
if in_ is not None:
for line in filterAuthorizedKeys(in_):
print >>out, line
#print >>out, line
print(line, end="", file=out)
keygen = readKeys(keydir)
for line in generateAuthorizedKeys(keygen):
print >>out, line
#print >>out, line
print(line, end="", file=out)
os.fsync(out)
finally: