diff options
Diffstat (limited to 'doc/tools/convert_papermode_to_metadata.py')
-rwxr-xr-x | doc/tools/convert_papermode_to_metadata.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/tools/convert_papermode_to_metadata.py b/doc/tools/convert_papermode_to_metadata.py index 61427c83..d4427a10 100755 --- a/doc/tools/convert_papermode_to_metadata.py +++ b/doc/tools/convert_papermode_to_metadata.py @@ -9,15 +9,16 @@ ranger used to store metadata in .paperinfo files, but that format was rather limited, so .metadata.json files were introduced. """ +from __future__ import (absolute_import, print_function) + import csv import json import os import sys -if sys.version < '3.': - getuserinput = raw_input -else: - getuserinput = input +if sys.version_info[0] < 3: + input = raw_input # NOQA pylint: disable=undefined-variable,redefined-builtin,invalid-name + FIELDS = ["name", "year", "title", "authors", "url"] @@ -30,7 +31,7 @@ def replace(source, target): # Ask for user confirmation if the target file already exists if os.path.exists(target): sys.stdout.write("Warning: target file `%s' exists! Overwrite? [y/N]") - userinput = getuserinput() + userinput = input() if not (userinput.startswith("y") or userinput.startswith("Y")): print("Skipping file `%s'" % source) return @@ -63,6 +64,7 @@ def replace(source, target): else: print("Skipping writing `%s' due to a lack of data" % target) + if __name__ == "__main__": if set(['--help', '-h']) & set(sys.argv[1:]): print(__doc__.strip()) |