Created
May 23, 2012 13:59
-
-
Save emctoo/2775379 to your computer and use it in GitHub Desktop.
Windows 下用于自动化工作的Python脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import os, shutil | |
def remove_files_dirs(dir = '.'): | |
''' remove all files and dirs in cwd ''' | |
print "Current work dir: " + os.getcwd() | |
judge = raw_input("remove all?[Y/n]") | |
if judge == 'n': | |
exit() | |
all = os.listdir(dir) | |
for item in all: | |
if item == '..' or item == '.': | |
continue | |
elif os.path.isdir(item) : | |
print 'remove [d] ' + item | |
shutil.rmtree(item) | |
elif os.path.isfile(item) : | |
print 'remove [f] ' + item | |
os.remove(item) | |
return | |
os.chdir("build") | |
print os.getcwd() | |
remove_files_dirs(".") | |
commands = [ | |
'cmake -G \"NMake Makefiles\" ..', | |
'nmake', | |
# 'ls -al', | |
'simple.exe' | |
] | |
for item in commands: | |
os.system(item) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment