Microsoft Windows SDK Include
431848
def OSIncludes(self):
        
        include = os.path.join(self.si.WindowsSdkDir, 'include')

        if self.vc_ver <= 10.0:
            return [include, os.path.join(include, 'gl')]

        else:
            if self.vc_ver >= 14.0:
                sdkver = self._sdk_subdir
            else:
                sdkver = ''
            return [os.path.join(include, '%sshared' % sdkver),
                    os.path.join(include, '%sum' % sdkver),
                    os.path.join(include, '%swinrt' % sdkver)]
1310263
function wizardSetup (program) {
  const welcome = multiline.stripIndent(function () { /*
        Welcome to the Electron-Windows-Store tool!

        This tool will assist you with turning your Electron app into
        a swanky Windows Store app.

        We need to know some settings. We will ask you only once and store
        your answers in your profile folder in a .electron-windows-store
        file.

    */
  })
  const complete = multiline.stripIndent(function () { /*

        Setup complete, moving on to package your app!

    */
  })

  let questions = [
    {
      name: 'desktopConverter',
      type: 'input',
      message: 'Please enter the path to your Desktop App Converter (DesktopAppConverter.ps1): ',
      validate: (input) => pathExists.sync(input),
      when: () => (!program.desktopConverter)
    },
    {
      name: 'expandedBaseImage',
      type: 'input',
      message: 'Please enter the path to your Expanded Base Image: ',
      default: 'C:\\ProgramData\\Microsoft\\Windows\\Images\\BaseImage-14316\\',
      validate: (input) => pathExists.sync(input),
      when: () => (!program.expandedBaseImage)
    },
    {
      name: 'devCert',
      type: 'input',
      message: 'Please enter the path to your development PFX certficate: ',
      default: null,
      when: () => (!dotfile.get().makeCertificate || !program.devCert)
    },
    {
      name: 'publisher',
      type: 'input',
      message: 'Please enter your publisher identity: ',
      default: 'CN=developmentca',
      when: () => (!program.publisher)
    },
    {
      name: 'windowsKit',
      type: 'input',
      message: "Please enter the location of your Windows Kit's bin folder: ",
      default: utils.getDefaultWindowsKitLocation(),
      when: () => (!program.windowsKit)
    }
  ]

  if (!program.isModuleUse) {
    utils.log(welcome)
  }

  // Remove the Desktop Converter Questions if not installed
  if (program.didInstallDesktopAppConverter === false) {
    questions = questions.slice(3)
  }

  if (program.isModuleUse) {
    program.windowsKit = program.windowsKit || utils.getDefaultWindowsKitLocation()

    return Promise.resolve(program)
  }

  return inquirer.prompt(questions)
    .then((answers) => {
      dotfile.set({
        desktopConverter: answers.desktopConverter || false,
        expandedBaseImage: answers.expandedBaseImage || false,
        devCert: answers.devCert,
        publisher: answers.publisher,
        windowsKit: answers.windowsKit,
        makeCertificate: dotfile.get().makeCertificate
      })

      program.desktopConverter = answers.desktopConverter
      program.expandedBaseImage = answers.expandedBaseImage
      program.devCert = answers.devCert
      program.publisher = answers.publisher
      program.windowsKit = answers.windowsKit

      if (program.makeCertificate) {
        utils.log(chalk.bold.green('Creating Certficate'))
        let publisher = dotfile.get().publisher.split('=')[1]
        let certFolder = path.join(process.env.APPDATA, 'electron-windows-store', publisher)

        return sign.makeCert({ publisherName: publisher, certFilePath: certFolder, program: program })
          .then(pfxFile => {
            utils.log('Created and installed certificate:')
            utils.log(pfxFile)
            dotfile.set({ devCert: pfxFile })
          })
      }

      utils.log(complete)
    })
}
400253
def include(context, bundle_name, version):
    
    store = Store(context.obj['database'], context.obj['root'])
    if version:
        version_obj = store.Version.get(version)
        if version_obj is None:
            click.echo(click.style('version not found', fg='red'))
    else:
        bundle_obj = store.bundle(bundle_name)
        if bundle_obj is None:
            click.echo(click.style('bundle not found', fg='red'))
        version_obj = bundle_obj.versions[0]

    try:
        include_version(context.obj['root'], version_obj)
    except VersionIncludedError as error:
        click.echo(click.style(error.message, fg='red'))
        context.abort()

    version_obj.included_at = dt.datetime.now()
    store.commit()
    click.echo(click.style('included all files!', fg='green'))
20476
def embedManifestDllCheck(target, source, env):
    """"""
    if env.get('WINDOWS_EMBED_MANIFEST', 0):
        manifestSrc = target[0].get_abspath() + '.manifest'
        if os.path.exists(manifestSrc):
            ret = (embedManifestDllAction) ([target[0]],None,env)        
            if ret:
                raise SCons.Errors.UserError("Unable to embed manifest into %s" % (target[0]))
            return ret
        else:
            print('(embed: no %s.manifest found; not embedding.)'%str(target[0]))
    return 0
734605
def list_installed():
    '''
    
    '''
    cmd = 'Get-WindowsFeature ' \
          '-ErrorAction SilentlyContinue ' \
          '-WarningAction SilentlyContinue ' \
          '| Select DisplayName,Name,Installed'
    features = _pshell_json(cmd)

    ret = {}
    for entry in features:
        if entry['Installed']:
            ret[entry['Name']] = entry['DisplayName']

    return ret
105806
def do_include(self, t):
        
        t = self.resolve_include(t)
        include_file = self.find_include_file(t)
        if include_file:
            #print("include_file =", include_file)
            self.result.append(include_file)
            contents = self.read_file(include_file)
            new_tuples = [('scons_current_file', include_file)] + \
                         self.tupleize(contents) + \
                         [('scons_current_file', self.current_file)]
            self.tuples[:] = new_tuples + self.tuples
484522
public void installApp(Functions.Func callback) {
        if (isPwaSupported()) {
            appInstaller = new AppInstaller(callback);
            appInstaller.prompt();
        }
    }
804951
def install_tool(app, Cnt):
    ''' 
    '''

    # get the current working directory
    cwd = os.getcwd()

    # pick the target installation folder for tools
    if 'PATHTOOLS' in Cnt and Cnt['PATHTOOLS']!='':
        path_tools = Cnt['PATHTOOLS']
    elif ('PATHTOOLS' not in Cnt or Cnt['PATHTOOLS']!=''):
        if 'DISPLAY' in os.environ and platform.system() in ['Linux', 'Windows']:
            print '>>>>> DISPLAY', os.environ['DISPLAY']
            Tk().withdraw()
            dircore = askdirectory(title='choose a place for NiftyPET tools', initialdir=os.path.expanduser('~'))
            Tk().destroy()
            # get the full (combined path)
            path_tools = os.path.join(dircore, Cnt['DIRTOOLS'])
        else:
            try:
                path_tools = input_path('Enter path for NiftyPET tools (registration, etc):')
            except:
                print 'enter the intended PATHTOOLS in resources.py located in ~/.niftypet/'
                raise ValueError('\n e> could not get the path for NiftyPET_tools \n')
        Cnt['PATHTOOLS'] = path_tools

    else:
        if platform.system() == 'Linux' :
            path_tools = os.path.join( os.path.expanduser('~'), Cnt['DIRTOOLS'] )
        elif platform.system() == 'Windows' :
            path_tools = os.path.join( os.getenv('LOCALAPPDATA'), Cnt['DIRTOOLS'] )
        else:
            print '\n=========================================================='
            print 'e> only Linux and Windows operating systems are supported!'
            print '==========================================================\n'
            raise SystemError('OS not supported!')      
        Cnt['PATHTOOLS'] = path_tools

    #create the main tools folder
    if not os.path.isdir(path_tools):
        os.mkdir(path_tools)
    # identify the specific path for the requested app
    if app=='niftyreg':
        repo = repo_reg
        sha1 = sha1_reg
        path = os.path.join(path_tools, 'niftyreg')
    elif app=='dcm2niix':
        repo = repo_dcm
        sha1 = sha1_dcm
        path = os.path.join(path_tools, 'dcm2niix')

        if not Cnt['CMPL_DCM2NIIX']:
            # avoid installing from source, instead download the full version:
            Cnt = download_dcm2niix(Cnt, path)
            return Cnt

    # Check if the source folder exists and delete it, if it does
    if os.path.isdir(path): shutil.rmtree(path)
    # Create an empty folder and enter it
    os.mkdir(path)
    os.chdir(path)

    # clone the git repository
    call(['git', 'clone', repo, dirsrc])
    os.chdir(dirsrc)
    print 'i> checking out the specific git version of the software...'
    call(['git', 'checkout', sha1])
    os.chdir('../')

    # create the building folder
    if not os.path.isdir(dirbld):
        os.mkdir(dirbld)
    # go inside the build folder
    os.chdir(dirbld)

    # run cmake with arguments
    if platform.system()=='Windows':
        cmd = ['cmake', '../'+dirsrc,
            '-DBUILD_ALL_DEP=ON',
            '-DCMAKE_INSTALL_PREFIX='+path,
            '-G', Cnt['MSVC_VRSN']]
        call(cmd)
        call(['cmake', '--build', './', '--config', 'Release', '--target', 'install'])
    elif platform.system() in ['Linux', 'Darwin']:
        cmd = ['cmake', '../'+dirsrc,
            '-DBUILD_ALL_DEP=ON',
            '-DCMAKE_INSTALL_PREFIX='+path]
        if Cnt['CMAKE_TLS_PAR']!='': cmd.append(Cnt['CMAKE_TLS_PAR'])
        call(cmd)
        call(
            ['cmake', '--build', './',
            '--config', 'Release',
            '--target', 'install',
            '--','-j', str(ncpu)]
        )

    # restore the current working directory
    os.chdir(cwd)

    if app=='niftyreg':
        try:
            Cnt['RESPATH'] = glob.glob(os.path.join(os.path.join(path,'bin'), 'reg_resample*'))[0]
            Cnt['REGPATH'] = glob.glob(os.path.join(os.path.join(path,'bin'), 'reg_aladin*'))[0]
        except IndexError:
            print 'e> NiftyReg has NOT been successfully installed.'
            raise SystemError('Failed Installation (NiftyReg)')
        # updated the file resources.py
        Cnt = update_resources(Cnt)
        # check the installation:
        chck_niftyreg = check_version(Cnt, chcklst=['RESPATH','REGPATH'])
        if not all([chck_niftyreg[k] for k in chck_niftyreg.keys()]):
            print 'e> NiftyReg has NOT been successfully installed.'
            raise SystemError('Failed Installation (NiftyReg)')

    elif app=='dcm2niix':
        try:
            Cnt['DCM2NIIX'] = glob.glob(os.path.join(os.path.join(path,'bin'), 'dcm2niix*'))[0]
        except IndexError:
            print 'e> dcm2niix has NOT been successfully installed.'
            Cnt = download_dcm2niix(Cnt, path)
        # check the installation:
        if not check_version(Cnt, chcklst=['DCM2NIIX']):
            print 'e> dcm2niix has NOT been successfully compiled from github.'
            Cnt = download_dcm2niix(Cnt, path)
    return Cnt
532131
function bundleDTS() {
    const DST_PATH = path.join(__dirname, '..', config.dir.pkg);
    const TYPE_DEF_FILE = path.join(DST_PATH, config.dir.types, config.main.bundle_d_ts);
    const SRC_DEF_FILE = path.join(__dirname, '..', config.dir.built, config.main.basename + '-all.d.ts');

    let src = '\ufeff' + banner('.d.ts', config.main.basename) + fs.readFileSync(SRC_DEF_FILE).toString()
            .replace(/^\ufeff/gm, '')
            .replace(/\r\n/gm, '\n')
    ;

    const refPathInfo = [];
    const refPathDefs = src.match(/<reference path="[\s\S]*?"/g);

    if (null != refPathDefs) {
        refPathDefs.forEach((refpath) => {
            const filePath = refpath.match(/("|')[\s\S]*?("|')/)[0].replace(/("|')/g, '');
            const fileName = path.basename(filePath);
            refPathInfo.push({
                refpath: refpath,
                path: filePath,
                file: fileName,
            });
        });
        refPathInfo.forEach((target) => {
            src = src.replace(target.refpath, '<reference path="' + target.file + '"');
        });
        // remove '_dev.dependencies.d.ts' reference.
        src = src.replace(/\/\/\/ <reference path="_dev.dependencies.d.ts"[\s\S]*?\n/g, '');
    }

    if (!fs.existsSync(path.join(DST_PATH, config.dir.types))) {
        fs.mkdirSync(path.join(DST_PATH, config.dir.types));
    }
    fs.writeFileSync(TYPE_DEF_FILE, src);
}
1198970
protected function _includeAppController(): void
    {
        $controller = null;
        if (file_exists(WWW_ROOT . 'js/app/app_controller.js')) {
            $controller = 'app/app_controller.js';
        } else {
            $controller = '/frontend_bridge/js/lib/app_controller.js';
        }
        $this->_dependencies[] = $controller;
    }
53148
def _included_frames(frame_list, frame_format):
    """"""
    return INCLUDED_FRAMES.format(Nframes=len(frame_list),
                                  frame_dir=os.path.dirname(frame_list[0]),
                                  frame_format=frame_format)
1072775
def embedManifestExeCheck(target, source, env):
    """"""
    if env.get('WINDOWS_EMBED_MANIFEST', 0):
        manifestSrc = target[0].get_abspath() + '.manifest'
        if os.path.exists(manifestSrc):
            ret = (embedManifestExeAction) ([target[0]],None,env)
            if ret:
                raise SCons.Errors.UserError("Unable to embed manifest into %s" % (target[0]))
            return ret
        else:
            print('(embed: no %s.manifest found; not embedding.)'%str(target[0]))
    return 0
1275303
private function includeAll()
    {
        $config = $this->readConfig();
        $files = array_merge(
            (array) $this->goals['include'],
            (array) $config['components']['include']
        );
        $this->includeGoals($files);
    }
1126727
def find_sdk_dir(self):
        
        if not SCons.Util.can_read_reg:
            debug('find_sdk_dir(): can not read registry')
            return None

        hkey = self.HKEY_FMT % self.hkey_data
        debug('find_sdk_dir(): checking registry:{}'.format(hkey))

        try:
            sdk_dir = common.read_reg(hkey)
        except SCons.Util.WinError as e:
            debug('find_sdk_dir(): no SDK registry key {}'.format(repr(hkey)))
            return None

        debug('find_sdk_dir(): Trying SDK Dir: {}'.format(sdk_dir))

        if not os.path.exists(sdk_dir):
            debug('find_sdk_dir():  {} not on file system'.format(sdk_dir))
            return None

        ftc = os.path.join(sdk_dir, self.sanity_check_file)
        if not os.path.exists(ftc):
            debug("find_sdk_dir(): sanity check {} not found".format(ftc))
            return None

        return sdk_dir
172992
function ensureWindows () {
  if (process.platform !== 'win32') {
    log('This tool requires Windows 10.\n')
    log('You can run a virtual machine using the free VirtualBox and')
    log('the free Windows Virtual Machines found at http://modern.ie.\n')
    log('For more information, please see the readme.')
    process.exit(1)
  }

  let release = require('os').release()
  let major = parseInt(release.slice(0, 2), 10)
  let minor = parseInt(release.slice(3, 4), 10)
  let build = parseInt(release.slice(5), 10)

  if (major < 10 || (minor === 0 && build < 14316)) {
    log(`You are running Windows ${release}. You need at least Windows 10.0.14316.`)
    log('We can\'t confirm that you\'re running the right version, but we won\'t stop')
    log('this process - should things fail though, you might have to update your')
    log('Windows.')
  }
}
48933
def Run(self, unused_args):
    """"""
    # Don't use winreg.KEY_WOW64_64KEY since it breaks on Windows 2000
    subkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
                            "Software\\Microsoft\\Windows NT\\CurrentVersion",
                            0, winreg.KEY_READ)
    install_date = winreg.QueryValueEx(subkey, "InstallDate")
    self.SendReply(rdfvalue.RDFDatetime.FromSecondsSinceEpoch(install_date[0]))
95766
def include_flags(self, arch):
        ''''''
        openssl_includes = join(self.get_build_dir(arch.arch), 'include')
        return (' -I' + openssl_includes +
                ' -I' + join(openssl_includes, 'internal') +
                ' -I' + join(openssl_includes, 'openssl'))