Revision 6626
Added by Aaron Marcuse-Kubitza almost 12 years ago
dict2redmine | ||
---|---|---|
1 | 1 |
#!/usr/bin/env python |
2 | 2 |
# Translates a data dictionary spreadsheet to Redmine formatting |
3 |
# Spreadsheet must have columns <Term>|...|Sources |
|
4 |
# - <Term> can be any name |
|
5 |
# Usage: self <spreadsheet >redmine |
|
6 | 3 |
|
7 | 4 |
import csv |
8 | 5 |
import re |
... | ... | |
10 | 7 |
|
11 | 8 |
# Spreadsheet format |
12 | 9 |
source_sep = ', ' |
13 |
term_col = 0 |
|
14 | 10 |
|
15 | 11 |
##### URLs |
16 | 12 |
|
... | ... | |
42 | 38 |
|
43 | 39 |
|
44 | 40 |
def main(): |
41 |
try: _prog_name, term_col, sources_col = sys.argv |
|
42 |
except ValueError: raise SystemExit('Usage: '+sys.argv[0] |
|
43 |
+' <spreadsheet term_col# sources_col# >redmine') |
|
44 |
term_col, sources_col = map(int, [term_col, sources_col]) |
|
45 |
|
|
45 | 46 |
# Determine column order |
46 | 47 |
reader = csv.reader(sys.stdin) |
47 | 48 |
header = reader.next() |
48 |
sources_col = header.index('Sources') |
|
49 | 49 |
|
50 | 50 |
# Translate input |
51 | 51 |
writer = RedmineTableWriter(sys.stdout) |
Also available in: Unified diff
dict2redmine: Take term and sources col #s as args instead of hardcoding them by column name or position