Files
chromebrew/packages/python3.rb
github-actions[bot] a34f619bdb glibc rebuild + breakout of crew_preload => fix installs. (#11949)
* glibc: Several improvements

Signed-off-by: SupeChicken666 <me@supechicken666.dev>

* Unset LD_PRELOAD before build

Signed-off-by: SupeChicken666 <me@supechicken666.dev>

* Adjust make to avoid segfaults.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* build changes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add built packages for linux/386 to glibc_update

* Add built packages for linux/amd64 to glibc_update

* Add built packages for linux/arm/v7 to glibc_update

* add armv7l binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Make lib64 aarch64 changes clearer.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust crew_profile_base to remove LD_LIBRARY_PATH

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust LD_LIBRARY_PATH setting again.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Handle arm multiarch.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust installer LD_LIBRARY_PATH

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove core.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update install.sh to working version.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add crew_preload package.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update preload logic...

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update hashes, add crew_preload to CREW_ESSENTIAL_PACKAGES.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove preload install sections from install.sh now that there is a separate crew_preload package.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add build instructions reference to crew_preload package.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Bring over more from the old install.sh

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Fix install on older systems.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Let CREW_ESSENTIAL_PACKAGES work on older syatems.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Move down setting of repo variables to after initial system checks exit.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Use right ldconfig.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove sudo from ldconfig call.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust locale generation.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* cleanup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add condition for crew_preload.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove duplicate hashes.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Handle some install errors.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update ncurses, readline, bash

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add update of sudo_rs

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* ruby updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* llvm => 20.1.6

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rust rebuilds to work on older container glibcs...

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Remove instance variable.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add libxcrypt to core.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Use our versions of core apps where possible, since they will likely be newer than system binaries.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Universalize fixup to work with pre_glibc_standalone branch.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rename function to better describe what it does.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rebuild filecmd and update edit.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* package updates/rebuilds

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updates and rebuilds

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update unit tests.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* gettext rebuild

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add upx and patchelf to essential packages, to avoid unit test failure.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updates & rebuilds

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update install.sh

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Install adjustment.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Install adjustment.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Break out curl dependencies in install.sh

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust install.sh for arm.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Handle remove during upgrade of special packages.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust to notice empty CREW_ESSENTIAL_PACKAGES during remove.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add libxcrypt to CREW_ESSENTIAL_PACKAGES

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust CREW_STANDALONE_UPGRADE_ORDER

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Lint ruby package as per new rubocop.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Simplify getrealdeps.rb

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Ruby rebuild

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add usage of docker tmpfs to workflows.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update python3

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild ruby

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild zlib

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* install testing

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* curl rebuild with older glibc

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* cleanup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust packages to reduce subshells during install.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Handle ELOOP exception.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add gcc15 rebuild.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rebuild binutils without gcc version.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update cmake

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add date stamp to installer.sh

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update libxml2

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* shared_mime_info rebuild

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Many updates rebuilt on a lower glibc

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* sync up from pre_glibc_standalone

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Merge pre_glibc_standalone and master versions of glibc.rb.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Sync back deprecated glibc packages from pre_glibc_standalone.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint packages/rust.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Add versioning to installer error message.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* perl => 5.40.2

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add more variable setting to install.sh

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Reverse logic in glibc.rb

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust curl_wrapper logic in install.sh

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Allow glibc package to pass rubocop.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust installer.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Gate new glibc behind CREW_PRE_GLIBC_STANDALONE env variable.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update lib/const.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update mold

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust installer.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* debug

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild uchardet

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Python Tweaks.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Python Tweaks

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Arm install adjustment

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* xzutils rebuild

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust installer to detect i686 in container.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add message to source bashrc to end of install.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Fix Updater workflow

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rebuild lz4, adjust meson buildsystem to handle alternate location for meson files.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rebuild zlib

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild xzutils

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild libyaml

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rebuilds of acl and attr for i686

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update automake and add no_filefix to autotools buildsystem.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Rebuild acl, attr, and revert from gettext 0.25, which is broken when using autopoint on x86_64 and armv7l.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust core for i686

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjustments for i686 installs.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add ruby_prism to ruby_rubocop_ast package.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust messages

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update compatibility of uutils_coreutils.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust install for both M136 hatch and M136 strongbad.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Use Concurrent Ruby for upx and patchelf.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Switch installer to using static zstd.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Update packages/zstd_static.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Make final crew update in install more robust.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* install adjustments.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* lint

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: SupeChicken666 <me@supechicken666.dev>
Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: SupeChicken666 <me@supechicken666.dev>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: satmandu <satmandu@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ed Reel <edreel@gmail.com>
2025-06-11 17:30:55 +00:00

138 lines
5.8 KiB
Ruby

require 'package'
class Python3 < Package
description 'Python is a programming language that lets you work quickly and integrate systems more effectively.'
homepage 'https://www.python.org/'
version '3.13.4'
license 'PSF-2.0'
compatibility 'all'
source_url "https://www.python.org/ftp/python/#{version}/Python-#{version}.tar.xz"
source_sha256 '27b15a797562a2971dce3ffe31bb216042ce0b995b39d768cf15f784cc757365'
binary_compression 'tar.zst'
binary_sha256({
aarch64: '12c063c28dc1960443ae409eaec5b774cd36f7c1f701439e248851d78fc1e06a',
armv7l: '12c063c28dc1960443ae409eaec5b774cd36f7c1f701439e248851d78fc1e06a',
i686: 'bbb963a35648e47b14f2b489ba2273403d2f8ee905287a68d8fad3835c13a86f',
x86_64: 'ecf3bab1344d5b582d7dd140ec9aa967ca540a8194608de4a7258e0307c9193d'
})
depends_on 'autoconf_archive' => :build
depends_on 'bzip2' # R
depends_on 'expat' # R
depends_on 'gcc_lib' # R
depends_on 'gdbm' # R
depends_on 'glibc' # R
depends_on 'krb5' => :build
depends_on 'libdb' # R
depends_on 'libffi' # R
depends_on 'mpdecimal' # R
depends_on 'ncurses' # R
depends_on 'openssl' # R
depends_on 'readline' # R
depends_on 'sqlite' # R
depends_on 'tcl' => :build unless ARCH == 'i686' # Needed for tkinter support
depends_on 'tk' => :build unless ARCH == 'i686' # Needed for tkinter support
depends_on 'util_linux' # R
depends_on 'xzutils' # R
depends_on 'zlib' # R
depends_on 'zoneinfo' # L
no_env_options
conflicts_ok
def self.patch
# Skip tests which rely on not having an underlying zfs filesystem.
# https://github.com/python/cpython/issues/125117
# See https://github.com/python/cpython/issues/81765
system "sed -i '/test_sqlite3/d' Lib/test/libregrtest/pgo.py" unless %w[aarch64 armv7l].include?(ARCH)
# Work around issue with sqlite3 3.49.x. See https://github.com/python/cpython/issues/129870
# downloader 'https://github.com/python/cpython/commit/d26c2fe7a2833606b3fb8d9789149d8696978d86.diff', '4483a8b381254db3627889e7914bd167d8a7bbf7521217e6202103b58d3e5f33'
# system 'patch -Np1 -i d26c2fe7a2833606b3fb8d9789149d8696978d86.diff'
end
def self.preinstall
@device = JSON.load_file("#{CREW_CONFIG_PATH}/device.json", symbolize_names: true)
@replaces = %w[py3_pip py3_setuptools]
@replaces_installed = []
@replaces.each do |package|
@replaces_installed.push(package) if @device[:installed_packages].any? { |elem| elem[:name] == package }
end
return if @replaces_installed.empty?
puts "Removing superseded package(s): #{@replaces_installed.join(' ')}...".orange
system "crew remove #{@replaces_installed.join(' ')}", exception: false
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
# 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.
return if Dir.exist?('builddir')
FileUtils.mkdir_p 'builddir'
Dir.chdir 'builddir' do
system "../configure #{CREW_CONFIGURE_OPTIONS} \
--with-lto \
--with-computed-gotos \
--enable-loadable-sqlite-extensions \
--with-ensurepip \
--enable-optimizations \
--with-platlibdir='lib#{CREW_LIB_SUFFIX}' \
--with-system-expat \
--with-system-libmpdec \
--with-tzpath=#{CREW_PREFIX}/share/zoneinfo \
--with-libc= \
--enable-shared"
system "TMPDIR=/tmp MAKEFLAGS=-j#{CREW_NPROC} make"
File.write 'python_config_env', <<~PYTHON_CONFIG_EOF
# Force use of python3 over python2.7 in packages which check the variable to set the python used.
PYTHON=python3
PYTHON_CONFIG_EOF
end
end
def self.install
Dir.chdir 'builddir' do
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
# There is a Python ABI break in 3.11.5 coming from 3.11.4, see https://github.com/python/cpython/issues/108525
system "LD_LIBRARY_PATH=#{CREW_DEST_LIB_PREFIX}:#{CREW_LIB_PREFIX} #{CREW_DEST_PREFIX}/bin/python3 -m ensurepip --upgrade --default-pip"
system "sed -i 's,#{CREW_DEST_PREFIX}/bin/python3,#{CREW_PREFIX}/bin/python3,g' #{CREW_DEST_PREFIX}/bin/pip3"
end
# Make python3 the default python
FileUtils.ln_sf 'python3', "#{CREW_DEST_PREFIX}/bin/python"
FileUtils.ln_sf 'pip3', "#{CREW_DEST_PREFIX}/bin/pip"
FileUtils.install 'builddir/python_config_env', "#{CREW_DEST_PREFIX}/etc/env.d/python", mode: 0o644
end
def self.postinstall
# First force pip upgrade to make sure we are past the problematic pip 23.2.1
# See https://github.com/pypa/pip/issues/12357 and https://github.com/pypa/pip/issues/12428
# system 'PIP_DISABLE_PIP_VERSION_CHECK=1 python -m pip install --upgrade --force-reinstall pip'
# Pip is installed inside Python 3. The following steps ensure that
# pip can properly build other packages from buildsystems/pip.
# @required_pip_modules = %w[build installer setuptools wheel pyproject_hooks]
# @pip_list = `pip list --exclude pip`
# @required_pip_modules.each do |pip_pkg|
# unless @pip_list.include?(pip_pkg)
# puts "Installing #{pip_pkg} using pip..."
# system "MAKEFLAGS=-j#{CREW_NPROC} pip install #{pip_pkg}"
# end
# end
puts 'Updating pip packages...'.lightblue
system 'pip list --outdated --format=json | python -c "import json, sys; print(\'\n\'.join([x[\'name\'] for x in json.load(sys.stdin)]))" | xargs -rn1 pip install -U', exception: false
ExitMessage.add "Please install tcl and tk with 'crew install tcl tk' if tkinter is needed.".lightblue unless ARCH == 'i686'
end
end