Consistent if __name__ == '__main__': bit for all munkilib submodules

This commit is contained in:
Greg Neagle
2016-12-24 08:17:08 -08:00
parent 189e154d5f
commit 10a6950837
20 changed files with 49 additions and 19 deletions

View File

@@ -145,3 +145,5 @@ def writePlistToString(rootObject):
return str(plistData)
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -1660,10 +1660,5 @@ def doAdobeInstall(item):
return retcode
def main():
'''Placeholder'''
pass
if __name__ == '__main__':
main()
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -1863,3 +1863,7 @@ def appleSoftwareUpdatesAvailable(forcecheck=False, suppresscheck=False,
def displayAppleUpdateInfo():
"""Method for drop-in appleupdates replacement; see primary method docs."""
getAppleUpdatesInstance().DisplayAppleUpdateInfo()
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

4
code/client/munkilib/compare.py Executable file → Normal file
View File

@@ -451,3 +451,7 @@ def getInstalledVersion(item_plist):
return "UNKNOWN"
# if we fall through to here we have no idea what version we have
return 'UNKNOWN'
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -47,5 +47,6 @@ ADDITIONAL_HTTP_HEADERS_KEY = 'AdditionalHttpHeaders'
LOGINWINDOW = (
"/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow")
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -631,3 +631,7 @@ def getDataFromURL(url):
except (IOError, OSError), err:
munkicommon.display_warning('Error in getDataFromURL: %s', err)
return ''
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -695,3 +695,7 @@ class Gurl(NSObject):
# we don't actually use the connection argument, so
# pylint: disable=W0613
self.handleReceivedData_(data)
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -225,3 +225,7 @@ def getAppInfoPathsFromBundleComponentPkg(pkg_path):
return [line for line in output.splitlines()
if line.endswith('.app/Contents/Info.plist')]
return []
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

0
code/client/munkilib/info.py Executable file → Normal file
View File

View File

@@ -1276,3 +1276,7 @@ def run(only_unattended=False):
powermgr.removeNoIdleSleepAssertion(no_idle_sleep_assertion_id)
return removals_need_restart or installs_need_restart
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -568,3 +568,7 @@ class MunkiKeychain(object):
'''Remove our keychain from the keychain list if we added it'''
if self.added_keychain:
remove_from_keychain_list(self.keychain_path)
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -174,11 +174,5 @@ class Job(object):
return None
def main():
'''placeholder'''
pass
if __name__ == '__main__':
main()
print 'This is a library of support tools for the Munki Suite.'

0
code/client/munkilib/manifestutils.py Executable file → Normal file
View File

0
code/client/munkilib/munkicommon.py Executable file → Normal file
View File

0
code/client/munkilib/munkihash.py Executable file → Normal file
View File

View File

@@ -156,3 +156,6 @@ def restartAlert():
# should not persist between notifications
_currentStatus['command'] = ''
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -73,3 +73,7 @@ def assertNoIdleSleep():
def removeNoIdleSleepAssertion(assertion_id):
"""Uses IOKit functions to remove a "no idle sleep" assertion."""
return libIOKit.IOPMAssertionRelease(assertion_id)
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -277,3 +277,7 @@ def profile_is_installed(identifier):
munkicommon.display_debug2(
'Profile identifier %s is not installed.' % identifier)
return False
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'

7
code/client/munkilib/updatecheck.py Executable file → Normal file
View File

@@ -2718,10 +2718,5 @@ def getPrimaryManifestCatalogs(client_id='', force_refresh=False):
return cataloglist
def main():
"""Placeholder"""
pass
if __name__ == '__main__':
main()
print 'This is a library of support tools for the Munki Suite.'

View File

@@ -202,3 +202,7 @@ def getFirstPlist(textString):
plist_end_index = plist_end_index + len(plist_footer)
return (textString[plist_start_index:plist_end_index],
textString[plist_end_index:])
if __name__ == '__main__':
print 'This is a library of support tools for the Munki Suite.'