From f53f0c377fec64b559a9e81c5c7e863736877154 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@8a9318a1-56ba-4d59-b755-99d26321be01> Date: Sat, 1 Oct 2011 00:01:18 +0000 Subject: [PATCH] adding return code for reportGen git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@148 8a9318a1-56ba-4d59-b755-99d26321be01 --- pyglance/glance/compare.py | 16 +++++++++++++--- pyglance/setup.py | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pyglance/glance/compare.py b/pyglance/glance/compare.py index 77f7ab9..40555df 100644 --- a/pyglance/glance/compare.py +++ b/pyglance/glance/compare.py @@ -1265,6 +1265,10 @@ def reportGen_library_call (a_path, b_path, var_list=[ ], optional boolean values. this needs more work.) """ + # have all the variables passed test criteria set for them? + # if no criteria were set then this will be true + didPassAll = True + # load the user settings from either the command line or a user defined config file pathsTemp, runInfo, defaultValues, requestedNames, usedConfigFile = _load_config_or_options(a_path, b_path, options_set, @@ -1279,7 +1283,7 @@ def reportGen_library_call (a_path, b_path, var_list=[ ], if (not runInfo['shouldIncludeImages']) and (not runInfo['shouldIncludeReport']) : LOG.warn("User selection of no image generation and no report generation will result in no " + "content being generated. Aborting generation function.") - return + return 0 # nothing went wrong, we just had nothing to do! # hang onto info to identify who/what/when/where/etc. the report is being run by/for runInfo.update(_get_run_identification_info( )) @@ -1420,6 +1424,9 @@ def reportGen_library_call (a_path, b_path, var_list=[ ], non_finite_fail_fraction, \ r_squared_value = _check_pass_or_fail(varRunInfo, variable_stats, defaultValues) varRunInfo['did_pass'] = didPass + # update the overall pass status + if didPass is not None : + didPassAll = didPassAll & didPass # based on the settings and whether the variable passsed or failed, # should we include images for this variable? @@ -1568,7 +1575,10 @@ def reportGen_library_call (a_path, b_path, var_list=[ ], print ('generating glossary') report.generate_and_save_doc_page(statistics.StatisticalAnalysis.doc_strings(), pathsTemp['out']) - return + returnCode = 0 if didPassAll else 2 # return 2 only if some of the variables failed + + LOG.debug("Pass/Fail return code: " + str(returnCode)) + return returnCode def stats_library_call(afn, bfn, var_list=[ ], options_set={ }, @@ -1848,7 +1858,7 @@ python -m glance a_path = _clean_path(args[0]) b_path = _clean_path(args[1]) - reportGen_library_call(a_path, b_path, args[2:], tempOptions) + return reportGen_library_call(a_path, b_path, args[2:], tempOptions) def colocateData(*args) : """colocate data in two files diff --git a/pyglance/setup.py b/pyglance/setup.py index 3ce3703..ba4c26e 100644 --- a/pyglance/setup.py +++ b/pyglance/setup.py @@ -22,7 +22,7 @@ easy_install -d $HOME/Library/Python -vi http://larch.ssec.wisc.edu/eggs/repos g from setuptools import setup, find_packages setup( name="glance", - version="0.2.6.27", + version="0.2.6.28", zip_safe = True, entry_points = { 'console_scripts': [ 'glance = glance.compare:main' ] }, packages = find_packages('.'), -- GitLab