<commit_before>require 'formula'

class Pil < Formula
  url 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz'
  homepage 'http://www.pythonware.com/products/pil/'
  md5 'fc14a54e1ce02a0225be8854bfba478e'

  depends_on 'jpeg' => :recommended
  depends_on 'little-cms' => :optional

  def install
    # Find the arch for the Python we are building against.
    # We remove 'ppc' support, so we can pass Intel-optimized CFLAGS.
    archs = archs_for_command("python")
    archs.remove_ppc!
    ENV['ARCHFLAGS'] = archs.as_arch_flags

    inreplace "setup.py" do |s|
      # Tell setup where Freetype2 is on 10.5/10.6
      s.gsub! 'add_directory(include_dirs, "/sw/include/freetype2")',
              'add_directory(include_dirs, "/usr/X11/include")'

      s.gsub! 'add_directory(include_dirs, "/sw/lib/freetype2/include")',
              'add_directory(library_dirs, "/usr/X11/lib")'

      # Tell setup where our stuff is
      s.gsub! 'add_directory(library_dirs, "/sw/lib")',
              "add_directory(library_dirs, \"#{HOMEBREW_PREFIX}/lib\")"

      s.gsub! 'add_directory(include_dirs, "/sw/include")',
              "add_directory(include_dirs, \"#{HOMEBREW_PREFIX}/include\")"
    end

    system "python", "setup.py", "build_ext"
    system "python", "setup.py", "install", "--prefix=#{prefix}"
  end

  def caveats; <<-EOS.undent
    This formula installs PIL against whatever Python is first in your path.
    This Python needs to have either setuptools or distribute installed or
    the build will fail.
    EOS
  end
end<commit_msg>PIL: remove 64-bit arch on 32-bit hardware<commit_after>require 'formula'

class Pil < Formula
  url 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz'
  homepage 'http://www.pythonware.com/products/pil/'
  md5 'fc14a54e1ce02a0225be8854bfba478e'

  depends_on 'jpeg' => :recommended
  depends_on 'little-cms' => :optional

  def install
    # Find the arch for the Python we are building against.
    # We remove 'ppc' support, so we can pass Intel-optimized CFLAGS.
    archs = archs_for_command("python")
    archs.remove_ppc!
    # Can't build universal on 32-bit hardware. See:
    # https://github.com/mxcl/homebrew/issues/5844
    archs.delete! :x86_64 if Hardware.is_32_bit?
    ENV['ARCHFLAGS'] = archs.as_arch_flags

    inreplace "setup.py" do |s|
      # Tell setup where Freetype2 is on 10.5/10.6
      s.gsub! 'add_directory(include_dirs, "/sw/include/freetype2")',
              'add_directory(include_dirs, "/usr/X11/include")'

      s.gsub! 'add_directory(include_dirs, "/sw/lib/freetype2/include")',
              'add_directory(library_dirs, "/usr/X11/lib")'

      # Tell setup where our stuff is
      s.gsub! 'add_directory(library_dirs, "/sw/lib")',
              "add_directory(library_dirs, \"#{HOMEBREW_PREFIX}/lib\")"

      s.gsub! 'add_directory(include_dirs, "/sw/include")',
              "add_directory(include_dirs, \"#{HOMEBREW_PREFIX}/include\")"
    end

    system "python", "setup.py", "build_ext"
    system "python", "setup.py", "install", "--prefix=#{prefix}"
  end

  def caveats; <<-EOS.undent
    This formula installs PIL against whatever Python is first in your path.
    This Python needs to have either setuptools or distribute installed or
    the build will fail.
    EOS
  end
end
{'fraction_non_alphanumeric': 0.13109756097560976, 'fraction_numerical': 0.02621951219512195, 'mean_word_length': 3.217223650385604, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4758916', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1138, 'n_words': 267}