コード例 #1
0
ファイル: commands.py プロジェクト: ObjectJS/opm-python
def status(publish_path):
    u''' 检查发布库的编译状态 '''
    publish_path, root_path = StaticPackage.get_roots(publish_path)
    if not publish_path:
        ui.error(u'不是发布库')
        return 1

    package = StaticPackage(root_path, publish_path)

    files = package.get_publish_files()
    for filename in files:
        filetype = os.path.splitext(filename)[1]

        source, mode = package.parse(filename)
        try:
            rfiles = package.get_relation_files(source, all = True)
        except PackageNotFoundException, e:
            ui.error(u'%s package not found' % e.url)
        else:
            modified, not_exists = package.listener.check(filename, rfiles)
            if len(modified) or len(not_exists):
                for modified_file in modified:
                    ui.msg('M ' + modified_file)

                for not_exists_file in not_exists:
                    ui.msg('! ' + not_exists_file)
コード例 #2
0
ファイル: commands.py プロジェクト: ObjectJS/opm-python
def incs(filename, all = False, reverse = False):
    u''' 某文件所有依赖的文件 '''

    filename = os.path.realpath(filename)
    root_path = StaticPackage.get_root(filename)
    package = StaticPackage(root_path)

    filetype = os.path.splitext(filename)[1]

    if reverse:
        if filetype == '.css':
            ui.error(u'Not support yet, sorry.')
            return 1
        else:
            files = package.get_included(filename, all = all)
    else:
        files = package.get_relation_files(filename, all = all)

    for file in files:
        ui.msg(file)