Sha256: 6963cd6f3de12f8f302e6a05ddcc36e6d884264acce0c12a7b78af8a396c751d

Contents?: true

Size: 570 Bytes

Versions: 4

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

require 'find'

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

        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.7\s*$}.match?(first_line)
          return true if %r{^#!\s*/usr/bin/python3.7\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/python37.rb
xezat-0.3.0 lib/xezat/detector/python37.rb
xezat-0.2.3 lib/xezat/detector/python37.rb
xezat-0.2.2 lib/xezat/detector/python37.rb