This file is indexed.

/usr/bin/pyraf is in python3-pyraf 2.1.14+dfsg-6.

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
 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/usr/bin/python3
"""
Copyright (C) 2003 Association of Universities for Research in Astronomy
(AURA)
See LICENSE.txt in the docs directory of the source distribution for the
terms of use.

Usage: pyraf [options] [savefile]

where savefile is an optional save file to start from, and options are:
  -c cmd  Command passed in as string (any valid PyRAF command)
  -e      Turn on ECL mode
  -h      Print this message
  -i      No command line wrapper, just run standard interactive Python shell
  -m      Run command line wrapper to provide extra capabilities (default)
  -n      No splash screen during startup (also see -x)
  -s      Silent initialization (does not print startup messages)
  -V      Print version info and exit
  -v      Set verbosity level (may be repeated to increase verbosity)
  -x      No graphics will be attempted/loaded during session
  -y      Run the IPython shell instead of the normal PyRAF command shell

Long versions of options:
  -c  --comand=<cmd>
  -e  --ecl
  -h  --help
  -i  --commandwrapper=no
  -m  --commandwrapper=yes
  -n  --nosplash
  -s  --silent
  -V  --version
  -v  --verbose
  -x  --nographics
  -y  --ipython
"""

# $Id$
#
# R. White, 2000 January 21

from __future__ import division
import sys, os, shutil

# set search path to include directory above this script and current directory
# ... but do not want the pyraf package directory itself in the path, since
# that messes things up by allowing direct imports of pyraf submodules
# (bypassing the __init__ mechanism.)

# follow links to get to the real executable filename
executable = sys.argv[0]
while os.path.islink(executable):
    executable = os.readlink(executable)
pyrafDir = os.path.dirname(executable)
del executable
try:
    sys.path.remove(pyrafDir)
except ValueError:
    pass
del pyrafDir

if "." not in sys.path: sys.path.insert(0, ".")

# allow the use of PYRAF_ARGS
extraArgs = os.getenv('PYRAF_ARGS', '').strip()
extraArgsList = [x for x in extraArgs.split(' ') if len(x)]
if len(extraArgsList):
    sys.argv.extend(extraArgsList)
x = None
del extraArgs, extraArgsList, x

# handle any warning supression right away, before any more imports
if '-s' in sys.argv or '--silent' in sys.argv:
    import warnings
    warnings.simplefilter("ignore")
    del warnings

# allow them to specifiy no graphics, done before any imports
if '-x' in sys.argv or '--nographics' in sys.argv:
    os.environ['PYRAF_NO_DISPLAY'] = '1' # what the rest of PyRAF triggers on
    if '-x' in sys.argv: # keep the option parsing simpler when we get to it
        sys.argv.remove('-x')
    else:
        sys.argv.remove('--nographics')

# read the user's startup file (if there is one)
if 'PYTHONSTARTUP' in os.environ and \
                os.path.isfile(os.environ["PYTHONSTARTUP"]):
    exec(compile(open(os.environ["PYTHONSTARTUP"]).read(), os.environ["PYTHONSTARTUP"], 'exec'))

#------------------------------------------------------------------------------
# In next line we get into pyraf's __init__.py - this does ALL KINDS OF THINGS
#------------------------------------------------------------------------------
from pyraf import doCmdline, _use_ipython_shell, runCmd, __version__
# By now, the bulk of the startup work is done
from pyraf import iraf
from pyraf.irafpar import makeIrafPar
from stsci.tools.irafglobals import yes, no, INDEF, EOF
logout = quit = exit = 'Use ".exit" to exit'

# IPython Pyraf profile RC installation - this is only done so that the next
# step (below) can find/run the rc file (to execute some pyraf magic setup)
if _use_ipython_shell:
    # the following should be removed soon, it is only used for versions
    # of IPython older than 0.11
    import pyraf
    home = None
    ip = os.getenv("IPYTHONDIR")
    if not ip:
        home = os.getenv("HOME") or ""
        ip = os.path.join(home, ".ipython")

    pyrafrc_dest = os.path.join(ip,"ipythonrc-pyraf")
    pyrafrc_source = os.path.join(os.path.split(pyraf.__file__)[0],
                                  "ipythonrc-pyraf")
    if os.path.exists(ip):
        if not os.path.exists(pyrafrc_dest):
            shutil.copy(pyrafrc_source, pyrafrc_dest)
    else:
        os.mkdir(ip)
        shutil.copy(pyrafrc_source, pyrafrc_dest)
    del pyraf, home, ip, pyrafrc_dest, pyrafrc_source
else:
    if '-s' not in sys.argv and '--silent' not in sys.argv:
       print("PyRAF"+' '+__version__+' '+"Copyright (c) 2002 AURA")
       # just print first line of Python copyright (long in v2.0)
       print("Python"+' '+sys.version.split()[0]+' '+sys.copyright.split('\n')[0])

# Run given command
if runCmd:
    iraf.task(cmd_line=runCmd, IsCmdString=1)
    iraf.cmd_line()
    sys.exit()
else:
    del runCmd

# Start command line
if doCmdline:
    del doCmdline
    # Start up command line wrapper keeping definitions in main name space
    # Keep the command-line object in namespace too for access to history
    if _use_ipython_shell:
        import sys
        import IPython

        # rewrite sys.argv
        new_argv = ["ipython",]
        if hasattr(IPython, 'Shell'): # old versions
           if '-s' in sys.argv or '--silent' in sys.argv: new_argv.append("-nobanner")
           new_argv.append("-p")
           new_argv.append("pyraf")
        else:
           if '-s' in sys.argv or '--silent' in sys.argv: new_argv.append("--no-banner")
        sys.argv = new_argv[:]; del new_argv

        if hasattr(IPython, 'Shell'): # old IPython versions
           IPython.Shell.start(user_ns=globals()).mainloop()
        else:
           # Start the interactive shell.  Also, see IPython.embed() here:
           #     http://ipython.org/ipython-doc/stable/interactive/ \
           #     reference.html#embedding-ipython
           try:
              # new location of terminal as of v1.*
              from IPython.terminal.ipapp import TerminalIPythonApp
           except:
              from IPython.frontend.terminal.ipapp import TerminalIPythonApp
# was:     from ..... import TerminalInteractiveShell
           app = TerminalIPythonApp.instance()
           app.initialize()
           # import pyraf to write this shell obj to its namespace
           # we have already fully imported it above
           import pyraf
           # create and run the Ipython shell - it takes over from here
           pyraf._ipyshell = app.shell
# was:     pyraf._ipyshell = TerminalInteractiveShell(user_ns=globals())
           # in the end, with this run_code(), all of this is the equivalent
           # of simply running ipython standalone with these imports
           pyraf._ipyshell.run_code('from pyraf import iraf, ipython_api; from stsci.tools.irafglobals import INDEF, Verbose, yes, no')
           app.start()
# was:     pyraf._ipyshell.mainloop()
        sys.exit()
    else:
        import pyraf.pycmdline
        del _use_ipython_shell
        _pycmdline = pyraf.pycmdline.PyCmdLine(locals=globals())
        if '-s' in sys.argv or '--silent' in sys.argv:
           _pycmdline.start('') # use no banner
        else:
           _pycmdline.start() # use default banner
else:
    del doCmdline
    # run the standard Python interpreter
    import code
    code.interact(local=locals())