From a23956d28fb2ad7acc08bf32302c78533a63b7b6 2014-08-29 14:13:54 From: Brian E. Granger Date: 2014-08-29 14:13:54 Subject: [PATCH] Updating gen_latex_symbols.py --- diff --git a/IPython/core/latex_symbols.py b/IPython/core/latex_symbols.py index 52fa773..2a920e8 100644 --- a/IPython/core/latex_symbols.py +++ b/IPython/core/latex_symbols.py @@ -1,5 +1,9 @@ # encoding: utf-8 +# DO NOT EDIT THIS FILE BY HAND. + +# To update this file, run the script /tools/gen_latex_symbols.py using Python 3 + # This file is autogenerated from the file: # https://raw.githubusercontent.com/JuliaLang/julia/master/base/latex_symbols.jl # This original list is filtered to remove any unicode characters that are not valid diff --git a/tools/gen_latex_symbols.py b/tools/gen_latex_symbols.py index 47c7155..280ff88 100644 --- a/tools/gen_latex_symbols.py +++ b/tools/gen_latex_symbols.py @@ -10,6 +10,11 @@ # The original mapping of latex symbols to unicode comes from the `latex_symbols.jl` files from Julia. from __future__ import print_function +import os, sys + +if not sys.version_info[0] == 3: + print("This script must be run with Python 3, exiting...") + sys.exit(1) # Import the Julia LaTeX symbols print('Importing latex_symbols.js from Julia...') @@ -59,6 +64,10 @@ valid_idents = [line for line in lines if test_ident(line[1])] s = """# encoding: utf-8 +# DO NOT EDIT THIS FILE BY HAND. + +# To update this file, run the script /tools/gen_latex_symbols.py using Python 3 + # This file is autogenerated from the file: # https://raw.githubusercontent.com/JuliaLang/julia/master/base/latex_symbols.jl # This original list is filtered to remove any unicode characters that are not valid @@ -70,7 +79,9 @@ for line in valid_idents: s += ' "%s" : "%s",\n' % (line[0], line[1]) s += "}\n" -with open('latex_symbols.py', 'w', encoding='utf-8') as f: +fn = os.path.join('..','IPython','core','latex_symbols.py') +print("Writing the file: %s" % fn) +with open(fn, 'w', encoding='utf-8') as f: f.write(s)