This file is indexed.

/usr/share/pyshared/pychart/gs_frontend.py is in python-pychart 1.39-7build1.

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

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
#
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
# 
# Jockey is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
#
# Jockey is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
import pychart_util
import theme
import sys
import os
import os.path
import pscanvas
import tempfile
import basecanvas
from scaling import *

def _get_gs_path():
    """Guess where the Ghostscript executable is
    and return its absolute path name."""
    path = os.environ.get("PATH", os.defpath)
    
    for dir in path.split(os.pathsep):
        for name in ("gs", "gs.exe", "gswin32c.exe"):
            g = os.path.join(dir, name)
            if os.path.exists(g):
                return g
    raise Exception, "Ghostscript not found. path=%s" % str(path)

class T(pscanvas.T):
    """This class is a special kind of canvas that runs ghostscript
    on the generated postscript contents. It is not used stand-alone, but as
    a component of PNG and X11 display functionality."""
    
    def __write_contents(self, fp):
        fp.write(pscanvas.preamble_text)
        for name, id in self.__font_ids.items():
            fp.write("/%s {/%s findfont SF} def\n" % (id, name))
        fp.write("%d %d translate\n" % (-self.bbox[0], -self.bbox[1]))
        fp.writelines(self.__output_lines)
        fp.write("showpage end\n")
        fp.flush()

    def close(self):
        # Don't call pscanvas.T.close, as it creates a
        # ps file. 
        basecanvas.T.close(self)
        
    def start_gs(self, arg):
        self.bbox = theme.adjust_bounding_box([xscale(self.__xmin),
                                               yscale(self.__ymin),
                                               xscale(self.__xmax),
                                               yscale(self.__ymax)])
        
        gs_path = _get_gs_path()
        self.pipe_fp = None
	if self.__output_lines == []:
	    return

        if sys.platform != "win32" and hasattr(os, "popen"):
            # UNIX-like systems
            cmdline = "\"%s\" -q %s -g%dx%d -q >/dev/null 2>&1" % \
            (gs_path, arg,
             self.bbox[2] - self.bbox[0],
             self.bbox[3] - self.bbox[1])
            self.pipe_fp = os.popen(cmdline, "w")
            self.__write_contents(self.pipe_fp)
        else:
            # XXX should use mktemp, but need to support python<=2.2 as well.
            fname = tempfile.mktemp("xxx")
            fp = open(fname, "wb")
            self.__write_contents(fp)
            fp.close()
            cmdline = "\"%s\" -q %s -g%dx%d -q <%s >NUL" % \
            (gs_path, arg,
             self.bbox[2] - self.bbox[0],
             self.bbox[3] - self.bbox[1], fname)
            os.system(cmdline)
            os.unlink(fname)
    def close_gs(self):
        if self.pipe_fp:
            self.pipe_fp.close()
            self.pipe_fp = None