comparison mxtool/mx.py @ 15579:c3869fe3d917

mx clean: make it more reliable on windows
author Bernhard Urban <bernhard.urban@jku.at>
date Fri, 09 May 2014 15:30:16 +0200
parents 406a94c03ffa
children 4aeb0b80324f
comparison
equal deleted inserted replaced
15578:24aa5dbcf92d 15579:c3869fe3d917
2717 parser.add_argument('--no-native', action='store_false', dest='native', help='do not clean native projects') 2717 parser.add_argument('--no-native', action='store_false', dest='native', help='do not clean native projects')
2718 parser.add_argument('--no-java', action='store_false', dest='java', help='do not clean Java projects') 2718 parser.add_argument('--no-java', action='store_false', dest='java', help='do not clean Java projects')
2719 2719
2720 args = parser.parse_args(args) 2720 args = parser.parse_args(args)
2721 2721
2722 def _rmtree(dirPath):
2723 path = dirPath
2724 if get_os() == 'windows':
2725 path = unicode("\\\\?\\" + dirPath)
2726 shutil.rmtree(path)
2727
2722 for p in projects_opt_limit_to_suites(): 2728 for p in projects_opt_limit_to_suites():
2723 if p.native: 2729 if p.native:
2724 if args.native: 2730 if args.native:
2725 run([gmake_cmd(), '-C', p.dir, 'clean']) 2731 run([gmake_cmd(), '-C', p.dir, 'clean'])
2726 else: 2732 else:
2727 if args.java: 2733 if args.java:
2728 genDir = p.source_gen_dir() 2734 genDir = p.source_gen_dir()
2729 if genDir != '' and exists(genDir): 2735 if genDir != '' and exists(genDir):
2730 log('Clearing {0}...'.format(genDir)) 2736 log('Clearing {0}...'.format(genDir))
2731 for f in os.listdir(genDir): 2737 for f in os.listdir(genDir):
2732 shutil.rmtree(join(genDir, f)) 2738 _rmtree(join(genDir, f))
2733 2739
2734 2740
2735 outputDir = p.output_dir() 2741 outputDir = p.output_dir()
2736 if outputDir != '' and exists(outputDir): 2742 if outputDir != '' and exists(outputDir):
2737 log('Removing {0}...'.format(outputDir)) 2743 log('Removing {0}...'.format(outputDir))
2738 shutil.rmtree(outputDir) 2744 _rmtree(outputDir)
2739 2745
2740 for configName in ['netbeans-config.zip', 'eclipse-config.zip']: 2746 for configName in ['netbeans-config.zip', 'eclipse-config.zip']:
2741 config = TimeStampFile(join(p.suite.mxDir, configName)) 2747 config = TimeStampFile(join(p.suite.mxDir, configName))
2742 if config.exists(): 2748 if config.exists():
2743 os.unlink(config.path) 2749 os.unlink(config.path)