Returns:
            (DeveloperPackage, new_data) 2-tuple IFF the preprocess function
            changed the package; otherwise None.
323506
def _get_preprocessed(self, data):
        
        from rez.serialise import process_python_objects
        from rez.utils.data_utils import get_dict_diff_str
        from copy import deepcopy

        with add_sys_paths(config.package_definition_build_python_paths):
            preprocess_func = getattr(self, "preprocess", None)

            if preprocess_func:
                print_info("Applying preprocess from package.py")
            else:
                # load globally configured preprocess function
                dotted = self.config.package_preprocess_function

                if not dotted:
                    return None

                if '.' not in dotted:
                    print_error(
                        "Setting 'package_preprocess_function' must be of "
                        "form 'module[.module.module...].funcname'. Package  "
                        "preprocessing has not been applied.")
                    return None

                name, funcname = dotted.rsplit('.', 1)

                try:
                    module = __import__(name=name, fromlist=[funcname])
                except Exception as e:
                    print_error("Failed to load preprocessing function '%s': %s"
                                % (dotted, str(e)))
                    return None

                setattr(module, "InvalidPackageError", InvalidPackageError)
                preprocess_func = getattr(module, funcname)

                if not preprocess_func or not isfunction(isfunction):
                    print_error("Function '%s' not found" % dotted)
                    return None

                print_info("Applying preprocess function %s" % dotted)

            preprocessed_data = deepcopy(data)

            # apply preprocessing
            try:
                preprocess_func(this=self, data=preprocessed_data)
            except InvalidPackageError:
                raise
            except Exception as e:
                print_error("Failed to apply preprocess: %s: %s"
                            % (e.__class__.__name__, str(e)))
                return None

        # if preprocess added functions, these may need to be converted to
        # SourceCode instances
        preprocessed_data = process_python_objects(preprocessed_data)

        if preprocessed_data == data:
            return None

        # recreate package from modified package data
        package = create_package(self.name, preprocessed_data,
                                 package_cls=self.__class__)

        # print summary of changed package attributes
        txt = get_dict_diff_str(
            data,
            preprocessed_data,
            title="Package attributes were changed in preprocessing:"
        )
        print_info(txt)

        return package, preprocessed_data
752020
def package_loading(self):
        
        t1 = time.time()
        yield None

        t2 = time.time()
        self.package_load_time += t2 - t1
770875
def refactor_module_to_package(self):
        """"""
        refactor = ModuleToPackage(self.project, self.resource)
        return self._get_changes(refactor)
1109653
def genchanges(self):
        """"""
        chparams = self.params.copy()
        debpath = os.path.join(self.buildroot, self.rule.output_files[0])
        chparams.update({
            'fullversion': '{epoch}:{version}-{release}'.format(**chparams),
            'metahash': self._metahash().hexdigest(),
            'deb_sha1': util.hash_file(debpath, hashlib.sha1()).hexdigest(),
            'deb_sha256': util.hash_file(debpath, hashlib.sha256()
                                         ).hexdigest(),
            'deb_md5': util.hash_file(debpath, hashlib.md5()).hexdigest(),
            'deb_bytes': os.stat(debpath).st_size,
            # TODO: having to do this split('/')[-1] is absurd:
            'deb_filename': debpath.split('/')[-1],
            })

        output = '\n'.join([
            'Format: 1.8',
            # Static date string for repeatable builds:
            'Date: Tue, 01 Jan 2013 00:00:00 -0700',
            'Source: {package_name}',
            'Binary: {package_name}',
            'Architecture: {arch}',
            'Version: {fullversion}',
            'Distribution: {distro}',
            'Urgency: {urgency}',
            'Maintainer: {packager}',
            'Description: ',
            ' {package_name} - {short_description}',
            'Changes: ',
            ' {package_name} ({fullversion}) {distro}; urgency={urgency}',
            ' .',
            ' * Built by Butcher - metahash for this build is {metahash}',
            'Checksums-Sha1: ',
            ' {deb_sha1} {deb_bytes} {deb_filename}',
            'Checksums-Sha256: ',
            ' {deb_sha256} {deb_bytes} {deb_filename}',
            'Files: ',
            ' {deb_md5} {deb_bytes} {section} {priority} {deb_filename}',
            ''  # Newline at end of file.
            ]).format(**chparams)

        return output
1185547
def outdated(self):
        
        if hydpy.pub.options.forcecompiling:
            return True
        if os.path.split(hydpy.__path__[0])[-2].endswith('-packages'):
            return False
        if not os.path.exists(self.dllfilepath):
            return True
        cydate = os.stat(self.dllfilepath).st_mtime
        for pysourcefile in self.pysourcefiles:
            pydate = os.stat(pysourcefile).st_mtime
            if pydate > cydate:
                return True
        return False
324126
def removed(name):
    '''
    
    '''

    ret = {'name': name,
           'changes': {},
           'pchanges': {},
           'result': None,
           'comment': ''}

    old = __salt__['snap.versions_installed'](name)
    if not old:
        ret['comment'] = 'Package {0} is not installed'.format(name)
        ret['result'] = True
        return ret

    if __opts__['test']:
        ret['comment'] = 'Package {0} would have been removed'.format(name)
        ret['result'] = None
        ret['pchanges']['old'] = old[0]['version']
        ret['pchanges']['new'] = None
        return ret

    remove = __salt__['snap.remove'](name)
    ret['comment'] = 'Package {0} removed'.format(name)
    ret['result'] = True
    ret['changes']['old'] = old[0]['version']
    ret['changes']['new'] = None
    return ret
558159
function done(err, content) {
            if (err) return cb(err);

            var code = JSON.parse(self.square.package.source)
              , current = bundle.version || self.version(bundle.meta.content)
              , source;

            code.bundle[key].version = version;
            bundle.version = version;
            bundle.content = content;

            // now that we have updated the shizzle, we can write a new file
            // also update the old source with the new version
            source = JSON.stringify(code, null, 2);
            self.square.package.source = source;

            try {
              async.parallel([
                  async.apply(fs.writeFile, self.square.package.location, source)
                , async.apply(fs.writeFile, bundle.meta.location, content)
              ], function (err, results) {
                self.square.logger.notice(
                    'sucessfully updated %s from version %s to %s'
                  , key
                  , current.grey
                  , version.green
                );

                cb(err);
              });
            } catch (e) { err = e; }
          }
188900
def _check_if_used(self, removes):
        """"""
        if "--check-deps" in self.extra:
            package, dependency, pkg_dep = [], [], []
            for pkg in find_package("", self.dep_path):
                deps = Utils().read_file(self.dep_path + pkg)
                for rmv in removes:
                    if GetFromInstalled(rmv).name() and rmv in deps.split():
                        pkg_dep.append(
                            "{0} is dependency of the package --> {1}".format(
                                rmv, pkg))
                        package.append(pkg)
                        dependency.append(rmv)
            if package:
                if "--checklist" in self.extra:
                    text = ("Press 'spacebar' to choose packages for the remove"
                            " exception")
                    backtitle = "{0} {1}".format(self.meta.__all__,
                                                 self.meta.__version__)
                    status = False
                    choose = DialogUtil(pkg_dep, text, " !!! WARNING !!! ",
                                        backtitle, status).checklist()
                    for pkg in choose:
                        self.skip.append(pkg.split()[0])
                else:
                    self.msg.template(78)
                    print("| {0}{1}{2}".format(
                        self.meta.color["RED"], " " * 30 + "!!! WARNING !!!",
                        self.meta.color["ENDC"]))
                    self.msg.template(78)
                    for p, d in zip(package, dependency):
                        print("| {0}{1}{2} is dependency of the package --> "
                              "{3}{4}{5}".format(self.meta.color["YELLOW"], d,
                                                 self.meta.color["ENDC"],
                                                 self.meta.color["GREEN"], p,
                                                 self.meta.color["ENDC"]))
                    self.msg.template(78)
                    self._skip_remove()
832243
def update(self, quiet=False, prefix='[polyglot_data] '):
    
    self.clear_status_cache()
    for pkg in self.packages():
      if self.status(pkg) == self.STALE:
        self.download(pkg, quiet=quiet, prefix=prefix)
112009
def changed(self, code_changed=False, value_changed=False):
        
        for d in self._dependents:
            d._dep_changed(self, code_changed=code_changed,
                           value_changed=value_changed)
891788
function changes() {
  const version   = require('./package.json').version;
  const changelog = File.readFileSync('CHANGELOG.md', 'utf-8');
  const match     = changelog.match(/^## Version (.*) .*\n([\S\s]+?)\n##/m);

  assert(match, 'CHANGELOG.md missing entry: ## Version ' + version);
  assert.equal(match[1], version, 'CHANGELOG.md missing entry for version ' + version);

  const changes   = match[2].trim();
  assert(changes, 'CHANGELOG.md empty entry for version ' + version);
  File.writeFileSync('.changes', changes);
}
315015
def display_package_changes(pre_packages, post_packages, indent=''):
    
    # use package name to determine what's changed
    pre_package_names = {p.name: p for p in pre_packages}
    post_package_names = {p.name: p for p in post_packages}

    added = set(post_package_names.keys()) - set(pre_package_names.keys())
    removed = set(pre_package_names.keys()) - set(post_package_names.keys())
    changed_maybe = set(pre_package_names.keys()) & set(post_package_names.keys())

    changed = []
    for package_name in sorted(changed_maybe):
        if pre_package_names[package_name] != post_package_names[package_name]:
            changed.append((pre_package_names[package_name], post_package_names[package_name]))

    if not (added or removed or changed):
        echo_info('{}No changes'.format(indent))

    if added:
        echo_success('{}Added packages:'.format(indent))
        for package_name in sorted(added):
            echo_info('{}    {}'.format(indent, post_package_names[package_name]))

    if removed:
        echo_failure('{}Removed packages:'.format(indent))
        for package_name in sorted(removed):
            echo_info('{}    {}'.format(indent, pre_package_names[package_name]))

    if changed:
        echo_warning('{}Changed packages:'.format(indent))
        for pre, post in changed:
            echo_info('{}    {} -> {}'.format(indent, pre, post))
1158410
function fileToPackage(d) {
  debug(d);
  if (d.startsWith('packages/node_modules/')) {
    d = d.replace('packages/node_modules/', '');
    d = d.split('/');
    if (d[0].startsWith('@')) {
      return d.slice(0, 2).join('/');
    }

    return d[0];
  }

  if (d.startsWith('docs') || d.startsWith('documentation') || d.startsWith('.github') || d.endsWith('.md')) {
    return 'docs';
  }

  return 'tooling';
}
95697
def refactor(source, fixer_names, ignore=None, filename=''):
    
    check_lib2to3()
    from lib2to3 import pgen2
    try:
        new_text = refactor_with_2to3(source,
                                      fixer_names=fixer_names,
                                      filename=filename)
    except (pgen2.parse.ParseError,
            SyntaxError,
            UnicodeDecodeError,
            UnicodeEncodeError):
        return source

    if ignore:
        if ignore in new_text and ignore not in source:
            return source

    return new_text
795551
def dpkg_buildpackage(*args,**kwargs):
    cwd=kwargs.pop('cwd',None)
    if len(kwargs)!=0:
        raise ValueError('only kwarg can be "cwd"')
    ""
    args = ['/usr/bin/dpkg-buildpackage']+list(args)
    process_command(args, cwd=cwd)
1310271
function convertForPackage(context, pkg) {
	var name = pkg.name;
	var version = pkg.version;

	var conv = context.deferredConversions;
	var pkgConv = conv[name];
	var depPkg, fns, keys = 0;
	if(pkgConv) {
		for(var range in pkgConv) {
			depPkg = crawl.matchedVersion(context, name, range);
			if(depPkg) {
				fns = pkgConv[range];
				for(var i = 0, len = fns.length; i < len; i++) {
					fns[i].call(context);
				}
				delete pkgConv[range];
			} else {
				keys++;
			}
		}
		if(keys === 0) {
			delete conv[name];
		}
	}
}
1143277
public void convertPackage(PackageDoc pd, DocPath outputdir) {
        if (pd == null) {
            return;
        }
        for (ClassDoc cd : pd.allClasses()) {
            // If -nodeprecated option is set and the class is marked as deprecated,
            // do not convert the package files to HTML. We do not check for
            // containing package deprecation since it is already check in
            // the calling method above.
            if (!(configuration.nodeprecated && utils.isDeprecated(cd)))
                convertClass(cd, outputdir);
        }
    }