Sha256: 0eeb4f3b4c13976ac8c8a770bc0a42c3391a7177f20ff7ddbe220529450b1561

Contents?: true

Size: 570 Bytes

Versions: 4

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

require 'find'

module Xezat
  module Detector
    class Python38
      def detect(variables)
        return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.8'))

        Find.find(variables[:D]) do |file|
          next unless file.end_with?('.py')

          first_line = File.readlines(file).first
          return true if %r{^#!\s*/usr/bin/env\s*python3.8\s*$}.match?(first_line)
          return true if %r{^#!\s*/usr/bin/python3.8\s*$}.match?(first_line)
        end
        false
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xezat-0.3.1 lib/xezat/detector/python38.rb
xezat-0.3.0 lib/xezat/detector/python38.rb
xezat-0.2.3 lib/xezat/detector/python38.rb
xezat-0.2.2 lib/xezat/detector/python38.rb