This file is indexed.

/usr/lib/distcc-pump/include_server/run.py is in distcc-pump 3.1-6.3.

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
#! /usr/bin/python2.4 

# Copyright 2007 Google Inc.
#
# This program 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
# of the License, or (at your option) any later version.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
# USA.

"""Run with PYTHONPATH including appropriate place for extension module."""

__author__ = "opensource@google.com"

import os
import sys
import glob


USAGE="""Usage: run.py [--install] CMD [ARG...]

Option:

 --run_in_install:  find extension module under lib of installation directory

Locate a Python extension module in some directory D under the
c_extensions/build subdirectory of the directory that contains the present
command. With --run_in_install, assume that this script resides in an installed
version; this means that the directory structure is different and D is located
as ../../lib.

Then run CMD [ARG...] with environment variable PYTHONPATH augmented with D.

Normally, print out a message where the extension module is found. But, with
--run_in_install this message is suppressed.

Examples:

From anywhere:
  # Start include server.
  /home/distcc/include_server/run.py include_server.py
  
In the include_server directory:
  # Run include_server tests.
  ./run.py include_server_test.py
  # Pycheck include_server.
  ./run.py `which pychecker` include_server.py  

In installed distcc-pump:
   # See 'distcc-pump' script.
   $include_server_location/run.py --run_in_install include_server.py .. 
"""

def usage():
  print USAGE
  sys.exit(1)

DEFAULT_PATH = "c_extensions/build/lib.*/*"

cmd = sys.argv[0]
if len(sys.argv) < 2: usage()

dirname = os.path.dirname(cmd)
directory = os.path.abspath(os.path.join(os.getcwd(), dirname))

# Define lib_directory, the directory of the .so, one way or another.
if sys.argv[1]== '--run_in_install':
  del sys.argv[1]
  if len(sys.argv) < 2: usage()
  # We are in share/python.
  lib_directory = os.path.join(dirname, "../../lib")
else:
  # We're in the source directory, not in installation.
  place_to_look = directory + '/' + DEFAULT_PATH
  potential_libs = glob.glob(place_to_look)
  # Now potential_libs is supposed to contain the filepaths of dynamically
  # loaded libraries. We expect exactly one such filepath.
  if len(potential_libs) == 0:
    sys.exit("No extension modules of the form '%s' found." %
             place_to_look)
  if len(potential_libs) > 1:
    sys.exit("More than one extension module found. "
             + " Cannot determine which one to use.")
  lib_directory = os.path.dirname(potential_libs[0])
  print "__________Using Python extension in %s" % lib_directory

# Now, the all important change to PYTHONPATH. Note that we obliterate any
# environmental setting setting as well. This improves performance in
# installations with unneeded Python resources on network disks.
os.environ['PYTHONPATH'] = lib_directory

try:
  os.execv(os.path.join(directory, sys.argv[1]), sys.argv[1:])
except OSError:
  print >> sys.stderr, (
    "Could not run: '%s' with arguments: %s" %
    (os.path.join(directory, sys.argv[1]),
     sys.argv[1:]))