Functions | Variables
srt_ntd0cint Namespace Reference

Functions

def main ()
 MAIN FUNCTION. More...
 

Variables

 result = main()
 

Function Documentation

def srt_ntd0cint.main ( )

MAIN FUNCTION.

1D plots hits vs w //

Definition at line 24 of file srt_ntd0cint.py.

References srt_ntbashutil.compress_path(), and srt_ntbashutil.is_absolute_path().

24 def main():
25 
26  #
27  # Setup and make sure command line stuff is there and cool.
28  #
29 
30  cmd_options = srt_options_line.options_line (sys.argv[1:])
31 
32  if cmd_options.length() == 0:
33  sys.stderr.write("Usage: " + sys.argv[0] + " <arguments>\n")
34  return 1
35 
36  cmd_line = ""
37 
38  #
39  # The local path cache variable
40  #
41 
42  local_path = ""
43 
44  while cmd_options.has_more_options():
45  option = cmd_options.get_next_option ("this should never fail!")
46  if option[0] == "-":
47  option = option[1:]
48  #
49  # I -- An include file
50  #
51 
52  if option[0] == "I":
53  raw_path = option[1:]
54  if not srt_ntbashutil.is_absolute_path(raw_path):
55  if local_path == "":
56  local_path_h = os.popen("pwd", "r")
57  buffer = local_path_h.readline()
58  local_path = buffer[:-1]
59  local_path_h.close()
60  raw_path = local_path + "/" + raw_path
61  translated_path = srt_ntbashutil.translate_path (raw_path)
62  nt_path_list = srt_ntbashutil.resolve_bash_aliases (translated_path)
63  for path in nt_path_list:
64  c_path = srt_ntbashutil.compress_path(path)
65  cmd_line = cmd_line + "-I" + c_path + " "
66 
67  else:
68  cmd_line = cmd_line + "-" + option + " "
69  else:
70  if cmd_options.has_more_options():
71  # print "option=", option
72  # sys.stdout.flush()
73  nt_path = srt_ntbashutil.translate_path (option)
74  # print "nt_path=", nt_path
75  # sys.stdout.flush()
76  cmd_line = cmd_line + nt_path + " "
77  else:
78  cmd_line = cmd_line + option + " "
79 
80  cmd_line = string.translate (cmd_line, string.maketrans("\\", "/"))
81  #print "d0cint " + cmd_line
82  #sys.stdout.flush()
83  cmd_filename = tempfile.mktemp()
84  cmd_file_handle = open (cmd_filename, "w")
85  #print cmd_line
86  #xhandle = open ("/snyder/rel/test/xcmd", "w")
87  #xhandle.write (cmd_line + "\n")
88  #xhandle.close()
89  cmd_file_handle.write (cmd_line + "\n")
90  cmd_file_handle.close()
91  cmd = "bash -c \"d0cint @" + cmd_filename + "\""
92  cmd = string.translate (cmd, string.maketrans("\\", "/"))
93  #print cmd
94  #sys.stdout.flush()
95  result = os.system(cmd)
96  os.unlink (cmd_filename)
97 
98  return result
99 
100 #
101 # Execute the routine and let the shell know what happened.
102 #
def main()
MAIN FUNCTION.
Definition: srt_ntd0cint.py:24
def is_absolute_path(path_name)
def compress_path(nt_path)

Variable Documentation

srt_ntd0cint.result = main()

Definition at line 104 of file srt_ntd0cint.py.