本文整理匯總了Python中pyjavaproperties.Properties._Properties__parse方法的典型用法代碼示例。如果您正苦於以下問題:Python Properties._Properties__parse方法的具體用法?Python Properties._Properties__parse怎麽用?Python Properties._Properties__parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyjavaproperties.Properties
的用法示例。
在下文中一共展示了Properties._Properties__parse方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_for_lib_diffs
# 需要導入模塊: from pyjavaproperties import Properties [as 別名]
# 或者: from pyjavaproperties.Properties import _Properties__parse [as 別名]
def check_for_lib_diffs(war_path, temp_portlet_path):
'''
Checks whether the jars in a war and on a deployed path are the same
'''
jars = {}
# Calculate crc32 for all deployed jars
webinf_lib_dir = os.path.join(temp_portlet_path, 'WEB-INF/lib/')
if os.path.exists(webinf_lib_dir):
for lib in os.listdir(webinf_lib_dir):
path = os.path.join(temp_portlet_path, 'WEB-INF/lib/', lib)
if os.path.isfile(path):
with open(os.path.join(temp_portlet_path, 'WEB-INF/lib/', lib)) as jar:
jars['WEB-INF/lib/'+lib] = binascii.crc32(jar.read())
else:
jars['WEB-INF/lib/'+lib] = None # directory assume changed
# Process the war to be deployed
with ZipFile(war_path, 'r') as war:
# Process liferay dependencies
dep_jars = ['util-taglib.jar', 'util-java.jar', 'util-bridges.jar']
try:
with war.open('WEB-INF/liferay-plugin-package.properties') as prop:
p = Properties()
# p.load(prop) does not work
p._Properties__parse(prop.readlines())
dep_jars.extend(p['portal-dependency-jars'].split(','))
except KeyError:
pass
for jar in dep_jars:
jars['WEB-INF/lib/'+jar] = 'LR_DEP'
# Calculate crc32 for jars in war
for info in war.infolist():
if info.filename.startswith('WEB-INF/lib/') and not info.filename == 'WEB-INF/lib/':
crc = jars.get(info.filename, None)
if crc:
with war.open(info.filename) as lib:
crco = binascii.crc32(lib.read()) # info.CRC
jars[info.filename] = crco == crc
else:
jars[info.filename] = None
# Iterate the file listing to check for missing/outdated/lingering
# files
needs_undeploy = False
for filename, crc in jars.items():
if crc == 'LR_DEP':
pass
elif crc is True:
pass
elif crc is None:
LOG.info('{0} is missing'.format(filename))
elif crc is False:
LOG.info('{0} is out of date'.format(filename))
needs_undeploy = True
else:
LOG.info('{0} is lingering'.format(filename))
needs_undeploy = True
return needs_undeploy