Copies the .app from the archive into the output directory
508774
def copy_mac_app
      exe_name = Gym.project.build_settings(key: "EXECUTABLE_NAME")
      app_path = File.join(BuildCommandGenerator.archive_path, "Products/Applications/#{exe_name}.app")
      UI.crash!("Couldn't find application in '#{BuildCommandGenerator.archive_path}'") unless File.exist?(app_path)
      FileUtils.cp_r(app_path, File.expand_path(Gym.config[:output_directory]), remove_destination: true)
      app_path = File.join(Gym.config[:output_directory], File.basename(app_path))
      UI.success("Successfully exported the .app file:")
      UI.message(app_path)
      app_path
    end
477577
def _copy_dist_from_dir(link_path, location):
    

    # Note: This is currently VERY SLOW if you have a lot of data in the
    # directory, because it copies everything with `shutil.copytree`.
    # What it should really do is build an sdist and install that.
    # See https://github.com/pypa/pip/issues/2195

    if os.path.isdir(location):
        rmtree(location)

    # build an sdist
    setup_py = 'setup.py'
    sdist_args = [sys.executable]
    sdist_args.append('-c')
    sdist_args.append(SETUPTOOLS_SHIM % setup_py)
    sdist_args.append('sdist')
    sdist_args += ['--dist-dir', location]
    logger.info('Running setup.py sdist for %s', link_path)

    with indent_log():
        call_subprocess(sdist_args, cwd=link_path, show_stdout=False)

    # unpack sdist into `location`
    sdist = os.path.join(location, os.listdir(location)[0])
    logger.info('Unpacking sdist %s into %s', sdist, location)
    unpack_file(sdist, location, content_type=None, link=None)
1358287
def _repack_archive (archive1, archive2, verbosity=0, interactive=True):
    """"""
    format1, compression1 = get_archive_format(archive1)
    format2, compression2 = get_archive_format(archive2)
    if format1 == format2 and compression1 == compression2:
        # same format and compression allows to copy the file
        util.link_or_copy(archive1, archive2, verbosity=verbosity)
        return
    tmpdir = util.tmpdir()
    try:
        kwargs = dict(verbosity=verbosity, outdir=tmpdir)
        same_format = (format1 == format2 and compression1 and compression2)
        if same_format:
            # only decompress since the format is the same
            kwargs['format'] = compression1
        path = _extract_archive(archive1, **kwargs)
        archive = os.path.abspath(archive2)
        files = tuple(os.listdir(path))
        olddir = os.getcwd()
        os.chdir(path)
        try:
            kwargs = dict(verbosity=verbosity, interactive=interactive)
            if same_format:
                # only compress since the format is the same
                kwargs['format'] = compression2
            _create_archive(archive, files, **kwargs)
        finally:
            os.chdir(olddir)
    finally:
        shutil.rmtree(tmpdir, onerror=rmtree_log_error)
506652
def archive(self):
        """"""

        # Traverse the model directory deleting symlinks, zero length files
        # and empty directories
        for path, dirs, files in os.walk(self.work_path, topdown=False):
            for f_name in files:
                f_path = os.path.join(path, f_name)
                if os.path.islink(f_path) or os.path.getsize(f_path) == 0:
                    os.remove(f_path)
            if len(os.listdir(path)) == 0:
                os.rmdir(path)
444907
def export(app, local, no_scrub):
    """"""
    log(header, chevrons=False)
    data.export(str(app), local=local, scrub_pii=(not no_scrub))
1061314
def extract_archive(self, client, archive_path, extract_path=None):
        """"""
        try:
            out = ipa_utils.extract_archive(client, archive_path, extract_path)
        except Exception as error:
            raise IpaCloudException(
                'Failed to extract archive, "{0}": {1}.'.format(
                    archive_path, error
                )
            )

        else:
            self._write_to_log(out)
752062
def _build_app(args, extra_args):
    

    if not args.remote:
        # LOCAL BUILD

        try:
            output = build_and_upload_locally(
                args.src_dir,
                args.mode,
                overwrite=args.overwrite,
                archive=args.archive,
                publish=args.publish,
                destination_override=args.destination,
                version_override=args.version_override,
                bill_to_override=args.bill_to,
                use_temp_build_project=args.use_temp_build_project,
                do_parallel_build=args.parallel_build,
                do_version_autonumbering=args.version_autonumbering,
                do_try_update=args.update,
                dx_toolkit_autodep=args.dx_toolkit_autodep,
                do_check_syntax=args.check_syntax,
                ensure_upload=args.ensure_upload,
                force_symlinks=args.force_symlinks,
                dry_run=args.dry_run,
                confirm=args.confirm,
                return_object_dump=args.json,
                region=args.region,
                **extra_args
                )

            if output is not None and args.run is None:
                print(json.dumps(output))
        except dxpy.app_builder.AppBuilderException as e:
            # AppBuilderException represents errors during app or applet building
            # that could reasonably have been anticipated by the user.
            print("Error: %s" % (e.args,), file=sys.stderr)
            sys.exit(3)
        except dxpy.exceptions.DXAPIError as e:
            print("Error: %s" % (e,), file=sys.stderr)
            sys.exit(3)

        if args.dry_run:
            return None

        return output['id']

    else:
        # REMOTE BUILD

        try:
            app_json = _parse_app_spec(args.src_dir)
            _check_suggestions(app_json, publish=args.publish)
            _verify_app_source_dir(args.src_dir, args.mode)
            if args.mode == "app" and not args.dry_run:
                dxpy.executable_builder.verify_developer_rights('app-' + app_json['name'])
        except dxpy.app_builder.AppBuilderException as e:
            print("Error: %s" % (e.args,), file=sys.stderr)
            sys.exit(3)

        # The following flags might be useful in conjunction with
        # --remote. To enable these, we need to learn how to pass these
        # options through to the interior call of dx_build_app(let).
        if args.dry_run:
            parser.error('--remote cannot be combined with --dry-run')
        if args.overwrite:
            parser.error('--remote cannot be combined with --overwrite/-f')
        if args.archive:
            parser.error('--remote cannot be combined with --archive/-a')

        # The following flags are probably not useful in conjunction
        # with --remote.
        if args.json:
            parser.error('--remote cannot be combined with --json')
        if not args.use_temp_build_project:
            parser.error('--remote cannot be combined with --no-temp-build-project')

        if isinstance(args.region, list) and len(args.region) > 1:
            parser.error('--region can only be specified once for remote builds')
        region = args.region[0] if args.region is not None else None

        more_kwargs = {}
        if args.version_override:
            more_kwargs['version_override'] = args.version_override
        if args.bill_to:
            more_kwargs['bill_to_override'] = args.bill_to
        if not args.version_autonumbering:
            more_kwargs['do_version_autonumbering'] = False
        if not args.update:
            more_kwargs['do_try_update'] = False
        if not args.parallel_build:
            more_kwargs['do_parallel_build'] = False
        if not args.check_syntax:
            more_kwargs['do_check_syntax'] = False

        return _build_app_remote(args.mode, args.src_dir, destination_override=args.destination,
                                 publish=args.publish, dx_toolkit_autodep=args.dx_toolkit_autodep,
                                 region=region, watch=args.watch, **more_kwargs)
1225647
function convertWithFileCopy (program) {
  return new Promise((resolve, reject) => {
    let preAppx = path.join(program.outputDirectory, 'pre-appx')
    let app = path.join(preAppx, 'app')
    let manifest = path.join(preAppx, 'AppXManifest.xml')
    let manifestTemplate = path.join(__dirname, '..', 'template', 'AppXManifest.xml')
    let assets = path.join(preAppx, 'assets')
    let assetsTemplate = path.join(__dirname, '..', 'template', 'assets')

    utils.log(chalk.green.bold('Starting Conversion...'))
    utils.debug(`Using pre-appx folder: ${preAppx}`)
    utils.debug(`Using app from: ${app}`)
    utils.debug(`Using manifest template from: ${manifestTemplate}`)
    utils.debug(`Using asset template from ${assetsTemplate}`)

    // Clean output folder
    utils.log(chalk.green.bold('Cleaning pre-appx output folder...'))
    fs.emptyDirSync(preAppx)

    // Copy in the new manifest, app, assets
    utils.log(chalk.green.bold('Copying data...'))
    fs.copySync(manifestTemplate, manifest)
    utils.debug('Copied manifest template to destination')
    fs.copySync(assetsTemplate, assets)
    utils.debug('Copied asset template to destination')
    fs.copySync(program.inputDirectory, app)
    utils.debug('Copied input app files to destination')

    // Then, overwrite the manifest
    fs.readFile(manifest, 'utf8', (err, data) => {
      utils.log(chalk.green.bold('Creating manifest..'))
      let result = data
      let executable = program.packageExecutable || `app\\${program.packageName}.exe`

      if (err) {
        utils.debug(`Could not read manifest template. Error: ${JSON.stringify(err)}`)
        return utils.log(err)
      }

      result = result.replace(/\${publisherName}/g, program.publisher)
      result = result.replace(/\${publisherDisplayName}/g, program.publisherDisplayName || 'Reserved')
      result = result.replace(/\${identityName}/g, program.identityName || program.packageName)
      result = result.replace(/\${packageVersion}/g, program.packageVersion)
      result = result.replace(/\${packageName}/g, program.packageName)
      result = result.replace(/\${packageExecutable}/g, executable)
      result = result.replace(/\${packageDisplayName}/g, program.packageDisplayName || program.packageName)
      result = result.replace(/\${packageDescription}/g, program.packageDescription || program.packageName)
      result = result.replace(/\${packageBackgroundColor}/g, program.packageBackgroundColor || '#464646')

      fs.writeFile(manifest, result, 'utf8', (err) => {
        if (err) {
          const errorMessage = `Could not write manifest file in pre-appx location. Error: ${JSON.stringify(err)}`
          utils.debug(errorMessage)
          return reject(new Error(errorMessage))
        }

        resolve()
      })
    })
  })
}
1127000
function(cfg, callback) {
  // Input dir
  var inputPath = cfg.input_dir;

  // Output dir
  var outputPath = cfg.output_dir;

  if (inputPath && outputPath) {
    new gear.Queue({registry: taskRegistry}) // register tasks
    .log(formatLog('Copying directory:', inputPath))
    .copyDir({input: inputPath, output: outputPath}, callback)
    .log(formatLog('Copied directory to: ', outputPath))
    .run(callback);
  } else {
    callback();
  }
}
491574
def copy_assets(app, exception):
    
    if 'getLogger' in dir(logging):
        log = logging.getLogger(__name__).info  # pylint: disable=no-member
    else:
        log = app.info
    builders = get_compatible_builders(app)
    if exception:
        return
    if app.builder.name not in builders:
        if not app.config['sphinx_tabs_nowarn']:
            app.warn(
                'Not copying tabs assets! Not compatible with %s builder' %
                app.builder.name)
        return

    log('Copying tabs assets')

    installdir = os.path.join(app.builder.outdir, '_static', 'sphinx_tabs')

    for path in FILES:
        source = resource_filename('sphinx_tabs', path)
        dest = os.path.join(installdir, path)

        destdir = os.path.dirname(dest)
        if not os.path.exists(destdir):
            os.makedirs(destdir)

        copyfile(source, dest)
106349
def copy_file_tree(src: str,
                   dest: str,
                   ctx: Optional[Dict[str, Any]] = None,
                   option_locations: Optional[List[Tuple[str, List[str]]]] = None):
    
    if os.path.exists(dest):
        shutil.rmtree(dest, ignore_errors=True)
    shutil.copytree(src, dest)

    if option_locations:
        for option, paths in option_locations:
            for path in paths:
                path = os.path.join(dest, path)
                if os.path.isfile(path):
                    os.remove(path)
                else:
                    shutil.rmtree(path, ignore_errors=True)

    if 'app_bundle_module_name' in ctx:
        shutil.move(os.path.join(dest, 'app'),
                    os.path.join(dest, ctx['app_bundle_module_name']))
        shutil.move(os.path.join(dest, 'tests', 'app'),
                    os.path.join(dest, 'tests', ctx['app_bundle_module_name']))

    _render_file_tree(dest, ctx)
593093
def _copy_static_assets(self, output_dir):
        
        base_directory = 'assets/{}'.format(self._report_name)
        for asset in resource_listdir(self._package_name, base_directory):
            filename = resource_filename(
                self._package_name, '{}/{}'.format(base_directory, asset))
            shutil.copy2(filename, output_dir)
56258
function copy(inputdir, outputdir, options) {
	const _options = Object.assign({ dir: '.' }, options);
	fsPlus.copySync(path.join(inputdir, _options.dir), outputdir);
	return Promise.resolve();
}
569288
function copyToOut(src, out, multiFileMode) {
    try {
        fs.copySync(src, out);
        fs.statSync(out)
        return out;
    } catch (err) {
    }
}
1056421
def run(self, app):
        """"""
        project_path = os.getcwd()
        if self.args.name is not None:
            project_path = os.path.join(project_path, self.args.name)

        proto_path = paths.PROTO_PATH

        try:
            copytree(proto_path, project_path)
            print(colored('A new glim app created successfully! Happy coding :)', 'green'))
        except FolderExistsError as e:
            print(e)
            print(colored('App already exists', 'red'))
542651
def merge(self):
        """"""
        temp_dir = self.temp_dir
        app_dir = self.application.directory
        for root, dirs, files in os.walk(temp_dir):
            for directory in dirs:
                directory = os.path.join(root, directory)
                directory = directory.replace(temp_dir, app_dir, 1)
                try:
                    os.mkdir(directory)
                except OSError:
                    pass
            for file in files:
                source = os.path.join(root, file)
                target = source.replace(temp_dir, app_dir, 1)
                relative_target = target.replace(app_dir, '.')
                action = 'r'
                if (
                    os.path.exists(target)
                    and not filecmp.cmp(source, target, shallow=False)
                    and os.stat(target).st_size > 0
                ):
                    # target exists, is not empty, and does not
                    # match source
                    if target.endswith('__init__.py'):
                        # default merge __init__.py files
                        # if non-empty, these should only
                        # contain imports from submoduiles
                        action = 'm'
                    elif target.endswith('base.py'):
                        # default skip base.py files
                        # these should be extended by the developer
                        action = 's'
                    else:
                        default = 'm'
                        action = click.prompt(
                            style.prompt(
                                '%s already exists, '
                                '[r]eplace, [s]kip, or [m]erge?' % (
                                    relative_target
                                ),
                            ),
                            default=style.default(default)
                        ) if self.interactive else default
                        action = click.unstyle(action).lower()
                        if action not in {'r', 'm', 's'}:
                            action = default

                if action == 's':
                    self.stdout.write(
                        '? %s' % style.white(relative_target),
                        fg='yellow'
                    )
                    continue
                if action == 'r':
                    with open(source, 'r') as source_file:
                        with open(target, 'w') as target_file:
                            target_file.write(source_file.read())
                    self.stdout.write(
                        style.green(
                            '+ %s' % style.white(relative_target)
                        )
                    )
                if action == 'm':
                    with open(target, 'r') as target_file:
                        with open(source, 'r') as source_file:
                            merged = merge(
                                target_file.read(),
                                source_file.read()
                            )
                    with open(target, 'w') as target_file:
                        target_file.write(merged)

                    self.stdout.write(
                        style.yellow('> %s' % style.white(relative_target))
                    )
347752
public void	
    doArchive(String logListURI, String archiveDirectory)
    throws IOException
  {
    String destURL = FileSystem.getDefaultUri(fsConfig) + archiveDirectory;
    DistCp.copy(new JobConf(fsConfig), logListURI, destURL, null, true, false);
  }