bin: convert python scripts to python3

This commit is contained in:
Nick Craig-Wood 2019-09-06 22:08:48 +01:00
parent 1382dba3c8
commit 07dfb3aa11
5 changed files with 21 additions and 19 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
Make single page versions of the documentation for release and
conversion into man pages etc.
@ -118,8 +118,8 @@ def check_docs(docpath):
docs_set = set(docs)
if files == docs_set:
return
print "Files on disk but not in docs variable: %s" % ", ".join(files - docs_set)
print "Files in docs variable but not on disk: %s" % ", ".join(docs_set - files)
print("Files on disk but not in docs variable: %s" % ", ".join(files - docs_set))
print("Files in docs variable but not on disk: %s" % ", ".join(docs_set - files))
raise ValueError("Missing files")
def read_command(command):
@ -142,7 +142,7 @@ def read_commands(docpath):
def main():
check_docs(docpath)
command_docs = read_commands(docpath)
command_docs = read_commands(docpath).replace("\\", "\\\\") # escape \ so we can use command_docs in re.sub
with open(outfile, "w") as out:
out.write("""\
%% rclone(1) User Manual
@ -156,7 +156,7 @@ def main():
if doc == "docs.md":
contents = re.sub(r"The main rclone commands.*?for the full list.", command_docs, contents, 0, re.S)
out.write(contents)
print "Written '%s'" % outfile
print("Written '%s'" % outfile)
if __name__ == "__main__":
main()