Sha256: 63b99f917807d44637af3c62bc756b79098b2573962645ffdb50a5524dcaa5ce
Contents?: true
Size: 991 Bytes
Versions: 16
Compression:
Stored size: 991 Bytes
Contents
# frozen_string_literal: true module Spandx module Python class Index include Enumerable attr_reader :directory, :name, :pypi, :source def initialize(directory:) @directory = directory @name = 'pypi' @source = 'https://pypi.org' @pypi = Pypi.new @cache = ::Spandx::Core::Cache.new(@name, root: directory) end def update!(*) queue = Queue.new [fetch(queue), save(queue)].each(&:join) cache.rebuild_index end private attr_reader :cache def fetch(queue) Thread.new do pypi.each do |dependency| queue.enq(dependency) end queue.enq(:stop) end end def save(queue) Thread.new do loop do item = queue.deq break if item == :stop cache.insert(item[:name], item[:version], [item[:license]]) end end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems