Files
DistMaker/script/logUtils.py
Norberto Lopez 5961d129f9 Updates to DistMaker scripts:
[1] Updated variable names to reflect standardized naming convention.
[2] Added requirement check for Python 2.7 or later
[3] Added requirement check for Java 1.8 or later when building a distribution
[4] Added preliminary support for platform architectures (initial support for x64)
[5] Switched over to GNU style argument conventions rather than UNIX style conventions. Essentially DistMaker arguments require double dashes rather than single dashes.
[6] Added support for zip JREs (in addition to tar.gz files)
[7] Switched over to JRE catalog mechanism.
[7.1] A catalog file must be specified via '--jreCatalog' that lists all available JREs. See example file ./template/JreCatalog.txt
[7.2]  Eliminated file naming convention criteria for JRE file names. The only requirement is the file must end in .tar.gz or .zip
[8] Updated platform naming conventions ('Apple' → 'Macosx')
2020-05-01 23:46:23 +00:00

37 lines
1.0 KiB
Python

import hashlib
import os
import time
import sys
# Globals
indentStr = ' '
def appendLogOutputWithText(aStr, aText):
""" Method which given a string from a log will insert all occurances of newlines with the
specified text. Note if the last character is a newline then it will be stripped before the replacement"""
if aStr.endswith("\n") == True:
aStr = aStr[:-1]
retStr = aText + aStr.replace('\n', '\n' + aText)
return retStr;
def errPrintln(aMsg=""):
"""Print the specified string with a trailing newline to stderr."""
aMsg = aMsg.replace('\t', indentStr)
sys.stderr.write(aMsg + '\n')
def regPrintln(aMsg=""):
"""Print the specified string with a trailing newline to stdout."""
aMsg = aMsg.replace('\t', indentStr)
sys.stdout.write(aMsg + '\n')
def setIndentStr(aStr):
"""Sets in the string that will be used as the "indent" text. Any future
calls to the methods errPrintln() and regPrintln() will have any textual
tab characters automatically replaced with the specified string."""
global indentStr
indentStr = aStr