'Use VS2010 to build the windows Nanny service.'

def BuildNanny(self):

    os.environ['ProgramFiles(x86)'] = 'C:\\Program    Files    (x86)'
    self.nanny_dir = os.path.join(self.build_dir, 'grr', 'client', 'nanny')
    nanny_src_dir = config.CONFIG.Get('ClientBuilder.nanny_source_dir', context=self.context)
    logging.info('Copying    Nanny    build    files    from    %s    to    %s', nanny_src_dir, self.nanny_dir)
    shutil.copytree(config.CONFIG.Get('ClientBuilder.nanny_source_dir', context=self.context), self.nanny_dir)
    build_type = config.CONFIG.Get('ClientBuilder.build_type', context=self.context)
    vs_arch = config.CONFIG.Get('ClientBuilder.vs_arch', default=None, context=self.context)
    env_script = config.CONFIG.Get('ClientBuilder.vs_env_script', default=None, context=self.context)
    if ((vs_arch is None) or (env_script is None) or (not os.path.exists(env_script))):
        logging.warn('Visual    Studio    does    not    appear    to    be    installed,    Falling    back    to    prebuilt    GRRNanny    binaries.If    you    want    to    build    it    you    must    have    VS    2012    installed.')
        binaries_dir = config.CONFIG.Get('ClientBuilder.nanny_prebuilt_binaries', context=self.context)
        shutil.copy(os.path.join(binaries_dir, ('GRRNanny_%s.exe' % vs_arch)), os.path.join(self.output_dir, 'GRRservice.exe'))
    else:
        subprocess.check_call(('cmd    /c    ""%s"    &&    msbuild    /p:Configuration=%s;Platform=%s"' % (env_script, build_type, vs_arch)), cwd=self.nanny_dir)
        shutil.copy(os.path.join(self.nanny_dir, vs_arch, build_type, 'GRRNanny.exe'), os.path.join(self.output_dir, 'GRRservice.exe'))
