博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python学习笔记
阅读量:4699 次
发布时间:2019-06-09

本文共 2343 字,大约阅读时间需要 7 分钟。

1. Directory,Regex search, Argparse

import argparseimport platformparser = argparse.ArgumentParser()parser.add_argument("-t", "--test", action="store_true", help="do local test with sphinx.")parser.add_argument("-s", "--skip", default = False, action="store_true", help="skip doxygen which is very slow")parser.add_argument("-c", "--clean", default = False, action="store_true", help="clean all temporary files")parser.add_argument("-w", "--wiki", default = False, action="store_true", help="test with confluence wiki format")args = parser.parse_args()def copytree(src, dst):    names = os.listdir(src)    for name in names:        srcname = os.path.join(src, name)        dstname = os.path.join(dst, name)        shutil.copy(srcname, dstname)                def rmdir(path):    if os.path.exists(path):        shutil.rmtree(path)def purge(dir, pattern = ".*\.rest"):    for f in os.listdir(dir):        if re.search(pattern, f):            os.remove(os.path.join(dir, f))                    current_path = os.path.abspath(os.path.dirname(__file__))print(current_path)if(args.clean):    print("Cleaning doxygen files...")    rmdir(os.path.join(current_path, "doxygen", "_doxygen"))    print("Cleaning output files...")    rmdir(os.path.join(current_path, "output", "images"))    rmdir(os.path.join(current_path, "output", "_build"))    purge(os.path.join(current_path, "output"), ".*\.rest")    exit(0)    if(not args.skip):    os.chdir(os.path.join(current_path, "doxygen"))    os.system("doxygen")os.chdir(current_path)if(args.test):    os.system("python doxygen2rst.py -u -i doxygen -o output")    copytree(os.path.join(current_path, "doxygen/images"), os.path.join(current_path, "output/images"));    os.chdir(os.path.join(current_path, "output"))    os.system("make html")    os.chdir(os.path.join(current_path, "output", "_build", "html"))    osver = platform.system()    if(osver == "Darwin"):        os.system("open MediaSessionAPI.html")    elif(osver == "Windows"):            os.system("start MediaSessionAPI.html")    else:        passelif(args.wiki):     os.system("python doxygen2rst.py -e wiki -u -i doxygen -o output")    os.chdir(os.path.join(current_path, "output"))    os.system("make wiki")else:    os.system("python doxygen2rst.py -g -u -i doxygen -o ../../../wme.wiki")

  

转载于:https://www.cnblogs.com/awiki/p/6229132.html

你可能感兴趣的文章
dubbo
查看>>
javaweb三大组件-servlet
查看>>
javaweb三大组件-监听器
查看>>
请求包含、请求转发、重定向的区别
查看>>
request和response总结
查看>>
Eclipse常用配置
查看>>
本地未安装Oracle数据库,如何连接远程Oracle数据库
查看>>
Idea使用SVN教程
查看>>
rpc服务和http服务的区别
查看>>
tomcat服务器
查看>>
redis
查看>>
springmvc笔记
查看>>
tp根据用户id修改其信息
查看>>
修改用户信息
查看>>
安装最新版的jenkins
查看>>
idea中的springboot项目如何不用重新编译,自动热部署
查看>>
idea打开了多个项目,多idea窗口相互切换的快捷键
查看>>
Swift5升级遇到的AVCapturexxxDelegate的坑,写法换了
查看>>
Mac查看及清理QQ、微信本地下载的文档、图片、视频等
查看>>
redux的简单使用
查看>>