__init__.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:build-calibre 作者: kovidgoyal 项目源码 文件源码
def create_app_clone(self, name, specialise_plist, remove_doc_types=True):
        print('\nCreating ' + name)
        cc_dir = os.path.join(self.contents_dir, name, 'Contents')
        exe_dir = join(cc_dir, 'MacOS')
        os.makedirs(exe_dir)
        for x in os.listdir(self.contents_dir):
            if x.endswith('.app'):
                continue
            if x == 'Info.plist':
                plist = plistlib.readPlist(join(self.contents_dir, x))
                specialise_plist(plist)
                if remove_doc_types:
                    plist.pop('CFBundleDocumentTypes')
                exe = plist['CFBundleExecutable']
                # We cannot symlink the bundle executable as if we do,
                # codesigning fails
                nexe = plist['CFBundleExecutable'] = exe + '-placeholder-for-codesigning'
                shutil.copy2(join(self.contents_dir, 'MacOS', exe), join(exe_dir, nexe))
                exe = join(exe_dir, plist['CFBundleExecutable'])
                plistlib.writePlist(plist, join(cc_dir, x))
            elif x == 'MacOS':
                for item in os.listdir(join(self.contents_dir, 'MacOS')):
                    os.symlink('../../../MacOS/' + item, join(exe_dir, item))
            else:
                os.symlink(join('../..', x), join(cc_dir, x))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号