6 $ extract_install_filenames gnuradio-core/src/lib/swig/Makefile grgrpython_PYTHON
10 usr/local/lib64/python2.4/site-packages/gnuradio/gr/gnuradio_swig_python.py
11 usr/local/lib64/python2.4/site-packages/gnuradio/gr/gnuradio_swig_py_runtime.py
12 usr/local/lib64/python2.4/site-packages/gnuradio/gr/gnuradio_swig_py_general.py
13 usr/local/lib64/python2.4/site-packages/gnuradio/gr/gnuradio_swig_py_gengen.py
14 usr/local/lib64/python2.4/site-packages/gnuradio/gr/gnuradio_swig_py_filter.py
15 usr/local/lib64/python2.4/site-packages/gnuradio/gr/gnuradio_swig_py_io.py
19 from optparse import OptionParser
25 def make_makefile_tail(dirname, full_var_name):
28 extract_install_filenames:
32 ''' % (dirname, full_var_name)
37 parser = OptionParser(usage="usage: %prog [options] Makefile AM-variable-name")
38 (options, args) = parser.parse_args()
43 makefile_name = args[0]
44 makefile = open(makefile_name, 'r')
45 full_var_name = args[1]
47 L = re.split('_', full_var_name)
48 prefix = '_'.join(L[:-1])
51 #print "prefix= ", prefix
52 #print "suffix= ", suffix
54 if suffix.upper() != suffix:
55 raise SystemExit, "AM-variable-name is malformed. Expected something like grgrpython_PYTHON"
57 if prefix[:5] == "dist_":
58 dirname = prefix[5:] + "dir"
60 dirname = prefix + "dir"
61 #print "dirname =", dirname
63 tail = make_makefile_tail(dirname, full_var_name)
65 tmp_makefile = tempfile.NamedTemporaryFile()
66 #print "tmp_makefile =", tmp_makefile
67 tmp_name = tmp_makefile.name
68 #print "tmp_name =", tmp_name
71 tmp_makefile.write(tail)
74 (head, tail) = os.path.split(makefile_name)
76 # cd to directory that contained the original Makefile
77 cmd = 'cd %s; make -s -f %s extract_install_filenames' % (head, tmp_name)
79 cmd = 'make -s -f %s extract_install_filenames' % (tmp_name,)
82 make = os.popen(cmd, 'r')
83 target_dirname = make.readline().rstrip()
84 target_files = make.readline().rstrip()
85 if target_dirname.startswith('/'):
86 target_dirname = target_dirname[1:]
88 #print "target_dirname =", target_dirname
89 #print "target_files =", target_files
91 for f in target_files.split():
92 sys.stdout.write(os.path.join(target_dirname, f.split('/')[-1]) + '\n')
94 if __name__ == '__main__':