This file is indexed.

/usr/share/pyshared/Pyrex/Mac/MacSystem.py is in python-pyrex 0.9.8.5-2.1.

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
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#
#   Pyrex -- Mac system interface
#

import os, sys, string
import aetools
from aetools import TalkTo
from StdSuites.Standard_Suite import Standard_Suite_Events as Standard_Suite
from Pyrex.Utils import replace_suffix
from Pyrex.Compiler.Errors import PyrexError

c_compiler = "MWCPPC"
c_optimizations = "off"
#c_linker = "PPCLink"
c_linker = "MWLinkPPC"
shared_lib_suffix = ".slb"

#py_home = "Python2.2:Home:"
py_home = sys.exec_prefix

py_include_dirs = (
    py_home + "Include:",
    py_home + "Mac:Include:"
)

pythoncore = py_home + "PythonCore"

mwlibdir = "MPW:Interfaces&Libraries:Libraries:MWPPCLibraries:"

libraries = (
    #mwlibdir + "'MSL C.PPC.Lib'",
    #mwlibdir + "'MSL RuntimePPC.Lib'",
    mwlibdir + "'MSL ShLibRuntime.Lib'",
    mwlibdir + "InterfaceLib",
    #mwlibdir + "MathLib",
    )

class CCompilerError(PyrexError):
    pass

#---------------- ToolServer ---------------------------

from TS_Misc_Suite import TS_Misc_Suite

class ToolServer(Standard_Suite, TS_Misc_Suite, TalkTo):
    pass

def send_toolserver_command(cmd):
    ts = ToolServer('MPSX', start = 1)
    return ts.DoScript(cmd)

def do_toolserver_command(command):
    try:
        result = send_toolserver_command(command)
    except aetools.Error, e:
        raise CCompilerError("Apple Event error: %s" % e)
    errn, stat, stdout, stderr = result
    if errn:
        raise CCompilerError("ToolServer error: %s" % errn)
    stdout = string.replace(stdout, "\r", "\n")
    stderr = string.replace(stderr, "\r", "\n")
    if stdout:
        #print "<<< Begin ToolServer StdOut >>>"
        sys.stderr.write(stdout)
        #print "<<< End ToolServer StdOut >>>"
    if stderr:
        #print "<<< Begin ToolServer StdErr >>>"
        sys.stderr.write(stderr)
        #print "<<< End ToolServer StdErr >>>"
    return stat

#-------------------------------------------------------

def c_compile(c_file):
    #  Compile the given C source file to produce
    #  an object file. Returns the pathname of the
    #  resulting file.
    c_file = os.path.join(os.getcwd(), c_file)
    #print "c_compile: c_file =", repr(c_file) ###
    c_file_dir = os.path.dirname(c_file)
    o_file = replace_suffix(c_file, ".o")
    include_options = ["-i %s" % c_file_dir]
    for dir in py_include_dirs:
        include_options.append("-i %s" % dir)
    command = "%s -opt %s -nomapcr -w off -r %s %s -o %s" % (
        c_compiler, 
        c_optimizations,
        string.join(include_options),
        c_file, 
        o_file, 
        #e_file
        )
    #print "...command =", repr(command) ###
    stat = do_toolserver_command(command)
    if stat:
        raise CCompilerError("C compiler returned status %s" % stat)
    return o_file

def c_link(obj_file):
    return c_link_list([obj_file])

def c_link_list(obj_files):
    #  Link the given object files into a dynamically
    #  loadable extension file. Returns the pathname
    #  of the resulting file.
    out_file = replace_suffix(obj_files[0], shared_lib_suffix)
    command = "%s -xm s -export all %s %s %s -o %s" % (
        c_linker, 
        string.join(obj_files), 
        pythoncore,
        string.join(libraries),
        out_file)
    stat = do_toolserver_command(command)
    if stat:
        raise CCompilerError("Linker returned status %s" % stat)
    return out_file

def test_c_compile(link = 0):
    objs = []
    for arg in sys.argv[1:]:
        if arg.endswith(".c"):
            try:
                obj = c_compile(arg)
            except PyrexError, e:
                #print "Caught a PyrexError:" ###
                #print repr(e) ###
                print "%s.%s:" % (e.__class__.__module__,
                    e.__class__.__name__), e
                sys.exit(1)
        else:
            obj = arg
        objs.append(obj)
    if link:
        c_link_list(objs)