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


Python Project.get_dir_naming方法代码示例

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


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

示例1: _get_dir

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_dir_naming [as 别名]


    def _get_dir(protocol,sobject,snapshot,file_type=None, create=False, file_object=None, dir_naming=None):

        dir_naming_expr = dir_naming

        from snapshot import Snapshot, SObjectNotFoundException
        if isinstance(sobject,Snapshot):
            snapshot = sobject
            try:
                sobject = snapshot.get_sobject()
            except SObjectNotFoundException, e:
                pass

        dir_naming = Project.get_dir_naming(sobject)
        dir_naming.set_sobject(sobject)
        dir_naming.set_snapshot(snapshot)
        dir_naming.set_file_type(file_type)
        dir_naming.set_file_object(file_object)
        dir_naming.set_naming(dir_naming_expr)
        dir_naming.set_create(create)
        dir_naming.set_protocol(protocol)
        dirname = dir_naming.get_dir()
        return dirname
    _get_dir = staticmethod(_get_dir)


    def _get_base_dir(protocol, sobject, decrement=0):
        '''decrement is the number of levels it tries to go up the directory'''
        snapshot = None
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:32,代码来源:project.py

示例2: handle_system_commands

# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get_dir_naming [as 别名]
    def handle_system_commands(self, snapshot, files, file_objects):
        '''check into perforce'''
        transaction = PerforceTransaction()


        current_file_paths = snapshot.get_all_lib_paths()

        prev_snapshot = snapshot.get_previous()
        if prev_snapshot:

            prev_file_paths = prev_snapshot.get_all_lib_paths()

            # check if new files already exist in the repo
            for current_file_path in current_file_paths:
                if current_file_path not in prev_file_paths and \
                        os.path.exists(current_file_path):
                    raise CommandException("File '%s' already exists in another asset" % current_file_path)

            # delete all file not in new the snapshot
            for prev_file_path in prev_file_paths:
                if prev_file_path not in current_file_paths:
                    transaction.get_perforce().delete(prev_file_path)


        else:
            # check if new files already exist in the repo
            for current_file_path in current_file_paths:
                if os.path.exists(current_file_path):
                    raise CommandException("File '%s' already exists in another asset" % current_file_path)



        # match perforce sub_dir with tactic sub_dir for the asset
        from pyasm.biz import Project
        project = Project.get()
        naming = Project.get_dir_naming()
        base_lib_dir = naming.get_base_dir("file")[0]
        lib_dir = snapshot.get_lib_dir()


        sub_dir = lib_dir.replace(base_lib_dir, "")
        for i in range( 0, len(files) ):
            transaction.checkin( files[i], sub_dir )


        # add a description
        version = snapshot.get_value("version")
        sobject = snapshot.get_sobject()
        transaction.set_description("Checked in asset '%s', version '%s'" % \
            (sobject.get_code(),version) )

        result = transaction.commit()

        print result

        # get the version of the first file
        files = result.get("files")
        if not files:
            raise PerforceException("No files checked in")

        version = files[0]['version']
        print "setting snapshot to version: %s" % version

        snapshot.set_value("version", version)
        snapshot.commit()
开发者ID:mincau,项目名称:TACTIC,代码行数:67,代码来源:perforce.py


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