post_update.py 文件源码

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

项目:Docker-XX-Net 作者: kuanghy 项目源码 文件源码
def run(last_run_version):
    if config.get(["modules", "launcher", "auto_start"], 0):
        import autorun
        autorun.enable()

    if os.path.isdir(os.path.join(top_path, 'launcher')):
        shutil.rmtree(os.path.join(top_path, 'launcher')) # launcher is for auto-update from 2.X

    if older_or_equal(last_run_version, '3.0.4'):
        xlog.info("migrating to 3.x.x")
        for filename in os.listdir(top_path):
            filepath = os.path.join(top_path, filename)
            if os.path.isfile(filepath):
                if sys.platform != 'win32' and filename == 'start':
                    st = os.stat(filepath)
                    os.chmod(filepath, st.st_mode | stat.S_IEXEC)
                if not filename.startswith('.') and filename not in ['README.md', 'start', 'start.bat', 'start.vbs']:
                    os.remove(filepath)
            else:
                if not filename.startswith('.') and filename not in ['code', 'data']:
                    shutil.rmtree(filepath)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号