Commit a0712e98 authored by Cassandra Watergate's avatar Cassandra Watergate Committed by GitHub

Separate pip from python3, add pip for python2 (#5692)

* Rearrange python2 and 3, seperate pip

* rename python27 => python2

* merge master into pip

* touch up

* make old setuptools package fake

* lib/const.rb: bump version

* Fix py2_setuptools

* Add runtime dependencies to python2

* reorder depends

* python2 minor change

* packages/setuptools.rb: Fix ugly version

* Add binaries
Co-authored-by: default avatarsatmandu <satadru@umich.edu>
Co-authored-by: default avatarsatmandu <satadru@gmail.com>
parent 66d451b3
......@@ -94,3 +94,7 @@ CREW_MESON_FNO_LTO_OPTIONS = "-Dprefix=#{CREW_PREFIX} -Dlibdir=#{CREW_LIB_PREFIX
CREW_CMAKE_OPTIONS = "-DCMAKE_INSTALL_PREFIX=#{CREW_PREFIX} -DCMAKE_LIBRARY_PATH=#{CREW_LIB_PREFIX} -DCMAKE_C_FLAGS=#{CREW_COMMON_FLAGS} -DCMAKE_CXX_FLAGS=#{CREW_COMMON_FLAGS} -DCMAKE_BUILD_TYPE=MinSizeRel"
CREW_LIB_SUFFIX = if ARCH == 'x86_64' then '64' else '' end
CREW_CMAKE_LIBSUFFIX_OPTIONS = "-DCMAKE_INSTALL_PREFIX=#{CREW_PREFIX} -DCMAKE_LIBRARY_PATH=#{CREW_LIB_PREFIX} -DLIB_SUFFIX=#{CREW_LIB_SUFFIX} -DCMAKE_C_FLAGS=#{CREW_COMMON_FLAGS} -DCMAKE_CXX_FLAGS=#{CREW_COMMON_FLAGS} -DCMAKE_BUILD_TYPE=MinSizeRel"
PY3_SETUP_BUILD_OPTIONS = "--executable=#{CREW_PREFIX}/bin/python3"
PY2_SETUP_BUILD_OPTIONS = "--executable=#{CREW_PREFIX}/bin/python2"
PY_SETUP_INSTALL_OPTIONS = "--root=#{CREW_DEST_DIR} --prefix=#{CREW_PREFIX} -O2 --compile --single-version-externally-managed"
......@@ -97,7 +97,7 @@ class Buildessential < Package
#depends_on 'composer'
# Python
depends_on 'python27'
depends_on 'python2'
depends_on 'python3'
# Qt
......
......@@ -22,7 +22,7 @@ class Charm < Package
x86_64: '9e826bf34b0c9d7fd6ccb712f57b40e29850c18ffe4d03f39215f66044a9b616',
})
depends_on 'python27' unless File.exists? "#{CREW_PREFIX}/bin/python"
depends_on 'python2' unless File.exists? "#{CREW_PREFIX}/bin/python"
def self.install
system "python setup.py install --root #{CREW_DEST_DIR} --prefix #{CREW_PREFIX}"
......
......@@ -22,7 +22,7 @@ class Doxygen < Package
x86_64: 'ff5909d7d941b2a9e29ffc2c1d54613f65c57ff5ac4bae186264f63614ee6be3',
})
depends_on 'python27' => :build
depends_on 'python2' => :build
def self.build
Dir.mkdir 'build'
......
......@@ -24,7 +24,7 @@ class Dropbox < Package
x86_64: 'c2c699372e4646ce5ed542fa189c08dc44dea1ae312f7401f1f385279e1b2ded',
})
depends_on 'python27' unless File.exists? "#{CREW_PREFIX}/bin/python"
depends_on 'python2' unless File.exists? "#{CREW_PREFIX}/bin/python"
depends_on 'libxslt'
def self.build
......
......@@ -27,7 +27,7 @@ class Dtrx < Package
depends_on 'cabextract'
depends_on 'cpio'
depends_on 'lha'
depends_on 'python27'
depends_on 'python2'
depends_on 'unrar'
depends_on 'unshield'
depends_on 'unzip'
......
......@@ -22,7 +22,7 @@ class Duplicity < Package
x86_64: 'e122233caf601a05b85b1816ae690be8c1d6e82a83953351c8ecd0ca6046706e',
})
depends_on 'python27' unless File.exists? "#{CREW_PREFIX}/bin/python"
depends_on 'python2' unless File.exists? "#{CREW_PREFIX}/bin/python"
depends_on 'librsync'
depends_on 'gnupg'
depends_on 'openssh'
......
......@@ -24,7 +24,7 @@ class Ecasound < Package
depends_on 'libaudiofile'
depends_on 'libsndfile'
depends_on 'python27'
depends_on 'python2'
def self.patch
# Fix ./configure: line 8777: /usr/bin/file: No such file or directory
......
......@@ -22,7 +22,7 @@ class Epydoc < Package
x86_64: '5978478fb0eadb8a0a48b76b3c96bf0baa6b6c8d31ecd97c121a4cbaeb0941dd',
})
depends_on 'python27'
depends_on 'python2'
def self.install
system "python setup.py install --root=#{CREW_DEST_DIR} --prefix=#{CREW_PREFIX}"
......
......@@ -26,7 +26,7 @@ class Gcc10 < Package
depends_on 'mawk' => :build
depends_on 'dejagnu' => :build # for test
depends_on 'icu4c' => :build
depends_on 'python27' => :build
depends_on 'python2' => :build
depends_on 'python3' => :build
depends_on 'ccache' => :build
......
......@@ -26,7 +26,7 @@ class Gcc7 < Package
depends_on 'mawk' => :build
depends_on 'dejagnu' => :build # for test
depends_on 'icu4c' => :build
depends_on 'python27' => :build
depends_on 'python2' => :build
depends_on 'python3' => :build
depends_on 'binutils'
......
......@@ -26,7 +26,7 @@ class Gcc8 < Package
depends_on 'mawk' => :build
depends_on 'dejagnu' => :build # for test
depends_on 'icu4c' => :build
depends_on 'python27' => :build
depends_on 'python2' => :build
depends_on 'python3' => :build
depends_on 'binutils'
......
......@@ -22,7 +22,7 @@ class Gn < Package
x86_64: '385d47846ff117275793dc43d9ef004d4aa1075b29af3d9283f289cfc757d59f',
})
depends_on 'python27' => :build
depends_on 'python2' => :build
depends_on 'meson' => :build
def self.build
......
......@@ -22,7 +22,7 @@ class Gyp < Package
x86_64: 'a6ad933e8dc00f2fc5baff2f5bf523040a7a427dbb5f4e59dd7cfc2e48c8388c',
})
depends_on 'python27' unless File.exists? "#{CREW_PREFIX}/bin/python"
depends_on 'python2' unless File.exists? "#{CREW_PREFIX}/bin/python"
def self.install
system "python setup.py install --prefix #{CREW_PREFIX} --root #{CREW_DEST_DIR}"
......
......@@ -36,7 +36,7 @@ class Imagemagick6 < Package
depends_on 'openexr'
depends_on 'openjpeg'
depends_on 'pango'
depends_on 'python27'
depends_on 'python2'
depends_on 'zstd'
depends_on 'sommelier'
......
......@@ -22,7 +22,7 @@ class Lapack < Package
x86_64: '45aec7ef9a9c37e098be7fd80b88c580bef29181b398e6e4c8d15cee9ddf7456',
})
depends_on 'python27'
depends_on 'python2'
def self.build
Dir.mkdir 'build'
......
......@@ -22,7 +22,7 @@ class Percona_boost < Package
x86_64: '4cfcf14440dae594c3ad0c8fa3086f08c0e90787785d82e1b54454bcf0941ed9',
})
depends_on 'python27' unless File.exists? "#{CREW_PREFIX}/bin/python"
depends_on 'python2' unless File.exists? "#{CREW_PREFIX}/bin/python"
def self.build
system './bootstrap.sh'
......
require 'package'
class Py2_pip < Package
description 'Pip is the python package manager from the Python Packaging Authority.'
homepage 'https://pip.pypa.io/'
@_ver = '20.3.4'
version @_ver
license 'MIT'
compatibility 'all'
source_url 'https://github.com/pypa/pip.git'
git_hashtag @_ver
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_pip/20.3.4_armv7l/py2_pip-20.3.4-chromeos-armv7l.tar.xzz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_pip/20.3.4_armv7l/py2_pip-20.3.4-chromeos-armv7l.tar.xzz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_pip/20.3.4_i686/py2_pip-20.3.4-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_pip/20.3.4_x86_64/py2_pip-20.3.4-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: '62d2b9126951628f2fd54bdfa3edcd67e6da21a60a42671e3523ed9ed87c734b',
armv7l: '62d2b9126951628f2fd54bdfa3edcd67e6da21a60a42671e3523ed9ed87c734b',
i686: '9dc11923ee4148311cb82442524700716044addacae4794b6fb2e31b56667d47',
x86_64: 'e7ac1be2c32e23267f7df461b64716976e928308b61bd1991d51ce0a1166a294'
})
depends_on 'python2'
depends_on 'py2_setuptools'
depends_on 'py2_wheel'
def self.build
system "python2 setup.py build #{PY2_SETUP_BUILD_OPTIONS}"
end
def self.install
system "python2 setup.py install #{PY_SETUP_INSTALL_OPTIONS}"
# Don't make pip2 the default pip
FileUtils.rm "#{CREW_DEST_PREFIX}/bin/pip" if File.exist? "#{CREW_DEST_PREFIX}/bin/pip"
end
end
require 'package'
class Py2_setuptools < Package
description 'Setuptools is the python build system from the Python Packaging Authority.'
homepage 'https://setuptools.readthedocs.io/'
# Newest python2 supported version as of 2021-04-24
@_ver = '44.1.1'
version @_ver
license 'MIT'
compatibility 'all'
source_url "https://files.pythonhosted.org/packages/b2/40/4e00501c204b457f10fe410da0c97537214b2265247bc9a5bc6edd55b9e4/setuptools-#{@_ver}.zip"
source_sha256 'c67aa55db532a0dadc4d2e20ba9961cbd3ccc84d544e9029699822542b5a476b'
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_setuptools/44.1.1_armv7l/py2_setuptools-44.1.1-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_setuptools/44.1.1_armv7l/py2_setuptools-44.1.1-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_setuptools/44.1.1_i686/py2_setuptools-44.1.1-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_setuptools/44.1.1_x86_64/py2_setuptools-44.1.1-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: '668bdf06acc1e02d9a2ef79e16815d14930ecf3a0cacbc449f8b4581be6453ca',
armv7l: '668bdf06acc1e02d9a2ef79e16815d14930ecf3a0cacbc449f8b4581be6453ca',
i686: '1e1dc11e756309055e2086adac78f35a7979d8458cc8c3621aa1babd2a0cf37f',
x86_64: '79faf57d69a900e81d35ce3517f4c5e7997f45925bbf31fc3bcd388084cc7e18'
})
depends_on 'python2'
def self.build
system "python2 setup.py build #{PY2_SETUP_BUILD_OPTIONS}"
end
def self.install
system "python2 setup.py install #{PY_SETUP_INSTALL_OPTIONS}"
end
end
require 'package'
class Py2_wheel < Package
description 'Wheel is the binary package format for python.'
homepage 'https://wheel.readthedocs.io/'
@_ver = '0.36.2'
version @_ver
license 'MIT'
compatibility 'all'
source_url 'https://github.com/pypa/wheel.git'
git_hashtag @_ver
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_wheel/0.36.2_armv7l/py2_wheel-0.36.2-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_wheel/0.36.2_armv7l/py2_wheel-0.36.2-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_wheel/0.36.2_i686/py2_wheel-0.36.2-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py2_wheel/0.36.2_x86_64/py2_wheel-0.36.2-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: '0d3fefe56883596140bec955b6098f4f486a29f74167e914949c560653ac12a3',
armv7l: '0d3fefe56883596140bec955b6098f4f486a29f74167e914949c560653ac12a3',
i686: '43f51e7a624afa1a0bdf9f023d1079b3627ae3cbd792ce2bde9b3c526dd2c301',
x86_64: '214daa1cb230f9fb1ba3f0ae6e4005813c9a01749ee7b2beef4aa34fec790ff1'
})
depends_on 'python2'
depends_on 'py2_setuptools' => :build
def self.build
system "python2 setup.py build #{PY2_SETUP_BUILD_OPTIONS}"
end
def self.install
system "python2 setup.py install #{PY_SETUP_INSTALL_OPTIONS}"
# Remove conflicting executables
FileUtils.rm "#{CREW_DEST_PREFIX}/bin/wheel"
end
end
require 'package'
class Py3_pip < Package
description 'Pip is the python package manager from the Python Packaging Authority.'
homepage 'https://pip.pypa.io/'
@_ver = '21.0.1'
version @_ver
license 'MIT'
compatibility 'all'
source_url 'https://github.com/pypa/pip.git'
git_hashtag @_ver
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_pip/21.0.1_armv7l/py3_pip-21.0.1-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_pip/21.0.1_armv7l/py3_pip-21.0.1-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_pip/21.0.1_i686/py3_pip-21.0.1-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_pip/21.0.1_x86_64/py3_pip-21.0.1-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: 'ce0f563a1f9a8fdd16c9d44263d42206742d8fbbc705f5a2a11973c234a96ac0',
armv7l: 'ce0f563a1f9a8fdd16c9d44263d42206742d8fbbc705f5a2a11973c234a96ac0',
i686: 'd782d6d8cf6a857ee31e07a304dd4d07223f30f3e2812e29deb4d1a7962cad51',
x86_64: '729a9958cae998936dc3ca300feb7c10eb8d56f74b524913cc84cb1cf6bbe553'
})
depends_on 'py3_setuptools'
depends_on 'py3_wheel'
def self.build
system "python3 setup.py build #{PY3_SETUP_BUILD_OPTIONS}"
end
def self.install
system "python3 setup.py install #{PY_SETUP_INSTALL_OPTIONS}"
# Make pip3 the default pip
# FileUtils.ln_s "pip3", "#{CREW_DEST_PREFIX}/bin/pip" # This automatically happens
end
end
require 'package'
class Py3_setuptools < Package
description 'Setuptools is the python build system from the Python Packaging Authority.'
homepage 'https://setuptools.readthedocs.io/'
@_ver = '56.0.0'
version @_ver
license 'MIT'
compatibility 'all'
source_url "https://files.pythonhosted.org/packages/f6/e9/19af16328705915233299f6f1f02db95899fb00c75ac9da4757aa1e5d1de/setuptools-#{@_ver}.tar.gz"
source_sha256 '08a1c0f99455307c48690f00d5c2ac2c1ccfab04df00454fef854ec145b81302'
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_setuptools/56.0.0_armv7l/py3_setuptools-56.0.0-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_setuptools/56.0.0_armv7l/py3_setuptools-56.0.0-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_setuptools/56.0.0_i686/py3_setuptools-56.0.0-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_setuptools/56.0.0_x86_64/py3_setuptools-56.0.0-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: 'cde5ae8e09778d2572b52c27ea041e2d8ab6ba5a820e5761cf079e774e8e4711',
armv7l: 'cde5ae8e09778d2572b52c27ea041e2d8ab6ba5a820e5761cf079e774e8e4711',
i686: '8688b51233a4008fc8dc3a19f4f38c6b687e3fbb118ff9aaa0cc092701ce538e',
x86_64: '2187bee0484f7486ef5f18fbc93c7d8235b6d3985c58eadd6aabf59341720096'
})
def self.build
system "python3 setup.py build #{PY3_SETUP_BUILD_OPTIONS}"
end
def self.install
system "python3 setup.py install #{PY_SETUP_INSTALL_OPTIONS}"
end
end
require 'package'
class Py3_wheel < Package
description 'Wheel is the binary package format for python.'
homepage 'https://wheel.readthedocs.io/'
@_ver = '0.36.2'
version @_ver
license 'MIT'
compatibility 'all'
source_url 'https://github.com/pypa/wheel.git'
git_hashtag @_ver
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_wheel/0.36.2_armv7l/py3_wheel-0.36.2-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_wheel/0.36.2_armv7l/py3_wheel-0.36.2-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_wheel/0.36.2_i686/py3_wheel-0.36.2-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/py3_wheel/0.36.2_x86_64/py3_wheel-0.36.2-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: '06b0135ace731c342706f307a5c41f52f73a59957be395f9fdf25af89000f77a',
armv7l: '06b0135ace731c342706f307a5c41f52f73a59957be395f9fdf25af89000f77a',
i686: '602342af626c62f894bbc133b9cceed7bd8caffb0f9eb655899639714bb3ddc3',
x86_64: '90da6888403ebdddf46183bc8e25129574e629d69effa868b074e8a8ef84c2ae'
})
depends_on 'py3_setuptools' => :build
def self.build
system "python3 setup.py build #{PY3_SETUP_BUILD_OPTIONS}"
end
def self.install
system "python3 setup.py install #{PY_SETUP_INSTALL_OPTIONS}"
end
end
......@@ -24,7 +24,7 @@ class Pycairo < Package
depends_on 'cairo'
depends_on 'python3'
depends_on 'python27'
depends_on 'python2'
depends_on 'libxxf86vm'
depends_on 'libxrender'
......
require 'package'
class Python2 < 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.18'
license 'custom'
compatibility 'all'
source_url 'https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz'
source_sha256 'b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43'
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python2/2.7.18_armv7l/python2-2.7.18-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python2/2.7.18_armv7l/python2-2.7.18-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python2/2.7.18_i686/python2-2.7.18-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python2/2.7.18_x86_64/python2-2.7.18-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: '8d50eb96aac259934a8a057280244ca4a7f312cee4a331694890ea7ac4d757c7',
armv7l: '8d50eb96aac259934a8a057280244ca4a7f312cee4a331694890ea7ac4d757c7',
i686: 'bb74dd4cc2f10a30b861b41ccbc14e7251e4838d288a033e72ce502376247bc8',
x86_64: 'b733a3aa7b34b2737cc1cc433e3fe2ddb99c014837268fde3b5697f79da2510c'
})
depends_on 'bz2' # R
depends_on 'expat' # R
depends_on 'glibc' # R
depends_on 'libdb' # R
depends_on 'libffi' # R
depends_on 'ncurses' # R
depends_on 'openssl' # R
depends_on 'readline' # R
depends_on 'sqlite' # R
depends_on 'zlibpkg' # R
# def self.patch
# system "sed -i -e 's:#{CREW_LIB_PREFIX}:$(get_libdir):g' \
# Lib/distutils/command/install.py \
# Lib/distutils/sysconfig.py \
# Lib/site.py \
# Lib/sysconfig.py \
# Lib/test/test_site.py \
# Makefile.pre.in \
# Modules/Setup.dist \
# Modules/getpath.c \
# setup.py"
# end
def self.prebuild
# Ensure that internal copies of expat, libffi and zlib aren't used
FileUtils.rm_rf 'Modules/expat'
FileUtils.rm_rf Dir.glob('Modules/_ctypes/libffi*')
FileUtils.rm_rf 'Modules/zlib'
end
def self.build
@cppflags = "-I#{CREW_PREFIX}/include/ncursesw"
# python requires /usr/local/lib, so leave as is but specify -rpath
@ldflags = "-Wl,-rpath,-L#{CREW_LIB_PREFIX}"
# CREW_ENV_OPTIONS don't work so we have to make our own
@py_common_flags = "'-Os -pipe -fuse-ld=gold'"
# 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 'autoreconf -fiv'
Dir.mkdir 'builddir'
Dir.chdir 'builddir' do
system "env CFLAGS=#{@py_common_flags} CXXFLAGS=#{@py_common_flags} \
CC='#{CREW_TGT}-gcc' \
CXX='#{CREW_TGT}-g++' \
CPPFLAGS='#{@cppflags}' \
LDFLAGS='#{@ldflags}' \
../configure --prefix=#{CREW_PREFIX} --build=#{CREW_BUILD} --host=#{CREW_TGT} --target=#{CREW_TGT} \
--with-fpectl \
--enable-ipv6 \
--with-threads \
--enable-unicode=ucs4 \
--with-computed-gotos \
--with-loadable-sqlite-extensions \
--without-ensurepip \
--enable-optimizations \
--with-lto \
--with-system-ffi \
--with-system-expat \
--enable-shared"
system 'make'
end
end
def self.check
# system "http_proxy= https_proxy= ftp_proxy= make test"
end
def self.install
Dir.chdir 'builddir' do
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
end
# remove static libraries
# system "find #{CREW_DEST_PREFIX} -name 'libpython*.a' -print | xargs -r rm"
# move dynamic libraries to their correct places, so the dynamic loader can find them
FileUtils.mkdir CREW_DEST_LIB_PREFIX unless Dir.exist? CREW_DEST_LIB_PREFIX
FileUtils.mv "#{CREW_DEST_PREFIX}/lib/libpython2.7.so", CREW_DEST_LIB_PREFIX unless CREW_LIB_SUFFIX.empty?
FileUtils.mv "#{CREW_DEST_PREFIX}/lib/libpython2.7.so.1.0", CREW_DEST_LIB_PREFIX unless CREW_LIB_SUFFIX.empty?
# Remove python executable, python3 is default
FileUtils.rm "#{CREW_DEST_PREFIX}/bin/python"
# Remove other comflicting executables
FileUtils.rm "#{CREW_DEST_PREFIX}/bin/2to3"
end
end
require 'package'
class Python27 < Package
description 'Python is a programming language that lets you work quickly and integrate systems more effectively.'
description 'A compatibility package for python2.'
homepage 'https://www.python.org/'
version '2.7.18'
license 'custom'
version '2.7.18-1'
compatibility 'all'
source_url 'https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz'
source_sha256 'b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43'
binary_url ({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python27/2.7.18_armv7l/python27-2.7.18-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python27/2.7.18_armv7l/python27-2.7.18-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python27/2.7.18_i686/python27-2.7.18-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python27/2.7.18_x86_64/python27-2.7.18-chromeos-x86_64.tar.xz',
})
binary_sha256 ({
aarch64: 'c3f95252f2a2ebcf7659d1d38ef25752aa7cb1495c90d2baf69f1e91d51ad472',
armv7l: 'c3f95252f2a2ebcf7659d1d38ef25752aa7cb1495c90d2baf69f1e91d51ad472',
i686: '5219b6078f2ae15b32de827215b707e2efc166dbd7b9304772eb0716467b9ad9',
x86_64: '6572621e821f572eb9f60b604c5f578339e6dca1f618601c61970095cc06b675',
})
is_fake
depends_on 'bz2' => :build
depends_on 'sqlite' => :build
depends_on 'python2'
# 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.
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
# SSL errors in test may require a 2021 version of libressl.
system './configure', "CPPFLAGS=-I#{CREW_PREFIX}/include/ncurses -I#{CREW_PREFIX}/include/ncursesw",
"LDFLAGS=-Wl,-rpath,-L#{CREW_LIB_PREFIX}",
'--with-ensurepip=install',
'--enable-optimizations',
'--enable-shared'
system 'make'
end
def self.check
#system "http_proxy= https_proxy= ftp_proxy= make test"
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
FileUtils.mkdir_p CREW_DEST_LIB_PREFIX
system "cd #{CREW_DEST_LIB_PREFIX} && ln -s ../lib/libpython*.so* ."
end
end
def self.postinstall
#puts
#puts "Upgrading pip...".lightblue
#system 'pip2 install --upgrade pip'
#puts
FileUtils.ln_sf "#{CREW_PREFIX}/bin/python3", "#{CREW_PREFIX}/bin/python" \
if File.exist? "#{CREW_PREFIX}/bin/python3"
FileUtils.ln_sf "#{CREW_PREFIX}/bin/pip3", "#{CREW_PREFIX}/bin/pip" \
if File.exist? "#{CREW_PREFIX}/bin/pip3"
end
end
......@@ -4,73 +4,95 @@ class Python3 < Package
description 'Python is a programming language that lets you work quickly and integrate systems more effectively.'
homepage 'https://www.python.org/'
@_ver = '3.9.4'
version @_ver
version "#{@_ver}-1"
license 'PSF-2.0'
compatibility 'all'
source_url "https://www.python.org/ftp/python/#{@_ver}/Python-#{@_ver}.tar.xz"
source_sha256 '4b0e6644a76f8df864ae24ac500a51bbf68bd098f6a173e27d3b61cdca9aa134'
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4_armv7l/python3-3.9.4-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4_armv7l/python3-3.9.4-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4_i686/python3-3.9.4-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4_x86_64/python3-3.9.4-chromeos-x86_64.tar.xz'
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4-1_armv7l/python3-3.9.4-1-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4-1_armv7l/python3-3.9.4-1-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4-1_i686/python3-3.9.4-1-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/python3/3.9.4-1_x86_64/python3-3.9.4-1-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: 'fe4fde3f9738ac76096dfdc13ff6931543e2f612035421e294f87d2bfc09773c',
armv7l: 'fe4fde3f9738ac76096dfdc13ff6931543e2f612035421e294f87d2bfc09773c',
i686: 'a9e7b61911679cda55f65cf5ca29076ee2ac4540c8dd7bda5322df66d4d6e4bd',
x86_64: 'cd3a63250e76cd887a620df69f37d349d4cea0d39e3d8bc2ceef9400a40befbb'
aarch64: '17acda432cbbdcbcdf46a8fda536c160d460833d2e8d4e33f41669cd392d1ec3',
armv7l: '17acda432cbbdcbcdf46a8fda536c160d460833d2e8d4e33f41669cd392d1ec3',
i686: '2c47ce9690665232473be9582234f73f5bebdd616db1d1e0c9edf6a56880b59f',
x86_64: '23ade3fd6991f88f0207e8ed64def6c2a8823b5b51aa22358b08daf328a4caca'
})
depends_on 'bz2'
depends_on 'gdbm'
depends_on 'glibc'
depends_on 'krb5' => :build
depends_on 'libdb'
depends_on 'libffi'
depends_on 'libtirpc' => :build
depends_on 'ncurses'
depends_on 'openssl'
depends_on 'readline'
depends_on 'sqlite'
depends_on 'bz2' # R
depends_on 'expat' # R
depends_on 'gdbm' # R
depends_on 'glibc' # R
depends_on 'libdb' # R
depends_on 'libffi' # R
depends_on 'ncurses' # R
depends_on 'openssl' # R
depends_on 'readline' # R
depends_on 'sqlite' # R
depends_on 'xzutils' # R
depends_on 'zlibpkg' # R
# depends_on 'tcl' # Needed for tkinter support
# depends_on 'tk' # Needed for tkinter support
depends_on 'xzutils'
depends_on 'zlibpkg'
def self.preinstall
# Fix ImportError: cannot import name 'PackageFinder'.
# See https://stackoverflow.com/questions/59887436/importerror-cannot-import-name-packagefinder.
FileUtils.rm_rf Dir.glob("#{CREW_PREFIX}/lib/python3.9/site-packages/pip*")
def self.patch
system "sed -i -e 's:#{CREW_LIB_PREFIX}:\$(get_libdir):g' \
Lib/distutils/command/install.py \
Lib/distutils/sysconfig.py \
Lib/site.py \
Lib/sysconfig.py \
Lib/test/test_site.py \
Makefile.pre.in \
Modules/getpath.c \
setup.py"
end
def self.build
# IMPORTANT: Do not build with python3 already installed or pip3 will not be included.
raise StandardError, 'Please remove python3 before building.' if File.exist?("#{CREW_PREFIX}/bin/python3")
def self.prebuild
# Ensure that internal copies of expat, libffi and zlib aren't used
FileUtils.rm_rf 'Modules/expat'
FileUtils.rm_rf Dir.glob('Modules/_ctypes/libffi*')
FileUtils.rm_rf 'Modules/zlib'
end
@cppflags = "-fno-semantic-interposition -I#{CREW_PREFIX}/include/ncursesw"
def self.build
@cppflags = "-I#{CREW_PREFIX}/include/ncursesw"
# python requires /usr/local/lib, so leave as is but specify -rpath
@ldflags = "-fno-semantic-interposition -Wl,-rpath,-L#{CREW_LIB_PREFIX}"
@ldflags = "-Wl,-rpath,-L#{CREW_LIB_PREFIX}"
# CREW_ENV_OPTIONS don't work so we have to make our own
@py_common_flags = "'-Os -pipe -fuse-ld=gold'"
# 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 "env CFLAGS='' \
CXXFLAGS='' \
CC='gcc -pthread' \
CPPFLAGS='#{@cppflags}' \
LDFLAGS='#{@ldflags}' \
./configure \
#{CREW_OPTIONS} \
--with-ensurepip=install \
--enable-optimizations \
--with-lto \
--with-platlibdir='lib#{CREW_LIB_SUFFIX}' \
--enable-shared"
system 'make'
system 'autoreconf -fiv'
Dir.mkdir 'builddir'
Dir.chdir 'builddir' do
system "env CFLAGS=#{@py_common_flags} CXXFLAGS=#{@py_common_flags} \
CC='#{CREW_TGT}-gcc -pthread' \
CXX='#{CREW_TGT}-g++' \
CPPFLAGS='#{@cppflags}' \
LDFLAGS='#{@ldflags} -lpthread' \
../configure #{CREW_OPTIONS} \
--with-computed-gotos \
--with-loadable-sqlite-extensions \
--without-ensurepip \
--enable-optimizations \
--with-lto \
--with-platlibdir='lib#{CREW_LIB_SUFFIX}' \
--with-system-ffi \
--with-system-expat \
--with-system-libmpdev \
--enable-shared"
system 'make'
end
end
def self.check
......@@ -99,24 +121,24 @@ class Python3 < Package
end
def self.install
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
Dir.chdir 'builddir' do
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
end
# 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
FileUtils.mkdir_p CREW_DEST_LIB_PREFIX
system "cd #{CREW_DEST_LIB_PREFIX} && ln -s ../lib/libpython*.so* ."
end
end
# Not needed as --libdir is passed to ./configure
# unless Dir.exist? CREW_DEST_LIB_PREFIX
# FileUtils.mkdir_p CREW_DEST_LIB_PREFIX
# system "cd #{CREW_DEST_LIB_PREFIX} && ln -s ../lib/libpython*.so* ."
# end
# Remove conflicting binaries
FileUtils.rm "#{CREW_DEST_PREFIX}/bin/wheel" if File.exist? "#{CREW_DEST_PREFIX}/bin/wheel"
def self.postinstall
puts
puts 'Upgrading pip...'.lightblue
system "curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && LD_LIBRARY_PATH=#{CREW_LIB_PREFIX} python3 get-pip.py -U"
puts 'Setting Python3 as default python...'.lightblue
FileUtils.ln_sf "#{CREW_PREFIX}/bin/python3", "#{CREW_PREFIX}/bin/python"
FileUtils.ln_sf "#{CREW_PREFIX}/bin/pip3", "#{CREW_PREFIX}/bin/pip"
# Make python3 the default python
FileUtils.ln_sf 'python3', "#{CREW_DEST_PREFIX}/bin/python"
end
end
# Do not use this package as a dependency for other packages.
require 'package'
class Setuptools < Package
description 'Easily download, build, install, upgrade, and uninstall Python packages'
description 'A package that installs setuptools for all python versions.'
homepage 'https://pypi.org/project/setuptools/'
version '50.3.2'
version '1.0'
license 'MIT'
compatibility 'all'
source_url 'https://github.com/pypa/setuptools/archive/v50.3.2.tar.gz'
source_sha256 '7d97c001ce9193c6d947bc584b6a19f593e1d2dd4d6c443de3b1e545875bc132'
binary_url ({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/setuptools/50.3.2_armv7l/setuptools-50.3.2-chromeos-armv7l.tar.xz',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/setuptools/50.3.2_armv7l/setuptools-50.3.2-chromeos-armv7l.tar.xz',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/setuptools/50.3.2_i686/setuptools-50.3.2-chromeos-i686.tar.xz',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/setuptools/50.3.2_x86_64/setuptools-50.3.2-chromeos-x86_64.tar.xz',
})
binary_sha256 ({
aarch64: 'bb3de709aa29d38537d1690bd3c3b75aa213f7afbe1e60e883d85dc926fc5aec',
armv7l: 'bb3de709aa29d38537d1690bd3c3b75aa213f7afbe1e60e883d85dc926fc5aec',
i686: 'bfb77f5a9fe09deefdc4cec86c8424d1f3d7d3c3e575865d0a50ed406fc4f03c',
x86_64: '2900eaa2a0cda2be9c692f673e72f95cf25a6267794b170dd0f7a1b10f362bff',
})
is_fake
depends_on 'python27'
depends_on 'python3'
depends_on 'py3_setuptools'
depends_on 'py2_setuptools'
def self.build
system 'python3 bootstrap.py'
end
def self.install
# Now let python3 pip install and overwrite pip, leaving pip2 for python27
system "python3 setup.py install --root=#{CREW_DEST_DIR} --prefix=#{CREW_PREFIX}"
# Install pip for python2 using the last supported systemtools version (<=v45) for python27.
system "pip2 install setuptools==44.1.1 --root=#{CREW_DEST_DIR} --prefix=#{CREW_PREFIX}"
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment