2020project files and don't need this info."""
2121
2222import json , pickle
23- from . import coredata , build , mesonlib
23+ from . import coredata , build
2424import argparse
2525import sys , os
2626
4141 help = 'list external dependencies.' )
4242parser .add_argument ('args' , nargs = '+' )
4343
44- def list_targets (coredata , builddata ):
44+ def determine_installed_path (target , installdata ):
45+ install_target = None
46+ for i in installdata .targets :
47+ if os .path .split (i [0 ])[1 ] == target .get_filename (): # FIXME, might clash due to subprojects.
48+ install_target = i
49+ break
50+ if install_target is None :
51+ raise RuntimeError ('Something weird happened. File a bug.' )
52+ fname = i [0 ]
53+ outdir = i [1 ]
54+ outname = os .path .join (installdata .prefix , outdir , os .path .split (fname )[- 1 ])
55+ return outname
56+
57+ def list_targets (coredata , builddata , installdata ):
4558 tlist = []
4659 for (idname , target ) in builddata .get_targets ().items ():
4760 t = {}
@@ -68,6 +81,7 @@ def list_targets(coredata, builddata):
6881 t ['type' ] = typename
6982 if target .should_install ():
7083 t ['installed' ] = True
84+ t ['install_filename' ] = determine_installed_path (target , installdata )
7185 else :
7286 t ['installed' ] = False
7387 tlist .append (t )
@@ -173,18 +187,21 @@ def run(args):
173187 bdir = ''
174188 corefile = os .path .join (bdir , 'meson-private/coredata.dat' )
175189 buildfile = os .path .join (bdir , 'meson-private/build.dat' )
190+ installfile = os .path .join (bdir , 'meson-private/install.dat' )
176191 testfile = os .path .join (bdir , 'meson-private/meson_test_setup.dat' )
177192 benchmarkfile = os .path .join (bdir , 'meson-private/meson_benchmark_setup.dat' )
178193 with open (corefile , 'rb' ) as f :
179194 coredata = pickle .load (f )
180195 with open (buildfile , 'rb' ) as f :
181196 builddata = pickle .load (f )
182197 with open (testfile , 'rb' ) as f :
183- testdata = pickle .load (f )
198+ testdata = pickle .load (f )
184199 with open (benchmarkfile , 'rb' ) as f :
185- benchmarkdata = pickle .load (f )
200+ benchmarkdata = pickle .load (f )
201+ with open (installfile , 'rb' ) as f :
202+ installdata = pickle .load (f )
186203 if options .list_targets :
187- list_targets (coredata , builddata )
204+ list_targets (coredata , builddata , installdata )
188205 elif options .target_files is not None :
189206 list_target_files (options .target_files , coredata , builddata )
190207 elif options .buildsystem_files :
0 commit comments