Sha256: 055db7d6d0e51c48199e9216c870b63a0ac922f78d77604adcde50e108fa03c4

Contents?: true

Size: 570 Bytes

Versions: 4

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

require 'find'

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

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