Replace
        distutils.dist.Distribution with this class
        for the duration of this context.
960254
def patch(cls):
        
        orig = distutils.core.Distribution
        distutils.core.Distribution = cls
        try:
            yield
        finally:
            distutils.core.Distribution = orig
744786
def distros_for_location(location, basename, metadata=None):
    """"""
    if basename.endswith('.egg.zip'):
        basename = basename[:-4]  # strip the .zip
    if basename.endswith('.egg') and '-' in basename:
        # only one, unambiguous interpretation
        return [Distribution.from_location(location, basename, metadata)]
    if basename.endswith('.whl') and '-' in basename:
        wheel = Wheel(basename)
        if not wheel.is_compatible():
            return []
        return [Distribution(
            location=location,
            project_name=wheel.project_name,
            version=wheel.version,
            # Increase priority over eggs.
            precedence=EGG_DIST + 1,
        )]
    if basename.endswith('.exe'):
        win_base, py_ver, platform = parse_bdist_wininst(basename)
        if win_base is not None:
            return interpret_distro_name(
                location, win_base, metadata, py_ver, BINARY_DIST, platform
            )
    # Try source distro extensions (.zip, .tgz, etc.)
    #
    for ext in EXTENSIONS:
        if basename.endswith(ext):
            basename = basename[:-len(ext)]
            return interpret_distro_name(location, basename, metadata)
    return []
541414
def output_package(dist):
        """"""
        if dist_is_editable(dist):
            return '%s (%s, %s)' % (
                dist.project_name,
                dist.version,
                dist.location,
            )
        return '%s (%s)' % (dist.project_name, dist.version)
1040965
def distribution_for_instance(self, inst):
        
        pred = self.__distribution(inst.jobject)
        return javabridge.get_env().get_double_array_elements(pred)
590514
def clean(ctx):
    
    ctx.run(f"python setup.py clean")
    dist = ROOT.joinpath("dist")
    print(f"[clean] Removing {dist}")
    if dist.exists():
        shutil.rmtree(str(dist))
918864
def replace_in_dirs(version):
    """"""
    print(color(
        "Upgrading directory-components dependency in all repos...",
        fg='blue', style='bold'))
    for dirname in Utils.dirs:
        replace = "directory-components=={}".format(version)
        replace_in_files(dirname, replace)
    done(version)
852090
def cache_distribution(cls, zf, source, target_dir):
    """"""
    dependency_basename = os.path.basename(source)
    if not os.path.exists(target_dir):
      target_dir_tmp = target_dir + '.' + uuid.uuid4().hex
      for name in zf.namelist():
        if name.startswith(source) and not name.endswith('/'):
          zf.extract(name, target_dir_tmp)
      os.rename(os.path.join(target_dir_tmp, source),
                os.path.join(target_dir_tmp, dependency_basename))

      rename_if_empty(target_dir_tmp, target_dir)

    dist = DistributionHelper.distribution_from_path(target_dir)
    assert dist is not None, 'Failed to cache distribution %s' % source
    return dist
970568
def _replace_constant_methods(self):
        """"""
        self.cumulative_distribution = self._constant_cumulative_distribution
        self.percent_point = self._constant_percent_point
        self.probability_density = self._constant_probability_density
        self.sample = self._constant_sample
1039664
def build_distribution():
    """"""
    result = invoke.run('python setup.py sdist bdist_egg bdist_wheel',
                        warn=True, hide=True)
    if result.ok:
        print("[{}GOOD{}] Distribution built without errors."
              .format(GOOD_COLOR, RESET_COLOR))
    else:
        print('[{}ERROR{}] Something broke trying to package your '
              'code...'.format(ERROR_COLOR, RESET_COLOR))
        print(result.stderr)
        sys.exit(1)
1053537
def _patch_distribution_metadata():
    """"""
    for attr in ('write_pkg_file', 'read_pkg_file', 'get_metadata_version'):
        new_val = getattr(setuptools.dist, attr)
        setattr(distutils.dist.DistributionMetadata, attr, new_val)
768119
function (callback) {
		fs.mkdir("./dist", function (err) {
			if (err && err.code !== "EEXIST") {
				callback(err);
				return;
			}

			callback(null);
		});
	}
525183
def get_distribution_dir(catalog_id, dataset_id, distribution_id,
                         catalogs_dir=CATALOGS_DIR, use_short_path=False):
    """"""
    if use_short_path:
        catalog_path = os.path.join(catalogs_dir, "catalog", catalog_id)
        distribution_dir = os.path.join(catalog_path, dataset_id)
    else:
        catalog_path = os.path.join(catalogs_dir, "catalog", catalog_id)
        dataset_path = os.path.join(catalog_path, "dataset", dataset_id)
        distribution_dir = os.path.join(
            dataset_path, "distribution", distribution_id)

    return os.path.abspath(distribution_dir)
954064
def add_distdiff_optgroup(parser):
    

    # for the --processes default
    cpus = cpu_count()

    og = parser.add_argument_group("Distribution Checking Options")

    og.add_argument("--processes", type=int, default=cpus,
                    help="Number of child processes to spawn to handle"
                    " sub-reports. Set to 0 to disable multi-processing."
                    " Defaults to the number of CPUs (%r)" % cpus)

    og.add_argument("--shallow", action="store_true", default=False,
                    help="Check only that the files of this dist have"
                    "changed, do not infer the meaning")

    og.add_argument("--ignore-filenames", action="append", default=[],
                    help="file glob to ignore. Can be specified multiple"
                    " times")

    og.add_argument("--ignore-trailing-whitespace",
                    action="store_true", default=False,
                    help="ignore trailing whitespace when comparing text"
                    " files")
234135
def clean_dists(self, _args):
        """"""
        ctx = self.ctx
        if exists(ctx.dist_dir):
            shutil.rmtree(ctx.dist_dir)
340248
function dist() {
	if (test('-d', DIST_DIR)) {
		rm('-r', DIST_DIR + '*');
	} else {
		mkdir(DIST_DIR);
	}

	[{
		name: DIST_NATIVE_NAME,
		files: SRC_NATIVE_FILES,
		testingFiles: TESTING_NATIVE_FILES
	}, {
		name: DIST_JQUERY_NAME,
		files: SRC_JQUERY_FILES,
		testingFiles: TESTING_JQUERY_FILES
	}, {
		name: DIST_NAME,
		files: SRC_NATIVE_FILES,
		testingFiles: TESTING_NATIVE_FILES
	}].forEach(function(config){
		generateDistFiles(config);
	});
}
53590
def distros_for_filename(filename, metadata=None):
    """"""
    return distros_for_location(
        normalize_path(filename), os.path.basename(filename), metadata
    )
1024186
function mv(src, dist) {
      try {
        fs.renameSync(src, dist);
      }
      catch (e) {
        cp(src, dist);
        rm(src);
      }
    }