<commit_before>require 'formula'

class Yasm < Formula
  homepage 'http://yasm.tortall.net/'
  url 'http://tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz'
  sha256 '768ffab457b90a20a6d895c39749adb547c1b7cb5c108e84b151a838a23ccf31'

  head 'https://github.com/yasm/yasm.git'

  def options
    [['--enable-python', 'Enable Python bindings support.']]
  end

  if ARGV.build_head?
    depends_on 'gettext'
    depends_on 'automake' => :build if MacOS.xcode_version.to_f >= 4.3
  end

  depends_on 'Cython' => :python if ARGV.include? '--enable-python'

  def install
    args = %W[--prefix=#{prefix} --disable-debug]

    if ARGV.include? '--enable-python'
      args << '--enable-python'
      args << '--enable-python-bindings'
    end

    system './autogen.sh' if ARGV.build_head?
    system './configure', *args
    system 'make install'
  end

  def caveats
    if ARGV.include? '--enable-python' then <<-EOS.undent
      Python bindings installed to:
        #{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages

      For non-homebrew Python, you need to amend your PYTHONPATH like so:
        export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
      EOS
    end
  end

  def which_python
    'python' + `python -c 'import sys;print(sys.version[:3])'`.strip
  end
end<commit_msg>yasm: Add LIBS,INCLUDES<commit_after>require 'formula'

class Yasm < Formula
  homepage 'http://yasm.tortall.net/'
  url 'http://tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz'
  sha256 '768ffab457b90a20a6d895c39749adb547c1b7cb5c108e84b151a838a23ccf31'

  head 'https://github.com/yasm/yasm.git'

  def options
    [['--enable-python', 'Enable Python bindings support.']]
  end

  if ARGV.build_head?
    depends_on 'gettext'
    depends_on 'automake' => :build if MacOS.xcode_version.to_f >= 4.3
  end

  depends_on 'Cython' => :python if ARGV.include? '--enable-python'

  def install
    args = %W[--prefix=#{prefix} --disable-debug]

    if ARGV.include? '--enable-python'
      args << '--enable-python'
      args << '--enable-python-bindings'
    end

    # Avoid "ld: library not found for -lcrt1.10.6.o" on Xcode without CLT
    ENV['LIBS'] = ENV.ldflags
    ENV['INCLUDES'] = ENV.cppflags
    system './autogen.sh' if ARGV.build_head?
    system './configure', *args
    system 'make install'
  end

  def caveats
    if ARGV.include? '--enable-python' then <<-EOS.undent
      Python bindings installed to:
        #{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages

      For non-homebrew Python, you need to amend your PYTHONPATH like so:
        export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
      EOS
    end
  end

  def which_python
    'python' + `python -c 'import sys;print(sys.version[:3])'`.strip
  end
end
{'fraction_non_alphanumeric': 0.13876967095851217, 'fraction_numerical': 0.03648068669527897, 'mean_word_length': 3.168405365126677, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4283777', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1022, 'n_words': 214}