Build.py 文件源码

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

项目:SoCFoundationFlow 作者: mattaw 项目源码 文件源码
def store(self):
        """
        Store the data for next runs, sets the attributes listed in :py:const:`waflib.Build.SAVED_ATTRS`. Uses a temporary
        file to avoid problems on ctrl+c.
        """

        data = {}
        for x in SAVED_ATTRS:
            data[x] = getattr(self, x)
        db = os.path.join(self.variant_dir, Context.DBFILE)

        try:
            waflib.Node.pickle_lock.acquire()
            waflib.Node.Nod3 = self.node_class
            x = cPickle.dumps(data, PROTOCOL)
        finally:
            waflib.Node.pickle_lock.release()

        Utils.writef(db + '.tmp', x, m='wb')

        try:
            st = os.stat(db)
            os.remove(db)
            if not Utils.is_win32: # win32 has no chown but we're paranoid
                os.chown(db + '.tmp', st.st_uid, st.st_gid)
        except (AttributeError, OSError):
            pass

        # do not use shutil.move (copy is not thread-safe)
        os.rename(db + '.tmp', db)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号