Returns True if the package is in the local package repository
338149
def is_local(self):
        """"""
        local_repo = package_repository_manager.get_repository(
            self.config.local_packages_path)
        return (self.resource._repository.uid == local_repo.uid)
461423
def getversion(package):
    
    distribution = get_distribution(package)
    if distribution is None:
        raise RuntimeError("Can't find distribution {0}".format(package))
    repo_type = get_repo_type(distribution.location)
    if repo_type is None:
        return distribution.version

    return repo_type.get_version(distribution.location)
942918
def is_local(self):
        """"""
        from ambry.orm.exc import NotFoundError
        try:
            if self.local_datafile.exists:
                return True
        except NotFoundError:
            pass

        return False
680484
public static boolean packageResults() {
        String packageResults = getProgramProperty(PACKAGE_RESULTS);
        if (packageResults == null) {
            return false;
        }
        if ("".equals(packageResults)) {
            return true;
        }
        return "true".equalsIgnoreCase(packageResults);
    }
306538
def is_package(self, fullname):
        """"""
        filename = os.path.split(self.get_filename(fullname))[1]
        filename_base = filename.rsplit('.', 1)[0]
        tail_name = fullname.rpartition('.')[2]
        return filename_base == '__init__' and tail_name != '__init__'
172311
def available(self):
        

        for module_name in self.packages:
            if importlib.util.find_spec(module_name):
                return True
        return False
479297
def nonlocal_packages_path(self):
        """"""
        paths = self.packages_path[:]
        if self.local_packages_path in paths:
            paths.remove(self.local_packages_path)
        return paths
493466
def _repo_is_preset(repo):
    

    package_template = "https://raw.githubusercontent.com"
    package_template += "/{repo}/master/package.json"
    package_path = package_template.format(repo=repo)

    response = get(package_path)
    if response.status_code == 404:
        return False

    try:
        data = response.json()
    except:
        return False

    if not data.get("type") == "bepreset":
        return False

    return True
214447
def _check_apt_get():
    """"""
    check = False
    if 'TESTING' not in os.environ:
        result = exec_command(['dpkg', '-l', 'apio'])
        if result and result.get('returncode') == 0:
            match = re.findall('rc\s+apio', result.get('out')) + \
                    re.findall('ii\s+apio', result.get('out'))
            check = len(match) > 0
    return check
904151
def check_local_install(ctx, version, ext, server="local"):
    
    here = Path(ctx.releaser.here).resolve()
    dist_dir = here / 'dist'

    all_files = list(dist_dir.glob('*.{}'.format(ext)))
    the_file = all_files[0]
    for f in all_files[1:]:
        if f.stat().st_mtime > the_file.stat().st_mtime:
            the_file = f
            # this is the latest generated file of the given version

    environment = 'env-{}-{}-{}'.format(version, ext, server)
    if server == "local":
        pass
    else:
        # upload to server
        print("** Uploading to server **")
        cmd = 'twine upload {}'.format(the_file)
        # for PyPI, let twine pick the server
        if server != "pypi":
            cmd = cmd + ' -r {}'.format(server)
        result = invoke.run(cmd, warn=True)
        if result.failed:
            print(textwrap.fill("[{}ERROR{}] Something broke trying to upload "
                                "your package. This will be the case if you "
                                "have already uploaded it before. To upload "
                                "again, use a different version number "
                                "(or a different build by including a '+' "
                                "suffix to your version number)."
                                .format(ERROR_COLOR, RESET_COLOR),
                                width=text.get_terminal_size().columns - 1,
                                subsequent_indent=' '*8))
            # print(result.stderr)

    # remove directory if it exists
    if (here / 'env' / environment).exists():
        shutil.rmtree('env' + os.sep + environment)
    invoke.run('python -m venv env{}{}'.format(os.sep, environment))
    other_dependencies(ctx, server, environment)
    if server == "local":
        result = invoke.run('env{0}{1}{0}Scripts{0}pip{2} install {3} --no-cache'
                            .format(os.sep, environment, '.exe', the_file),
                            hide=True)
    else:
        #print("  **Install from server**")
        result = invoke.run('env{0}{1}{0}Scripts{0}pip{2} install -i {3} '
                            '{4}=={5} --no-cache'
                            .format(os.sep, environment, '.exe',
                                    server_url(server),
                                    ctx.releaser.module_name, version),
                            hide=True)
        if result.failed:
            print('[{}ERROR{}] Something broke trying to install your package.'
                  .format(ERROR_COLOR, RESET_COLOR))
            print(result.stderr)
            sys.exit(1)
    print("** Test version of installed package **")

    result = invoke.run('env{0}{1}{0}Scripts{0}python{2} -c '
                        'exec("""import {3}\\nprint({3}.__version__)""")'
                        .format(os.sep, environment, '.exe',
                                (ctx.releaser.module_name).strip()))
    test_version = result.stdout.strip()
    # print(test_version, type(test_version), type(expected_version))
    if Version(test_version) == version:
        results = '{}{} install {} works!{}'.format(GOOD_COLOR, server, ext,
                                                    RESET_COLOR)
    else:
        results = '{}{} install {} broken{}'.format(ERROR_COLOR, server, ext,
                                                    RESET_COLOR)
    print(results)
    return results
155351
private function getInstalledVersion($localRepository, $packageName)
    {
        if (count($installed = $localRepository->findPackages($packageName))) {
            /** @var PackageInterface[] $installed */
            return $installed[0]->getPrettyVersion();
        }

        return null;
    }
497056
public static boolean isValidJavaPackage(String packageName) {
        if (isBlank(packageName)) {
            return false;
        }
        final String[] parts = packageName.split("\\.");
        for (String part : parts) {
            if (!isValidJavaIdentifier(part)) {
                return false;
            }
        }
        return true;
    }
1191023
def installed?(package)
      fail LookupFailed, 'No supported package tool found.' if tool.nil?

      cmd = tools[tool]
      fail LookupFailed, "Package tool '#{cmd}' not found." if command?(cmd).nil?

      send tool, package
    end
1292175
def is_installed(self, pkgname):
        

        return any(d for d in self.get_distributions() if d.project_name == pkgname)
447844
public static boolean extractPackage(
      String packageName, String targetFolder, boolean isVerbose, boolean isInheritIO) {
    String cmd = String.format("tar -xvf %s", packageName);

    int ret = runSyncProcess(isVerbose, isInheritIO,
        splitTokens(cmd), new StringBuilder(), new File(targetFolder));

    return ret == 0;
  }
1213816
def package_data_location():
    '''

    '''
    pkg_dir = os.path.split(__file__)[0]
    pkg_data_dir = os.path.join(pkg_dir,'data')
    return pkg_data_dir
614343
def is_package_installed(self, package_name):
        """"""
        if not package_name:
            raise ValueError('package_name required.')

        installed = True
        try:
            Cmd.sh_e('{0} --query {1} --quiet'.format(self.rpm_path,
                                                      package_name))
        except InstallError:
            installed = False
        return installed