Skip to content

Commit

Permalink
Merge remote-tracking branch 'release/integration' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
atsareg committed Mar 16, 2021
2 parents f9cd6bd + a0b54d8 commit 91eb041
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/DIRAC/Core/Base/Script.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

localCfg = LocalConfiguration()

doc = inspect.currentframe().f_back.f_globals['__doc__']
caller = inspect.currentframe().f_back.f_globals['__name__']


Expand Down Expand Up @@ -51,12 +50,19 @@
scriptName = os.path.basename(sys.argv[i].split('::')[0]).replace('.py', '')
# The first argument DIRAC should parse is the next one
localCfg.firstOptionIndex = i + 1
# Read and parse the script __doc__ to create a draft help message
localCfg.setUsageMessage(doc)

gIsAlreadySetUsageMsg = False
gIsAlreadyInitialized = False


def parseCommandLine(script=False, ignoreErrors=False, initializeMonitor=False):
global gIsAlreadySetUsageMsg, gIsAlreadyInitialized

# Read and parse the script __doc__ to create a draft help message
if not gIsAlreadySetUsageMsg:
localCfg.setUsageMessage(inspect.currentframe().f_back.f_globals['__doc__'])
gIsAlreadySetUsageMsg = True

if gIsAlreadyInitialized:
return False
gLogger.showHeaders(False)
Expand Down Expand Up @@ -126,6 +132,9 @@ def addDefaultOptionValue(option, value):


def setUsageMessage(usageMessage):
global gIsAlreadySetUsageMsg
gIsAlreadySetUsageMsg = True
localCfg.setUsageMessage(inspect.currentframe().f_back.f_globals['__doc__'])
localCfg.setUsageMessage(usageMessage)


Expand Down

0 comments on commit 91eb041

Please sign in to comment.