Skip to content

Commit

Permalink
Hotfix: Allow symbolic link to run_metplus.py to run (#2500)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Feb 15, 2024
1 parent 8a96e99 commit a81bf93
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions ush/run_metplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
f-string instead of the useful error message.
"""

import os
from os.path import abspath, join, dirname, realpath, basename
from os import pardir
import sys
import traceback

################################################################################
# add metplus directory to path so the wrappers and utilities can be found
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),
os.pardir)))
sys.path.insert(0, abspath(join(dirname(realpath(__file__)), pardir)))

import produtil.setup

Expand All @@ -44,8 +45,7 @@ def main():
return False

# warn if calling master_metplus.py
script_name = os.path.basename(__file__)
if script_name == 'master_metplus.py':
if basename(__file__) == 'master_metplus.py':
msg = ("master_metplus.py has been renamed to run_metplus.py. "
"This script name will be removed in a future version.")
config.logger.warning(msg)
Expand All @@ -56,11 +56,7 @@ def main():


def usage():
"""! How to call this script.
"""

filename = os.path.basename(__file__)

"""!How to call this script."""
print ('''
Usage: %s arg1 arg2 arg3
-h|--help Display this usage statement
Expand All @@ -69,7 +65,7 @@ def usage():
/path/to/parmfile.conf -- Specify custom configuration file to use
section.option=value -- override conf options on the command line
'''%(filename))
'''%(basename(__file__)))
sys.exit(2)


Expand Down

0 comments on commit a81bf93

Please sign in to comment.