From cee7b633123e114aa1f5635680cb7d9df592d924 Mon Sep 17 00:00:00 2001 From: Dakota Benjamin Date: Fri, 10 Mar 2017 14:36:16 -0500 Subject: [PATCH] Add --version parameter and version tracking --- VERSION | 1 + opendm/config.py | 6 +++++- run.py | 11 +++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..f55f8fd9 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3-development \ No newline at end of file diff --git a/opendm/config.py b/opendm/config.py index c205b881..ae36803d 100644 --- a/opendm/config.py +++ b/opendm/config.py @@ -332,6 +332,10 @@ def config(): help='Generates a benchmark file with runtime info\n' 'Default: %(default)s') - #TODO: Add version, gdal options + #TODO: Add gdal options + parser.add_argument('--version', + action='store_true', + default=False, + help='Displays version number and exits. ') return parser.parse_args() diff --git a/run.py b/run.py index 368de568..3d017144 100644 --- a/run.py +++ b/run.py @@ -4,6 +4,7 @@ from opendm import log from opendm import config from opendm import system from opendm import io +from opendm import context import sys import ecto @@ -11,6 +12,9 @@ import os from scripts.odm_app import ODMApp +with open(io.join_paths(context.root_path, 'VERSION')) as version_file: + __version__ = version_file.read().strip() + def usage(): log.ODM_ERROR('You must specify a project name:') @@ -21,10 +25,13 @@ def usage(): if __name__ == '__main__': - log.ODM_INFO('Initializing OpenDroneMap app - %s' % system.now()) - args = config.config() + if args.version: + log.ODM_INFO(__version__) + sys.exit(0) + + log.ODM_INFO('Initializing OpenDroneMap app - %s' % system.now()) # Force to provide the images path if args.project_path is None: