/usr/share/gps/plug-ins/gnatpsta.py is in gnat-gps-common 5.3dfsg-1ubuntu1.
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 | """Display Ada standard package
This script adds a new menu in /Help/GNAT Runtime/Standard to display the
Standard package. This package contains the definition of basic types
for the Ada runtime, but doesn't exist as a file on the disk since it can't
be described in pure Ada.
It properly handles older versions of GNAT, which came with a gnatpsta
command line utility, as well as new versions where the gcc driver itself
must be used.
"""
###########################################################################
## No user customization below this line
############################################################################
from GPS import *
import os, tempfile, os_utils
from gps_utils import *
def on_exit (process, exit_status, output):
if exit_status == 0:
f = file (process.standard, "w")
f.write (output)
f.close ()
buffer = EditorBuffer.get (File (process.standard))
buffer.current_view().set_read_only (True)
Editor.set_title (process.standard,
"package Standard", "package Standard")
os.unlink (process.standard)
@interactive (name="Display standard.ads", menu="/Help/GNAT Runtime/Standard")
def display():
# Two possible ways here: older versions of GNAT still have the
# gnatpsta utility, whereas for more recent versions we need to
# compile a file with -gnatS. Try gnatpsta first:
dir = tempfile.mkdtemp ()
path = None
if os_utils.locate_exec_on_path ("gnatpsta") != "":
proc = Process ("gnatpsta", on_exit=on_exit)
else:
path = dir + "/p.ads"
f = open (path, "w")
f.write ("package p is end p;")
f.close ()
proc = Process \
(Project.root().get_attribute_as_string("gnat", "ide") +
" compile -q -gnatc -gnatS " + path, on_exit=on_exit)
proc.standard = dir + "/_standard.ads"
proc.wait()
if path: os.unlink (path)
os.rmdir (dir)
|