| 1 |
import logging |
| 2 |
import os.path |
| 3 |
import sys |
| 4 |
|
| 5 |
import argparse |
| 6 |
|
| 7 |
from ohm.version_file_builder import VersionFileBuilder |
| 8 |
|
| 9 |
|
| 10 |
def main(argv): |
| 11 |
parser = argparse.ArgumentParser( |
| 12 |
description="Build .cpp using vcs tool for inclusion in application") |
| 13 |
parser.add_argument('job', choices=['build', 'rebuild', 'clean']) |
| 14 |
parser.add_argument('outfile', type=os.path.normpath, |
| 15 |
help="output .cpp file") |
| 16 |
parser.add_argument('workfile', type=os.path.normpath, |
| 17 |
help="Temp file") |
| 18 |
parser.add_argument("--gitpath", |
| 19 |
help="name of git executable to work with." |
| 20 |
"(default is 'git'", |
| 21 |
default='git') |
| 22 |
|
| 23 |
options = parser.parse_args(argv) |
| 24 |
|
| 25 |
maker = VersionFileBuilder(options.workfile, options.outfile, |
| 26 |
options.gitpath) |
| 27 |
|
| 28 |
logging.basicConfig(level=logging.INFO) |
| 29 |
|
| 30 |
if options.job == "build": |
| 31 |
maker.build() |
| 32 |
else: |
| 33 |
parser.error("Invalid JOB type. Use build, rebuild, or clean.") |
| 34 |
sys.exit(2) |
| 35 |
|
| 36 |
sys.exit(0) |
| 37 |
|
| 38 |
|
| 39 |
if __name__ == "__main__": |
| 40 |
main(sys.argv[1:]) |