Project

General

Profile

« Previous | Next » 

Revision 3569

src_map: Also add columns for the output mappings and comments, so that the src map can be directly copied for use as the via map (DwC.specimens.csv, etc.). The output mapping column name must be provided by the caller, which input.Makefile maps/src.%.csv provides using the new mappings roots.

View differences:

inputs/input.Makefile
182 182

  
183 183
srcMaps := $(wildcard maps/src.*.csv)
184 184

  
185
mkSrcMap = $(catSrcs)|env datasrc=$(datasrc) $(bin)/src_map >$@
185
srcRoot = $(mappings)/roots/$*.sh
186
mkSrcMap = $(catSrcs)|(. $(srcRoot); env datasrc=$(datasrc) $(bin)/src_map >$@)
186 187

  
187 188
# Src maps cleanup
188 189
ifneq ($(filter maps/.%.last_cleanup,$(MAKECMDGOALS)),)
bin/src_map
19 19
    
20 20
    # Get config from env vars
21 21
    datasrc = opts.get_env_var('datasrc', None, env_names)
22
    if datasrc == None: usage_err()
22
    out_root = opts.get_env_var('out_root', None, env_names)
23
    in_root_suffix = opts.get_env_var('in_root_suffix', '', env_names)
24
    if datasrc == None or out_root == None: usage_err()
23 25
    
24 26
    # Get col names
25 27
    reader, col_names = csvs.reader_and_header(sys.stdin)
26 28
    
27 29
    # Write map spreadsheet
28 30
    writer = csv.writer(sys.stdout)
29
    writer.writerow([datasrc])
31
    writer.writerow([datasrc+in_root_suffix, out_root, 'Comments'])
30 32
    for col_name in col_names:
31 33
        writer.writerow([col_name])
32 34

  

Also available in: Unified diff