Add a package to this project
779665
def add_package(self, package):
        
        self._data.setdefault('packages', {})
        
        self._data['packages'][package.name] = package.source

        for package in package.deploy_packages:
            self.add_package(package)

        self._save()
24807
public void register(Package... packages) {
        List<String> packageNames = Arrays.stream(packages)
            .map(Package::getName)
            .collect(Collectors.toList());

        register(packageNames.toArray(new String[packageNames.size()]));
    }
851872
def add_packages(packages):
    

    #if the parameter is a string, convert to a single element list
    if isinstance(packages,str):
        packages = [packages]

    _add_to_submit_args("--packages "+ ",".join(packages)  +" pyspark-shell")
41372
def post_install_package():
    

    module_name = '.'.join([env.project_package_name,'deploy'])
    funcs_run = []
    try:
        imported = import_module(module_name)
        funcs = vars(imported)
        for f in env.installed_packages[env.host]:
            func = funcs.get(''.join(['post_install_',f.replace('.','_').replace('-','_')]))
            if func:
                func()
                funcs_run.append(func)
    except ImportError:
        pass
    
    #run per app
    for app in env.INSTALLED_APPS:
        if app == 'woven': continue
        module_name = '.'.join([app,'deploy'])
        try:
            imported = import_module(module_name)
            funcs = vars(imported)
            for f in env.installed_packages[env.host]:
                func = funcs.get(''.join(['post_install_',f.replace('.','_').replace('-','_')]))
                if func and func not in funcs_run:
                    func()
                    funcs_run.append(func)
        except ImportError:
            pass
    #run woven last
    import woven.deploy
    funcs = vars(woven.deploy)
    for f in env.installed_packages[env.host]:
        func = funcs.get(''.join(['post_install_',f.replace('.','_').replace('-','_')]))
        if func and func not in funcs_run: func()
509495
def install(packages, options=None, fatal=False):
    """"""
    cmd = ['yum', '--assumeyes']
    if options is not None:
        cmd.extend(options)
    cmd.append('install')
    if isinstance(packages, six.string_types):
        cmd.append(packages)
    else:
        cmd.extend(packages)
    log("Installing {} with options: {}".format(packages,
                                                options))
    _run_yum_command(cmd, fatal)
210147
def add_subproject(self, fname, conf_path):
        """"""
        config = Config(conf_file=conf_path)
        proj = Project(self.app,
                       dependency_map=self.dependency_map)
        proj.parse_name_from_config(config)
        proj.parse_config(config)
        proj.setup()
        self.subprojects[fname] = proj
436591
private void installPackage() {
        AndPermission.with(this)
            .install()
            .file(new File(Environment.getExternalStorageDirectory(), "android.apk"))
            .rationale(new InstallRationale())
            .onGranted(new Action<File>() {
                @Override
                public void onAction(File data) {
                    // Installing.
                    toast(R.string.successfully);
                }
            })
            .onDenied(new Action<File>() {
                @Override
                public void onAction(File data) {
                    // The user refused to install.
                    toast(R.string.failure);
                }
            })
            .start();
    }
1304547
def add_scripts_to_package():
    
    global setup_arguments

    if os.path.isdir('scripts'):
        setup_arguments['scripts'] = [
            os.path.join('scripts', f) for f in os.listdir('scripts')
        ]
254170
def add(self, packet):
        """"""
        for name in self._names:
            value = getattr(packet, name)
            if value is not None:
                self._dict[name] = value
994381
def add_project(project,**kwargs):
    
    user_id = kwargs.get('user_id')

    existing_proj = get_project_by_name(project.name,user_id=user_id)

    if len(existing_proj) > 0:
        raise HydraError("A Project with the name \"%s\" already exists"%(project.name,))

    #check_perm(user_id, 'add_project')
    proj_i = Project()
    proj_i.name = project.name
    proj_i.description = project.description
    proj_i.created_by = user_id

    attr_map = hdb.add_resource_attributes(proj_i, project.attributes)
    db.DBSession.flush() #Needed to get the resource attr's ID
    proj_data = _add_project_attribute_data(proj_i, attr_map, project.attribute_data)
    proj_i.attribute_data = proj_data

    proj_i.set_owner(user_id)

    db.DBSession.add(proj_i)
    db.DBSession.flush()

    return proj_i
30640
def package(self):
        """"""
        # create build directory
        tmp_path = os.path.join(self.app_path, self.args.outdir, 'build')
        if not os.path.isdir(tmp_path):
            os.makedirs(tmp_path)

        # temp path and cleanup
        template_app_path = os.path.join(tmp_path, 'template')
        if os.access(template_app_path, os.W_OK):
            # cleanup any previous failed builds
            shutil.rmtree(template_app_path)
        # update package data
        self.package_data['package'].append(
            {'action': 'Template Directory:', 'output': template_app_path}
        )

        # build exclude file/directory list
        excludes = [
            'tcex.json',
            self.args.outdir,
            '__pycache__',
            '.c9',  # C9 IDE
            '.git',  # git directory
            '.gitmodules',  # git modules
            '.idea',  # PyCharm
            '*.iml',  # PyCharm files
            '*.pyc',  # any pyc file
            '.python-version',  # pyenv
            '.vscode',  # Visual Studio Code
            'log',  # log directory
        ]
        excludes.extend(self.args.exclude)
        excludes.extend(self.tcex_json.get('package', {}).get('excludes', []))
        # update package data
        self.package_data['package'].append({'action': 'Excluded Files:', 'output': excludes})

        # copy project directory to temp location to use as template for multiple builds
        ignore_patterns = shutil.ignore_patterns(*excludes)
        shutil.copytree(self.app_path, template_app_path, False, ignore_patterns)

        # build list of app json files
        if self.args.install_json is not None:
            contents = [self.args.install_json]
        else:
            contents = os.listdir(self.app_path)

        # package app
        for install_json in sorted(contents):
            # skip files that are not install.json files
            if 'install.json' not in install_json:
                continue

            # get App Name from config, install.json prefix or directory name.
            if install_json == 'install.json':
                app_name = self.tcex_json.get('package', {}).get(
                    'app_name', os.path.basename(self.app_path)
                )
            else:
                app_name = install_json.split('.')[0]

            # update package data
            self.package_data['package'].append({'action': 'App Name:', 'output': app_name})

            # load install json
            ij = self.load_install_json(install_json)

            # automatically update install.json for feature sets supported by the SDK
            ij, ij_modified = self._update_install_json(ij)

            # write update install.json
            if ij_modified:
                self._write_install_json(install_json, ij)

            # find a usable app version
            program_version = ij.get('programVersion', '1.0.0').split('.')
            major_version = program_version[0]
            try:
                minor_version = program_version[1]
            except IndexError:
                minor_version = 0
            app_version = '{}'.format(
                self.tcex_json.get('package', {}).get(
                    'app_version', 'v{}.{}'.format(major_version, minor_version)
                )
            )

            # update package data
            self.package_data['package'].append(
                {'action': 'App Version:', 'output': 'v{}.{}'.format(major_version, minor_version)}
            )

            # !!! The name of the folder in the zip is the *key* for an App. This value must
            # !!! remain consistent for the App to upgrade successfully.
            app_name_version = '{}_{}'.format(app_name, app_version)

            # build app directory
            tmp_app_path = os.path.join(tmp_path, app_name_version)
            if os.access(tmp_app_path, os.W_OK):
                # cleanup any previous failed builds
                shutil.rmtree(tmp_app_path)
            shutil.copytree(template_app_path, tmp_app_path)

            # Copy install.json
            # TODO: do we need copy if writing the data in the next step?
            shutil.copy(install_json, os.path.join(tmp_app_path, 'install.json'))

            # Update commit hash after install.json has been copied.
            if self.commit_hash is not None:
                ij.setdefault('commitHash', self.commit_hash)
            self._write_install_json(os.path.join(tmp_app_path, 'install.json'), ij)

            # update package data
            self.package_data['package'].append(
                {'action': 'Commit Hash:', 'output': self.commit_hash}
            )

            # zip file
            self.zip_file(self.app_path, app_name_version, tmp_path)

            # cleanup build directory
            shutil.rmtree(tmp_app_path)

        # bundle zips (must have more than 1 app)
        if len(self._app_packages) > 1:
            self.bundle(self.tcex_json.get('package', {}).get('bundle_name', app_name))
336764
def tag_add(package, tag, pkghash):
    
    team, owner, pkg = parse_package(package)
    session = _get_session(team)

    session.put(
        "{url}/api/tag/{owner}/{pkg}/{tag}".format(
            url=get_registry_url(team),
            owner=owner,
            pkg=pkg,
            tag=tag
        ),
        data=json.dumps(dict(
            hash=_match_hash(package, pkghash)
        ))
    )
858273
void packageArtifacts(final File compileDir, final MavenProject project, final Set<String> bundles)
        throws IOException, XCodeException
  {

    File mainArtifact = createMainArtifactFile(project);

    attachBundle(compileDir, project, bundles, mainArtifact);

    final File mainArtifactFile = archiveMainArtifact(project, mainArtifact);
    setMainArtifact(project, mainArtifactFile);

  }
58416
def add_project_ui(self):
        

        directory = umbra.ui.common.store_last_browsed_path(QFileDialog.getExistingDirectory(self,
                                                                                             "Add Project:",
                                                                                             RuntimeGlobals.last_browsed_path))
        if not directory:
            return False

        return self.add_project(directory)
945513
def install_package(self, client, package):
        """"""
        install_cmd = "{sudo} '{install} {package}'".format(
            sudo=self.get_sudo_exec_wrapper(),
            install=self.get_install_cmd(),
            package=package
        )

        try:
            out = ipa_utils.execute_ssh_command(
                client,
                install_cmd
            )
        except Exception as error:
            raise IpaDistroException(
                'An error occurred installing package {package} '
                'on instance: {error}'.format(
                    package=package,
                    error=error
                )
            )
        else:
            return out
855974
void addPackageInfo(final PackageInfo packageInfo) {
        if (packageInfoSet == null) {
            packageInfoSet = new HashSet<>();
        }
        packageInfoSet.add(packageInfo);
    }
281548
def add_project(self, project_id=None, name=None, **kwargs):
        
        if project_id not in self._projects:

            for project in self._projects.values():
                if name and project.name == name:
                    raise aiohttp.web.HTTPConflict(text='Project name "{}" already exists'.format(name))
            project = Project(project_id=project_id, controller=self, name=name, **kwargs)
            self._projects[project.id] = project
            return self._projects[project.id]
        return self._projects[project_id]