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


Python Xml.read_file方法代码示例

本文整理汇总了Python中pyasm.common.Xml.read_file方法的典型用法代码示例。如果您正苦于以下问题:Python Xml.read_file方法的具体用法?Python Xml.read_file怎么用?Python Xml.read_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.common.Xml的用法示例。


在下文中一共展示了Xml.read_file方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_plugin_data

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import read_file [as 别名]
    def get_plugin_data(my, reldir):

        manifest_path = "%s/%s/manifest.xml" % (my.base_dir, reldir)
        xml = Xml()
        xml.read_file(manifest_path)
        node = xml.get_node("manifest/data")
        data = xml.get_node_values_of_children(node)

        return data
开发者ID:0-T-0,项目名称:TACTIC,代码行数:11,代码来源:plugin_util.py

示例2: _read_ref_file

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import read_file [as 别名]
    def _read_ref_file(my):
        '''read the reference file containing extra node information'''
        dir = my.get_upload_dir()
        xml = Xml()
        key = my.sobject.get_code()

        # make this filename good for the file system
        filename = File.get_filesystem_name(key)
        xml.read_file( "%s/%s-ref.xml" % (dir,filename) )
        return xml
开发者ID:0-T-0,项目名称:TACTIC,代码行数:12,代码来源:flash_publish_cmd.py

示例3: import_schema

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import read_file [as 别名]
def import_schema(plugin_code):
    from pyasm.search import Transaction
    transaction = Transaction.get(create=True)

    install_dir = Environment.get_install_dir()
    base_dir = Environment.get_plugin_dir()
    template_dir = "%s/%s" % (base_dir, plugin_code)
    manifest_path = "%s/manifest.xml" % (template_dir)
    print "Reading manifest: ", manifest_path

    xml = Xml()
    xml.read_file(manifest_path)

    # create a new project
    installer = PluginInstaller(base_dir=base_dir, manifest=xml.to_string() )
    installer.execute()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:18,代码来源:bootstrap_load.py

示例4: postprocess

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import read_file [as 别名]
    def postprocess(my):
        super(FlashAssetPublishCmd, my).postprocess()

        # parse the introspect file
        code = my.sobject.get_code()
       
        upload_dir = my.get_upload_dir()
        introspect_path = "%s/%s.xml" % (upload_dir, code)

        xml = Xml()
        xml.read_file(introspect_path)

        flash_layer_names = xml.get_values("introspect/layers/layer/@name")
        if not flash_layer_names:
            return

        # extract the layers from the flash layer_names
        layer_names = []
        for flash_layer_name in flash_layer_names:
            if flash_layer_name.find(":") == -1:
                continue
            layer_name, instance_name = flash_layer_name.split(":")

            # make sure it is unique
            if layer_name not in layer_names:
                layer_names.append(layer_name)

        base_key = my.sobject.get_search_type_obj().get_base_key()

        # TODO: make the flash shot tab run FlashShotPublishCmd instead
        # and move this postprocess there
        # this is not meant for flash/asset, but for flash/shot
        if base_key == 'flash/asset' or not layer_names:
            return

        # get all of the layers in this shot and compare to the session
        existing_layers = my.sobject.get_all_children("prod/layer")
        existing_layer_names = SObject.get_values(existing_layers,"name")
        for layer_name in layer_names:
            if layer_name not in existing_layer_names:
                print "creating ", layer_name
                Layer.create(layer_name, code)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:44,代码来源:flash_publish_cmd.py

示例5: get_plugins_data

# 需要导入模块: from pyasm.common import Xml [as 别名]
# 或者: from pyasm.common.Xml import read_file [as 别名]
    def get_plugins_data(my, plugin_type=None):

        plugins_data = {}
        for root, dirnames, basenames in os.walk(my.base_dir):

            reldir = root.replace(my.base_dir + "/", "")

            if "manifest.xml" in basenames:

                manifest_path = "%s/manifest.xml" % root
                xml = Xml()
                xml.read_file(manifest_path)

                node = xml.get_node("manifest/data")
                data = xml.get_node_values_of_children(node)

                if plugin_type and not data.get("type") == plugin_type:
                    continue

                plugins_data[reldir] = data


        return plugins_data
开发者ID:blezek,项目名称:TACTIC,代码行数:25,代码来源:plugin_util.py


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