Figure out which version of Chef this cookbook requires. Returns an array
 of Gem::Requirement-style string like `~> 12.0`.

 @return [Array<String>]
5982
def chef_version_requirement
      if spec.metadata['halite_chef_version']
        # Manually overridden by gem metadata, use that.
        [spec.metadata['halite_chef_version']]
      elsif dep = spec.dependencies.find {|inner_dep| inner_dep.name == 'chef' && !inner_dep.requirement.none? }
        # Parse through the dependencies looking for something like `spec.add_dependency 'chef', '>= 12.1''`.
        dep.requirement.as_list
      else
        ['>= 12']
      end
    end
905429
def cookbooks_and_dependencies
        loaded_dependencies = Hash.new(false)

        dependencies = @cookbooks.dup
        dependencies.each do |cookbook|
          loaded_dependencies[cookbook.cookbook_name] = true

          cookbook.metadata.dependencies.keys.each do |dependency_name|
            unless loaded_dependencies[dependency_name]
              dependencies << load_cookbook(dependency_name)
              loaded_dependencies[dependency_name] = true
            end
          end
        end
      end
629105
private String getPrefixItem(String requirement, String minVersion, String maxVersion) {
        
        switch (requirement) {
        case Languages.JAVA: return "java";
        case Languages.PYTHON: return "python";
        case Languages.RUBY: return "ruby";
        case Languages.NET: return "dotnet";
        case Languages.PHP: return "php";
        
        case Containers.JBOSS6: return "jboss";
        case Containers.JBOSS7: return "jboss";
        case Containers.JETTY6: return "jetty";
        case Containers.TOMCAT: return "tomcat";
        case Containers.TOMCAT8: return "tomcat";

        case Categories.MYSQL: return "mysql";
        case Categories.MARIADB: return "maria";
        case Categories.POSTGRESQL: return "postgresql";
        case Categories.MONGODB: return "mongoDB";
        case Categories.REDIS: return "redis";

        default:
            return "";
        }
    }
650505
def install
      extend Rake::DSL
      # Core Halite tasks
      unless options[:no_gem]
        desc "Convert #{gemspec.name}-#{gemspec.version} to a cookbook in the pkg directory"
        task 'chef:build' do
          build_cookbook
        end

        desc "Push #{gemspec.name}-#{gemspec.version} to Supermarket"
        task 'chef:release' => ['chef:build'] do
          release_cookbook(pkg_path)
        end

        # Patch the core gem tasks to run ours too
        task 'build' => ['chef:build']
        task 'release' => ['chef:release']
      else
        desc "Push #{gem_name} to Supermarket"
        task 'chef:release' do
          release_cookbook(base)
        end
      end

      # Foodcritic doesn't have a config file, so just always try to add it.
      unless options[:no_foodcritic]
        install_foodcritic
      end

      # If a .kitchen.yml exists, install the Test Kitchen tasks.
      unless options[:no_kitchen] || !File.exist?(File.join(@base, '.kitchen.yml'))
        install_kitchen
      end
    end
732493
def python_version_matchers():
    """"""
    version = sys.version_info
    patterns = [
        "{0}",
        "{0}{1}",
        "{0}.{1}",
    ]
    matchers = [
        pattern.format(*version)
        for pattern in patterns
    ] + [None]
    return set(matchers)
940555
def version_required #:nodoc:
            max = [ "1.0", 0 ]

            self.each_key do |field|
                attributes = self.class.fields[field.value]
                if attributes.nil?
                    STDERR.puts "Warning: object #{self.class} has undocumented field #{field.value}"
                    next
                end

                version = attributes[:Version] || '1.0'
                level = attributes[:ExtensionLevel] || 0
                current = [ version, level ]

                max = [ max, current, self[field.value].version_required ].max
            end

            max
        end
1205661
def gem_dependencies(gem_name)
      Utils.cache.cache(gem_name) do
        gems = Utils.gems_collection(false)
        gem_collection = gems.find_by_name(gem_name)

        return '' if gem_collection.nil?

        gem_collection = Parallel.map(gem_collection, in_threads: 4) do |gem|
          [gem, spec_for(gem.name, gem.number, gem.platform)]
        end
        gem_collection.reject! do |_, spec|
          spec.nil?
        end

        Parallel.map(gem_collection, in_threads: 4) do |gem, spec|
          dependencies = spec.dependencies.select do |d|
            d.type == :runtime
          end

          dependencies = Parallel.map(dependencies, in_threads: 4) do |d|
            [d.name.is_a?(Array) ? d.name.first : d.name, d.requirement.to_s]
          end

          {
            name: gem.name,
            number: gem.number,
            platform: gem.platform,
            dependencies: dependencies
          }
        end
      end
    end
1268193
def chef_runner_options
      super.tap do |options|
        options[:halite_gemspec] = halite_gemspec
        # And some legacy data.
        options[:default_attributes].update(default_attributes)
        options[:normal_attributes].update(normal_attributes)
        options[:override_attributes].update(override_attributes)
        options.update(chefspec_options)
      end
    end
715636
def load_cookbook(path_or_name)
      require "chef/exceptions"
      if File.directory?(path_or_name)
        cookbook_path = path_or_name
        # First, is there a cookbook in the specified dir that matches?
        require "chef/cookbook/cookbook_version_loader"
        begin
          v = Chef::Cookbook::CookbookVersionLoader.new(cookbook_path)
          v.load!
          cookbook = v.cookbook_version
        rescue Chef::Exceptions::CookbookNotFoundInRepo
          raise InvalidCookbook.new(cookbook_path)
        end
      else
        cookbook_name = path_or_name
        # Second, is there a cookbook in their local repository that matches?
        require "chef/cookbook_loader"
        cb_loader = Chef::CookbookLoader.new(cookbook_repo_paths)
        cb_loader.load_cookbooks_without_shadow_warning

        begin
          cookbook = cb_loader[cookbook_name]
        rescue Chef::Exceptions::CookbookNotFoundInRepo
          cookbook_repo_paths.each do |repo_path|
            cookbook_path = File.join(repo_path, cookbook_name)
            if File.directory?(cookbook_path)
              raise InvalidCookbook.new(cookbook_path)
            end
          end
          raise CookbookNotFound.new(cookbook_name, cookbook_repo_paths)
        end
      end
      cookbook
    end
325254
def chef_repo?
        @_chef_repo ||= begin
          chef_folders = %w(.chef certificates config cookbooks data_bags environments roles)
          (root_folders & chef_folders).size > 2
        end
      end
1078949
def find_matching_packages(req)
      return {} unless req =~ Lyp::PACKAGE_RE

      req_package = $1
      req_version = $2

      req = nil
      if @opts[:forced_package_paths] && @opts[:forced_package_paths][req_package]
        req_version = 'forced'
      end

      req = Lyp.version_req(req_version || '>=0') rescue nil
      available_packages.select do |package, leaf|
        if (package =~ Lyp::PACKAGE_RE) && (req_package == $1)
          version = Lyp.version($2 || '0') rescue nil
          if version.nil? || req.nil?
            req_version.nil? || (req_version == $2)
          else
            req =~ version
          end
        else
          nil
        end
      end
    end
56276
def versions(args = {}, &bl)
      local_args = Hash[args]
      recursive  = local_args[:recursive]
      dev_deps   = local_args[:dev_deps]
      versions   = local_args[:versions] || {}

      gem_versions = Polisher::VersionChecker.versions_for(name, &bl)
      versions.merge! name => gem_versions
      local_args[:versions] = versions

      if recursive
        versions.merge! dependency_versions local_args, &bl
        versions.merge! dependency_versions local_args.merge(:dev => true), &bl if dev_deps
      end

      versions
    end
999970
def obsolete_and_new(changes = { })
      return if changes.empty?
      if changes['new'].present?
        changes['new'].each { |name, _| ForemanChef::Environment.create(:name => name, :chef_proxy_id => @chef_proxy.id) }
      end
      if changes['obsolete'].present?
        changes['obsolete'].each { |name, _| ForemanChef::Environment.where(:chef_proxy_id => @chef_proxy.id).find_by_name(name).destroy }
      end
      []
    end
128508
def cookbook_collection(node)
      if chef_run.respond_to?(:run_context)
        chef_run.run_context.cookbook_collection # Chef 11.8+
      elsif node.respond_to?(:run_context)
        node.run_context.cookbook_collection # Chef 11+
      else
        node.cookbook_collection # Chef 10
      end
    end
521314
def get_version():
    
    reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
    with open('requests_kerberos/__init__.py') as fd:
        matches = list(filter(lambda x: x, map(reg.match, fd)))

    if not matches:
        raise RuntimeError(
            'Could not find the version information for requests_kerberos'
            )

    return matches[0].group(1)
829549
def matches_requirement(self, req):
        
        # Requirement may contain extras - parse to lose those
        # from what's passed to the matcher
        r = parse_requirement(req)
        scheme = get_scheme(self.metadata.scheme)
        try:
            matcher = scheme.matcher(r.requirement)
        except UnsupportedVersionError:
            # XXX compat-mode if cannot read the version
            logger.warning('could not read version %r - using name only',
                           req)
            name = req.split()[0]
            matcher = scheme.matcher(name)

        name = matcher.key   # case-insensitive

        result = False
        for p in self.provides:
            p_name, p_ver = parse_name_and_version(p)
            if p_name != name:
                continue
            try:
                result = matcher.match(p_ver)
                break
            except UnsupportedVersionError:
                pass
        return result
171705
def version(self):
        
        return dict(
            buttersink=theVersion,
            btrfs=self.butterStore.butter.btrfsVersion,
            linux=platform.platform(),
        )