This file is indexed.

/usr/bin/ufl-analyse is in python-ufl 1.3.0-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /usr/bin/python

__authors__ = "Martin Sandve Alnes"
__date__ = "2008-05-09"

# Modified by Anders Logg, 2009.
# Last changed: 2011-04-26

import sys, optparse
from ufl.log import warning
from ufl.algorithms import load_ufl_file, validate_form, ufl2latex, tree_format, preprocess

# Get commandline options

usage = """Analyse a .ufl file to find errors.
Optionally write information about
the forms for further inspection.

Examples:

  ufl-analyse --quiet=0 --write=1 mass.ufl"""

def opt(long, short, t, default, help):
    return optparse.make_option("--%s" % long, "-%s" % short, action="store", type=t, dest=long, default=default, help=help)

option_list = [ \
    opt("quiet", "q", "int", 1, "Do not print form information to screen."),
    opt("write", "w", "int", 0, "Write form information to file."),
    ]

parser = optparse.OptionParser(usage=usage, option_list=option_list)
args = sys.argv[1:]
(options, args) = parser.parse_args(args=args)

if not args:
    print "Missing files!"
    print
    parser.print_usage()
    sys.exit(-1)
filenames = args

write_file = options.write
quiet = options.quiet

# Handle each form file separately
for filename in filenames:

    # Check file suffix
    if not filename.endswith(".ufl"):
        warning("Filename '%s' does not end with .ufl." % filename)

    # Load form file, which triggers many consistency
    # checks while the form is being built
    print "Loading form file '%s'" % filename
    try:
        # TODO: Forms that fail will usually fail inside this, which doesn't produce any log... Perhaps we should pass a log file to load_forms?
        data = load_ufl_file(filename)
        forms = data.forms
    except:
        print "Failed to load form file."
        raise

    outputfilename = filename + ".log"
    if write_file:
        outputfile = open(outputfilename, "w")

    def write(*items):
        text = " ".join(str(s) for s in items)
        if write_file:
            outputfile.write(text)
            outputfile.flush()
        if not quiet:
            print text

    # Analyse each form separately
    for form in forms:

        # Validate form
        validate_form(form)

        # Compute form metadata and extract preprocessed form
        form_data = form.compute_form_data()
        preprocessed_form = form_data.preprocessed_form

        # Print form data
        write("\nForm data:\n", str(form_data))

        # Print different representations
        write("\n\nForm pretty-print (original):\n",        str(form))
        write("\n\nForm pretty-print (preprocessed):\n",    str(preprocessed_form))
        write("\n\nForm representation (original):\n",      repr(form))
        write("\n\nForm representation (preprocessed):\n",  repr(preprocessed_form))
        write("\n\nForm tree formatting (original):\n",     tree_format(form))
        write("\n\nForm tree formatting (preprocessed):\n", tree_format(preprocessed_form))
        write("\n\nForm LaTeX code (preprocessed):\n",      ufl2latex(form))

    if write_file:
        outputfile.close()