define a new package manager
970372
def defpm(name, *lines):
    ''

    @register_macro(name, group='package managers')
    @shell_escape_args
    def package_manager(*packages):
        if not packages:
            return
        sh_packages = ' '.join(pkg for pkg in packages)
        expanded_lines = [line.format(sh_packages) for line in lines]
        return eval([['run'] + expanded_lines])

    package_manager.__doc__ = "install packages with {}".format(name)
414854
def install(self):
        
        packages = self.packages()
        if packages:
            print("")   # new line at start
            for pkg in packages:
                ver = SBoGrep(pkg).version()
                prgnam = "{0}-{1}".format(pkg, ver)
                if find_package(prgnam, self.meta.output):
                    binary = slack_package(prgnam)
                    PackageManager(binary).upgrade(flag="--install-new")
                else:
                    print("\nPackage {0} not found in the {1} for "
                          "installation\n".format(prgnam, self.meta.output))
        else:
            print("\nPackages not found in the queue for installation\n")
            raise SystemExit(1)
223593
def new(cls, package):
        """"""
        partname = package.next_partname("/word/footer%d.xml")
        content_type = CT.WML_FOOTER
        element = parse_xml(cls._default_footer_xml())
        return cls(partname, content_type, element, package)
979712
def add_to_manager(self, manager):
        
        # Derive version spec allowing us to filter against major/minor buckets
        spec = self.spec or self.default_spec(manager)
        # Only look in appropriate major version/family; if self is an issue
        # declared as living in e.g. >=2, this means we don't even bother
        # looking in the 1.x family.
        families = [Version(str(x)) for x in manager]
        versions = list(spec.filter(families))
        for version in versions:
            family = version.major
            # Within each family, we further limit which bugfix lines match up
            # to what self cares about (ignoring 'unreleased' until later)
            candidates = [
                Version(x)
                for x in manager[family]
                if not x.startswith('unreleased')
            ]
            # Select matching release lines (& stringify)
            buckets = []
            bugfix_buckets = [str(x) for x in spec.filter(candidates)]
            # Add back in unreleased_* as appropriate
            # TODO: probably leverage Issue subclasses for this eventually?
            if self.is_buglike:
                buckets.extend(bugfix_buckets)
                # Don't put into JUST unreleased_bugfix; it implies that this
                # major release/family hasn't actually seen any releases yet
                # and only exists for features to go into.
                if bugfix_buckets:
                    buckets.append('unreleased_bugfix')
            # Obtain list of minor releases to check for "haven't had ANY
            # releases yet" corner case, in which case ALL issues get thrown in
            # unreleased_feature for the first release to consume.
            # NOTE: assumes first release is a minor or major one,
            # but...really? why would your first release be a bugfix one??
            no_releases = not self.minor_releases(manager)
            if self.is_featurelike or self.backported or no_releases:
                buckets.append('unreleased_feature')
            # Now that we know which buckets are appropriate, add ourself to
            # all of them. TODO: or just...do it above...instead...
            for bucket in buckets:
                manager[family][bucket].append(self)
198201
protected function doExecute()
    {
        $env      = $this->getOption('env');
        $resolver = new PackageResolver($this->app->getContainer());

        $packages = $env::loadPackages();

        foreach ($packages as $name => $package) {
            $resolver->addPackage($name, $package);
        }

        $pkgName = $this->getArgument(0);

        if (!$pkgName) {
            throw new \InvalidArgumentException('No package input.');
        }

        $package = $resolver->getPackage($pkgName);

        if (!$package) {
            throw new \InvalidArgumentException('Package: ' . $pkgName . ' not found.');
        }

        $dir = $package->getDir();

        // Config
        $targetFolder = $this->console->get('path.etc') . '/package';
        $file         = $dir . '/config.dist.yml';
        $target       = $targetFolder . '/' . $pkgName . '.yml';

        if (is_file($file) && (new BooleanPrompter())->ask(
            "File: <info>config.dist.yml</info> exists,\n do you want to copy it to <info>etc/package/" .
            $pkgName . '.yml</info> [Y/n]: ',
            true
        )) {
            if (is_file($target)
                && (new BooleanPrompter())->ask('File exists, do you want to override it? [N/y]: ', false)) {
                File::delete($target);
            }

            if (!is_file($target) && File::copy($file, $target)) {
                $this->out('Copy to <info>etc/package/' . $pkgName . '.yml</info> successfully.');
            }
        }

        $file   = $dir . '/secret.dist.yml';
        $target = $this->console->get('path.etc') . '/secret.yml';

        if (is_file($file) && (new BooleanPrompter())->ask(
            "File: <info>secret.dist.yml</info> exists,\n do you want to copy content to bottom of " .
            '<info>etc/secret.yml</info> [Y/n]: ',
            true
        )) {
            $secret = file_get_contents($target);
            $new    = file_get_contents($file);
            $secret = $secret . "\n\n# " . $pkgName . "\n" . ltrim($new);

            file_put_contents($target, $secret);

            $this->out('Copy to <info>etc/secret.yml</info> successfully.');
        }

        return true;
    }
653162
def packages(self):
        
        if self._package_manager is None:
            self._package_manager = PackageManager(session=self._session)
        return self._package_manager
994725
def start(self):
        
        self.store()
        self.msg.done()
        if self.upgrade_all:
            if "--checklist" in self.flag:
                self.dialog_checklist()
            print("\nThese packages need upgrading:\n")
            self.msg.template(78)
            print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
                "| Package", " " * 17,
                "New Version", " " * 8,
                "Arch", " " * 4,
                "Build", " " * 2,
                "Repos", " " * 10,
                "Size"))
            self.msg.template(78)
            print("Upgrading:")
            self.views()
            unit, size = units(self.comp_sum, self.uncomp_sum)
            print("\nInstalling summary")
            print("=" * 79)
            print("{0}Total {1} {2} will be upgraded and {3} will be "
                  "installed.".format(self.meta.color["GREY"],
                                      self.count_upg,
                                      self.msg.pkg(self.upgrade_all),
                                      self.count_added))
            print("Need to get {0} {1} of archives.".format(size[0],
                                                            unit[0]))
            print("After this process, {0} {1} of additional disk space "
                  "will be used.{2}".format(size[1], unit[1],
                                            self.meta.color["ENDC"]))
            print("")
            if self.msg.answer() in ["y", "Y"]:
                Download(self.patch_path, self.dwn_links,
                         repo="slack").start()
                self.upgrade_all = self.utils.check_downloaded(
                    self.patch_path, self.upgrade_all)
                self.upgrade()
                self.kernel()
                if self.meta.slackpkg_log in ["on", "ON"]:
                    self.slackpkg_update()
                self.msg.reference(self.installed, self.upgraded)
                delete_package(self.patch_path, self.upgrade_all)
                self.update_lists()
        else:
            slack_arch = ""
            if self.meta.arch == "x86_64":
                slack_arch = "64"
            print("\nSlackware{0} '{1}' v{2} distribution is up to "
                  "date\n".format(slack_arch, self.version, slack_ver()))
939965
def create_package(project, name, sourcefolder=None):
    """"""
    if sourcefolder is None:
        sourcefolder = project.root
    packages = name.split('.')
    parent = sourcefolder
    for package in packages[:-1]:
        parent = parent.get_child(package)
    made_packages = parent.create_folder(packages[-1])
    made_packages.create_file('__init__.py')
    return made_packages
681765
def get_package_manager(self, dep_t):
        """"""
        mgrs = managers.get(dep_t, [])
        for manager in mgrs:
            if manager.works():
                return manager
        if not mgrs:
            err = 'No package manager for dependency type "{dep_t}"'.format(dep_t=dep_t)
            raise exceptions.NoPackageManagerException(err)
        else:
            mgrs_nice = ', '.join([mgr.__name__ for mgr in mgrs])
            err = 'No working package manager for "{dep_t}" in: {mgrs}'.format(dep_t=dep_t,
                                                                              mgrs=mgrs_nice)
            raise exceptions.NoPackageManagerOperationalException(err)
193563
def cli(parser):
    '''
    
    '''
    parser.add_argument('packages', nargs='*', default=local_packages(),
        help='Packages to upgrade (defaults to all installed packages)')
    parser.add_argument('-n', '--dry-run', action='store_true',
        help='Print upgrade actions without running')
    opts = parser.parse_args()

    for package in opts.packages:
        upgrade(package, execute=not opts.dry_run)
1203846
function (packages) {
  var resolvedPackages = {};

  _.forOwn(packages, function (definition, packageName) {
    if (!definition) return;

    var git = definition.git;
    if (!git) return;

    var repo = resolvedPackages[git] = resolvedPackages[git] || {};

    // If no branch provided - checkout origin HEAD and
    // don't show 'detached HEAD' notification
    branch = definition.branch || '-q origin';
    // If no version provided - pull HEAD
    version = definition.version || 'HEAD';
    repo[branch] = repo[branch] || {};
    repo[branch][version] = repo[branch][version] || {};
    repo[branch][version][packageName] = definition.path || '';
  });

  return resolvedPackages;
}
514958
static function create( $name, $parameters = array(), $repositoryPath = false, $repositoryID = false )
    {
        $parameters['name'] = $name;
        $handler = new eZPackage( $parameters, $repositoryPath );

        // New packages always use local repository
        if ( $repositoryID === false )
            $repositoryID = 'local';
        $repositoryInformation = $handler->repositoryInformation( $repositoryID );
        if ( $repositoryPath !== false )
            $repositoryInformation['path'] = $repositoryPath;
        $handler->setCurrentRepositoryInformation( $repositoryInformation );
        return $handler;
    }
161142
function _new_manager(){
    var engine = new jquery_engine(golr_response);
    engine.method('GET');
    engine.use_jsonp(true);
    var manager = new golr_manager(gserv_bulk, gconf, engine, 'async');
    return manager;
}
1035488
def new(cls, package, media):
        
        partname = package.next_media_partname(media.ext)
        return cls(partname, media.content_type, media.blob, package)
729148
def new():
    """"""
    dir_path = os.path.dirname(os.path.realpath(__file__))
    cookiecutter(os.path.join(dir_path, 'historical-cookiecutter/'))
626226
function configurePackageDir(pkgs, currentPackages, dir) {
        var i, location, pkgObj;

        for (i = 0; (pkgObj = currentPackages[i]); i++) {
            pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
            location = pkgObj.location;

            //Add dir to the path, but avoid paths that start with a slash
            //or have a colon (indicates a protocol)
            if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
                location = dir + "/" + (location || pkgObj.name);
            }

            //Create a brand new object on pkgs, since currentPackages can
            //be passed in again, and config.pkgs is the internal transformed
            //state for all package configs.
            pkgs[pkgObj.name] = {
                name: pkgObj.name,
                location: location || pkgObj.name,
                //Remove leading dot in main, so main paths are normalized,
                //and remove any trailing .js, since different package
                //envs have different conventions: some use a module name,
                //some use a file name.
                main: (pkgObj.main || "main")
                      .replace(currDirRegExp, '')
                      .replace(jsSuffixRegExp, '')
            };
        }
    }
1323633
function Bundle(packages, name)
    {
        this.packages = _.map(packages, function (package) {

            if (_.isString(package)) {
                return new Package(package);
            }

            return package;
        });
        this.name = name || 'bundle';
    }