bug 1162519 - use winrm for mach clobber on Windows. r=gps

--HG--
extra : commitid : AGLwgeTmbKQ
extra : rebase_source : 9aac8bdcfd685bb8d08f877c256c56ccba98b665
This commit is contained in:
Ted Mielczarek 2015-07-01 11:47:03 -04:00
Родитель 1c421efa41
Коммит d47a94a095
1 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -295,9 +295,19 @@ class MozbuildObject(ProcessExecutionMixin):
return False return False
return Clobberer(self.topsrcdir, self.topobjdir).clobber_needed() return Clobberer(self.topsrcdir, self.topobjdir).clobber_needed()
def have_winrm(self):
# `winrm -h` should print 'winrm version ...' and exit 1
p = subprocess.Popen(['winrm.exe', '-h'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return p.wait() == 1 and p.stdout.read().startswith('winrm')
def remove_objdir(self): def remove_objdir(self):
"""Remove the entire object directory.""" """Remove the entire object directory."""
if sys.platform.startswith('win') and self.have_winrm():
subprocess.check_call(['winrm', '-rf', self.topobjdir])
else:
# We use mozfile because it is faster than shutil.rmtree(). # We use mozfile because it is faster than shutil.rmtree().
# mozfile doesn't like unicode arguments (bug 818783). # mozfile doesn't like unicode arguments (bug 818783).
rmtree(self.topobjdir.encode('utf-8')) rmtree(self.topobjdir.encode('utf-8'))