Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: Allow symbolic link to run_metplus.py to run #2500

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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