require 'package' class Python27 < Package description 'Python is a programming language that lets you work quickly and integrate systems more effectively.' homepage 'https://www.python.org/' version '2.7.15' source_url 'https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz' source_sha256 '22d9b1ac5b26135ad2b8c2901a9413537e08749a753356ee913c84dbd2df5574' binary_url ({ aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/python27-2.7.15-chromeos-armv7l.tar.xz', armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/python27-2.7.15-chromeos-armv7l.tar.xz', i686: 'https://dl.bintray.com/chromebrew/chromebrew/python27-2.7.15-chromeos-i686.tar.xz', x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/python27-2.7.15-chromeos-x86_64.tar.xz', }) binary_sha256 ({ aarch64: '712ea676f522e01f37ec2d9ee7fff973fa12df20b8d1822d32d07241800fe0e6', armv7l: '712ea676f522e01f37ec2d9ee7fff973fa12df20b8d1822d32d07241800fe0e6', i686: 'a0aacd3f53d38d929d278e85384a41049e402e5d42c8a6df560aa1d64d5bf684', x86_64: 'f1f81eaf334c05e6895213a78b8f56b2077b56a3ddf03daea65df403b91bd798', }) depends_on 'bz2' => :build depends_on 'sqlite' => :build def self.build # IMPORTANT: Do not build with python27 already installed or pip will not be included. # python requires #{CREW_LIB_PREFIX}, so leave as is but specify -rpath system "./configure", "CPPFLAGS=-I#{CREW_PREFIX}/include/ncurses -I#{CREW_PREFIX}/include/ncursesw", "LDFLAGS=-Wl,-rpath,-L#{CREW_LIB_PREFIX}", "--with-ensurepip=install", "--enable-shared" system 'make' end def self.install system "make", "DESTDIR=#{CREW_DEST_DIR}", "install" # remove static libraries system "find #{CREW_DEST_PREFIX} -name 'libpython*.a' -print | xargs -r rm" # create symbolic links in lib64 for other applications which use libpython unless Dir.exist? "#{CREW_DEST_LIB_PREFIX}" system "mkdir -p #{CREW_DEST_LIB_PREFIX}" system "cd #{CREW_DEST_LIB_PREFIX} && ln -s ../lib/libpython*.so* ." end end def self.check # Using /tmp breaks test_distutils, test_subprocess. # Proxy setting breaks test_httpservers, test_ssl, # test_urllib, test_urllib2, test_urllib2_localnet. # So, modifying environment variable to make pass tests. #system "TMPDIR=#{CREW_PREFIX}/tmp http_proxy= https_proxy= ftp_proxy= make test" end end