Copy DLLs to output path.
429308
function copyFile(src, dest) {
      var content = fs.readFileSync(src, 'binary');
      fs.writeFileSync(dest, content, 'binary');
    }
1159851
def dump_all_outputs(self, job, target, abspaths=None):
        
        import os
        import shutil
        from pathlib import Path

        root = Path(native_str(target))
        true_outputs = job.get_output()

        if abspaths or len(true_outputs) < self.BULK_OUTPUT_FILE_THRESHOLD:
            return super().dump_all_outputs(job, root, abspaths)

        stagingdir = root / Path(native_str(job.workingdir)).name
        workdir = job.get_directory(job.workingdir)
        if not root.is_dir():
            root.mkdir(parents=False)
        if stagingdir.exists():
            if PY2:
                raise IOError('Path % exists' % stagingdir)
            else:
                raise FileExistsError(stagingdir)
        workdir.put(str(root))
        assert stagingdir.is_dir()
        assert root in stagingdir.parents

        for pathstr in true_outputs:
            if os.path.isabs(pathstr):
                continue
            destpath = root / pathstr
            currpath = stagingdir / pathstr
            if not destpath.parent.is_dir():
                destpath.parent.mkdir(parents=True)
            currpath.rename(destpath)

        shutil.rmtree(str(stagingdir))
1054114
def _copy(src, dst):
    """"""
    try:
        shutil.copy(src, dst)
    except IsADirectoryError:
        if os.path.isdir(dst):
            dst = os.path.join(dst, os.path.basename(src))
        shutil.copytree(src, dst)
541083
def modify_path():
    """"""
    # Only modify path on Windows.
    if os.name != "nt":
        return

    path = os.environ.get("PATH")
    if path is None:
        return

    try:
        extra_dll_dir = pkg_resources.resource_filename("bezier", "extra-dll")
        if os.path.isdir(extra_dll_dir):
            os.environ["PATH"] = path + os.pathsep + extra_dll_dir
    except ImportError:
        pass
1230341
def generate(env):
    """"""
    SCons.Tool.createSharedLibBuilder(env)
    SCons.Tool.createProgBuilder(env)

    env['SHLINK']      = '$LINK'
    env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll')
    env['_SHLINK_TARGETS'] = windowsShlinkTargets
    env['_SHLINK_SOURCES'] = windowsShlinkSources
    env['SHLINKCOM']   =  compositeShLinkAction
    env.Append(SHLIBEMITTER = [windowsLibEmitter])
    env.Append(LDMODULEEMITTER = [windowsLibEmitter])
    env['LINK']        = 'link'
    env['LINKFLAGS']   = SCons.Util.CLVar('/nologo')
    env['_PDB'] = pdbGenerator
    env['LINKCOM'] = compositeLinkAction
    env.Append(PROGEMITTER = [prog_emitter])
    env['LIBDIRPREFIX']='/LIBPATH:'
    env['LIBDIRSUFFIX']=''
    env['LIBLINKPREFIX']=''
    env['LIBLINKSUFFIX']='$LIBSUFFIX'

    env['WIN32DEFPREFIX']        = ''
    env['WIN32DEFSUFFIX']        = '.def'
    env['WIN32_INSERT_DEF']      = 0
    env['WINDOWSDEFPREFIX']      = '${WIN32DEFPREFIX}'
    env['WINDOWSDEFSUFFIX']      = '${WIN32DEFSUFFIX}'
    env['WINDOWS_INSERT_DEF']    = '${WIN32_INSERT_DEF}'

    env['WIN32EXPPREFIX']        = ''
    env['WIN32EXPSUFFIX']        = '.exp'
    env['WINDOWSEXPPREFIX']      = '${WIN32EXPPREFIX}'
    env['WINDOWSEXPSUFFIX']      = '${WIN32EXPSUFFIX}'

    env['WINDOWSSHLIBMANIFESTPREFIX'] = ''
    env['WINDOWSSHLIBMANIFESTSUFFIX'] = '${SHLIBSUFFIX}.manifest'
    env['WINDOWSPROGMANIFESTPREFIX']  = ''
    env['WINDOWSPROGMANIFESTSUFFIX']  = '${PROGSUFFIX}.manifest'

    env['REGSVRACTION'] = regServerCheck
    env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32')
    env['REGSVRFLAGS'] = '/s '
    env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS ${TARGET.windows}'

    env['WINDOWS_EMBED_MANIFEST'] = 0
    env['MT'] = 'mt'
    #env['MTFLAGS'] = ['-hashupdate']
    env['MTFLAGS'] = SCons.Util.CLVar('/nologo')
    # Note: use - here to prevent build failure if no manifest produced.
    # This seems much simpler than a fancy system using a function action to see
    # if the manifest actually exists before trying to run mt with it.
    env['MTEXECOM']   = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;1'
    env['MTSHLIBCOM'] = '-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;2'
    # TODO Future work garyo 27-Feb-11
    env['_MANIFEST_SOURCES'] = None # _windowsManifestSources

    # Set-up ms tools paths
    msvc_setup_env_once(env)


    # Loadable modules are on Windows the same as shared libraries, but they
    # are subject to different build parameters (LDMODULE* variables).
    # Therefore LDMODULE* variables correspond as much as possible to
    # SHLINK*/SHLIB* ones.
    SCons.Tool.createLoadableModuleBuilder(env)
    env['LDMODULE'] = '$SHLINK'
    env['LDMODULEPREFIX'] = '$SHLIBPREFIX'
    env['LDMODULESUFFIX'] = '$SHLIBSUFFIX'
    env['LDMODULEFLAGS'] = '$SHLINKFLAGS'
    env['_LDMODULE_TARGETS'] = _windowsLdmodTargets
    env['_LDMODULE_SOURCES'] = _windowsLdmodSources
    env['LDMODULEEMITTER'] = [ldmodEmitter]
    env['LDMODULECOM'] = compositeLdmodAction
1117149
def copy_artifacts(app):
    """"""
    dest_path = app.builder.outdir + '/error'
    source_path = app.builder.srcdir + '/build_version_doc/artifacts'
    _run_cmd('cd ' + app.builder.srcdir)
    _run_cmd('rm -rf ' + dest_path)
    _run_cmd('mkdir -p ' + dest_path)
    _run_cmd('cp ' + source_path + '/404.html ' + dest_path)
    _run_cmd('cp ' + source_path + '/api.html ' + dest_path)
    dest_path = app.builder.outdir + '/_static'
    _run_cmd('rm -rf ' + dest_path)
    _run_cmd('mkdir -p ' + dest_path)
    _run_cmd('cp ' + app.builder.srcdir + '/_static/mxnet.css ' + dest_path)
533475
def linkorcopy(src, dst):
    """"""
    if not os.path.isfile(src):
        raise error.ButcherError('linkorcopy called with non-file source. '
                                 '(src: %s  dst: %s)' % src, dst)
    elif os.path.isdir(dst):
        dst = os.path.join(dst, os.path.basename(src))
    elif os.path.exists(dst):
        os.unlink(dst)
    elif not os.path.exists(os.path.dirname(dst)):
        os.makedirs(os.path.dirname(dst))

    try:
        os.link(src, dst)
        log.debug('Hardlinked: %s -> %s', src, dst)
    except OSError:
        shutil.copy2(src, dst)
        log.debug('Couldn\'t hardlink. Copied: %s -> %s', src, dst)
1135533
def generate_dataset(self, cdl_path):
        '''
        
        '''
        if '.cdl' in cdl_path:  # it's possible the filename doesn't have the .cdl extension
            ds_str = cdl_path.replace('.cdl', '.nc')
        else:
            ds_str = cdl_path + '.nc'
        subprocess.call(['ncgen', '-o', ds_str, cdl_path])
        return ds_str
626654
def for_compiler(self, compiler, platform):
    """"""
    return (self.linker
            # TODO(#6143): describe why the compiler needs to be first on the PATH!
            .sequence(compiler, exclude_list_fields=['extra_args', 'path_entries'])
            .prepend_field('path_entries', compiler.path_entries)
            .copy(exe_filename=compiler.exe_filename))
10766
private void copyLibraryRecursive(Path input, Path output) throws IOException {
        for (Path dirItem : Files.list(input).collect(Collectors.toList())) {
            Path outputName = output.resolve(dirItem.getFileName());
            if (Files.isDirectory(dirItem)) {
                if(!Files.exists(outputName)) Files.createDirectory(outputName);
                copyLibraryRecursive(dirItem, outputName);
            } else {
                Files.copy(dirItem, outputName, StandardCopyOption.REPLACE_EXISTING);
            }
        }
    }
127996
def output(file_like_object, path, verbose=False):
    """"""
    if not path:
        for line in file_like_object:
            if verbose:
                print_info(line.rstrip())
            else:
                print(line.rstrip())
    else:
        try:
            object_file = open(os.path.expanduser(path), "w", encoding="utf-8")
            shutil.copyfileobj(file_like_object, object_file)
            object_file.close()
        except EnvironmentError as xxx_todo_changeme:
            (errno, strerror) = xxx_todo_changeme.args
            error_line_list = [
                "Could not write to object_file: {}".format(path),
                "I/O error({}): {}".format(errno, strerror),
            ]
            error_message = "\n".join(error_line_list)
            raise d1_cli.impl.exceptions.CLIError(error_message)
1318921
def _windowsLdmodSources(target, source, env, for_signature):
    """"""
    return _dllSources(target, source, env, for_signature, 'LDMODULE')
1155802
def copyfile(self, target):
        
        shutil.copyfile(self.path, self._to_backend(target))
76734
def _setup_output(self, path, force):
        ''''''
        # Allow for special case of output being a pipe
        if os.path.isdir(path) or os.path.isfile(path):
            if force:
                logging.warn("Deleting previous file/directory '%s'" % path)
                if os.path.isfile(path):
                    os.remove(path)
                else:
                    shutil.rmtree(path)
            else:
                raise Exception("Cowardly refusing to overwrite already existing path at %s" % path)
1283778
function (output) {
              // Manually convert paths to relative, because LESS
              // can make tose absolute for complex cases.
              var map = JSON.parse(output);
              var dir = path.dirname(context.pathname);
              map.sources.forEach(function (file, idx) {
                var rel = path.relative(dir, file);
                if (path.sep === '\\') { rel = rel.replace('\\', '/'); }
                map.sources[idx] = rel;
              });

              self.map = JSON.stringify(map);
            }
695414
def _get_output_path(self):
        """"""
        if self.Parameters['-o'].isOn():
            output_path = self._absolute(str(self.Parameters['-o'].Value))
        else:
            raise ValueError("No output path specified.")
        return output_path
1002981
def outfile(self):
        """"""
        return os.path.join(OPTIONS['base_dir'],
                            '{0}.{1}'.format(self.name, OPTIONS['out_ext']))