当前位置: 首页>>代码示例>>Python>>正文


Python Properties._Properties__parse方法代码示例

本文整理汇总了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
开发者ID:darong-khalibre,项目名称:liferay-hotterdeploy,代码行数:63,代码来源:deploy.py


注:本文中的pyjavaproperties.Properties._Properties__parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。