Compare commits

...

14 Commits

Author SHA1 Message Date
aparnajyothi-y
bbc60cfaec Update macos-pkg-setup-template.sh 2024-12-02 17:25:45 +05:30
aparnajyothi-y
c84ab0e4bd Update macos-pkg-setup-template.sh 2024-12-02 13:14:31 +05:30
aparnajyothi-y
4117c4fe82 Update macos-python-builder.psm1 2024-11-29 16:17:29 +05:30
aparnajyothi-y
3d18e531c2 Update macos-python-builder.psm1 2024-11-29 16:17:14 +05:30
aparnajyothi-y
c47a267fd1 Update macos-python-builder.psm1 2024-11-29 14:57:55 +05:30
aparnajyothi-y
d43da0ca8a Update macos-python-builder.psm1 2024-11-29 14:21:13 +05:30
aparnajyothi-y
c0cdd7380e Update macos-python-builder.psm1 2024-11-27 18:46:34 +05:30
aparnajyothi-y
dbeaa2df93 Update macos-python-builder.psm1 2024-11-27 18:09:16 +05:30
github-actions[bot]
771cbab387 Update versions-manifest (#321)
Co-authored-by: Service account <no-reply@microsoft.com>
2024-11-20 08:31:56 -06:00
aparnajyothi-y
7069021fff Update openssl 1.1 to 3 (#316)
* Update openssl to 3

* openssl update 3
2024-11-04 19:18:59 -06:00
priya-kinthali
d8ae6ee095 updated the latest versions and included macos-13 (#315) 2024-10-21 15:25:52 -05:00
github-actions[bot]
dd24c2e5e7 Update versions-manifest (#314)
Co-authored-by: Service account <no-reply@microsoft.com>
2024-10-16 11:26:00 -05:00
github-actions[bot]
48bcef9764 Update versions-manifest (#312)
Co-authored-by: Service account <no-reply@microsoft.com>
2024-10-08 09:52:56 -05:00
github-actions[bot]
5d096de548 Update versions-manifest (#310)
Co-authored-by: Service account <no-reply@microsoft.com>
2024-10-07 22:28:59 -05:00
6 changed files with 612 additions and 153 deletions

View File

@@ -15,7 +15,7 @@ on:
PLATFORMS: PLATFORMS:
description: 'Platforms for execution in "os" or "os_arch" format (arch is "x64" by default)' description: 'Platforms for execution in "os" or "os_arch" format (arch is "x64" by default)'
required: true required: true
default: 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-12_x64,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64' default: 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-13_x64,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64'
pull_request: pull_request:
paths-ignore: paths-ignore:
- 'versions-manifest.json' - 'versions-manifest.json'
@@ -39,7 +39,7 @@ jobs:
- name: Generate execution matrix - name: Generate execution matrix
id: generate-matrix id: generate-matrix
run: | run: |
[String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-12,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64' }}".Split(",").Trim() [String[]]$configurations = "${{ inputs.platforms || 'ubuntu-20.04,ubuntu-22.04,ubuntu-22.04_arm64,ubuntu-24.04,ubuntu-24.04_arm64,macos-13,macos-14_arm64,windows-2019_x64,windows-2019_x86,windows-2019_arm64' }}".Split(",").Trim()
$matrix = @() $matrix = @()
foreach ($configuration in $configurations) { foreach ($configuration in $configurations) {

View File

@@ -14,8 +14,8 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04] os: [macos-latest, windows-latest, ubuntu-20.04, ubuntu-22.04, macos-13]
python: [3.9.13, 3.10.11, 3.11.8] python: [3.9.13, 3.10.11, 3.11.8, 3.12.7, 3.13.0]
steps: steps:
- name: setup-python ${{ matrix.python }} - name: setup-python ${{ matrix.python }}
uses: actions/setup-python@v5 uses: actions/setup-python@v5

View File

@@ -6,18 +6,17 @@ class macOSPythonBuilder : NixPythonBuilder {
MacOS Python builder class. MacOS Python builder class.
.DESCRIPTION .DESCRIPTION
Contains methods that required to build macOS Python artifact from sources. Inherited from base NixPythonBuilder. Contains methods required to build macOS Python artifacts from sources. Inherited from base NixPythonBuilder.
While python.org provides precompiled binaries for macOS, switching to them risks breaking existing customers. While python.org provides precompiled binaries for macOS, switching to them risks breaking existing customers.
If we wanted to start using the official binaries instead of building from source, we should avoid changing previous versions If we wanted to start using the official binaries instead of building from source, we should avoid changing previous versions
so we remain backwards compatible. so we remain backwards compatible.
.PARAMETER platform .PARAMETER platform
The full name of platform for which Python should be built. The full name of the platform for which Python should be built.
.PARAMETER version .PARAMETER version
The version of Python that should be built. The version of Python that should be built.
#> #>
macOSPythonBuilder( macOSPythonBuilder(
@@ -32,12 +31,16 @@ class macOSPythonBuilder : NixPythonBuilder {
Prepare system environment by installing dependencies and required packages. Prepare system environment by installing dependencies and required packages.
#> #>
# Only for Python 3.7.17, install additional dependencies
if ($this.Version -eq "3.7.17") { if ($this.Version -eq "3.7.17") {
# We have preinstalled ncurses and readLine on the hoster runners. But we need to install bzip2 for Write-Host "Installing additional dependencies for Python 3.7.17..."
# setting up an environemnt # Install necessary dependencies for Python 3.7.17
# If we get any issues realted to ncurses or readline we can try to run this command Execute-Command -Command "brew install bzip2 zlib readline ncurses sqlite3 openssl@3"
# brew install ncurses readline
Execute-Command -Command "brew install bzip2" # Ensure the environment variables for zlib are set correctly
$zlibPrefix = (brew --prefix zlib)
$env:LDFLAGS += " -L$($zlibPrefix)/lib"
$env:CFLAGS += " -I$($zlibPrefix)/include"
} }
} }
@@ -68,13 +71,13 @@ class macOSPythonBuilder : NixPythonBuilder {
### and then add the appropriate paths for the header and library files to configure command. ### and then add the appropriate paths for the header and library files to configure command.
### Link to documentation (https://cpython-devguide.readthedocs.io/setup/#build-dependencies) ### Link to documentation (https://cpython-devguide.readthedocs.io/setup/#build-dependencies)
if ($this.Version -lt "3.7.0") { if ($this.Version -lt "3.7.0") {
$env:LDFLAGS = "-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/zlib/lib" $env:LDFLAGS = "-L/usr/local/opt/openssl@3/lib -L/usr/local/opt/zlib/lib"
$env:CFLAGS = "-I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/zlib/include" $env:CFLAGS = "-I/usr/local/opt/openssl@3/include -I/usr/local/opt/zlib/include"
} else { } else {
$configureString += " --with-openssl=/usr/local/opt/openssl@1.1" $configureString += " --with-openssl=/usr/local/opt/openssl@1.1" # For Python 3.7.x, use OpenSSL 1.1
# For Python 3.7.2 and 3.7.3 we need to provide PATH for zlib to pack it properly. Otherwise the build will fail # For Python 3.7.2, 3.7.3, and 3.7.17 we need to provide PATH for zlib to pack it properly.
# with the error: zipimport.ZipImportError: can't decompress data; zlib not available # Otherwise, the build will fail with the error: zipimport.ZipImportError: can't decompress data; zlib not available
if ($this.Version -eq "3.7.2" -or $this.Version -eq "3.7.3" -or $this.Version -eq "3.7.17") { if ($this.Version -eq "3.7.2" -or $this.Version -eq "3.7.3" -or $this.Version -eq "3.7.17") {
$env:LDFLAGS = "-L/usr/local/opt/zlib/lib" $env:LDFLAGS = "-L/usr/local/opt/zlib/lib"
$env:CFLAGS = "-I/usr/local/opt/zlib/include" $env:CFLAGS = "-I/usr/local/opt/zlib/include"
@@ -84,7 +87,9 @@ class macOSPythonBuilder : NixPythonBuilder {
$configureString += " --with-tcltk-includes='-I /usr/local/opt/tcl-tk/include' --with-tcltk-libs='-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'" $configureString += " --with-tcltk-includes='-I /usr/local/opt/tcl-tk/include' --with-tcltk-libs='-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'"
} }
# Specific for Python 3.7.17
if ($this.Version -eq "3.7.17") { if ($this.Version -eq "3.7.17") {
Write-Host "Setting environment for Python 3.7.17..."
$env:LDFLAGS += " -L$(brew --prefix bzip2)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix ncurses)/lib" $env:LDFLAGS += " -L$(brew --prefix bzip2)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix ncurses)/lib"
$env:CFLAGS += " -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(brew --prefix ncurses)/include" $env:CFLAGS += " -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(brew --prefix ncurses)/include"
} }

View File

@@ -23,25 +23,47 @@ PYTHON_TOOLCACHE_VERSION_ARCH_PATH=$PYTHON_TOOLCACHE_VERSION_PATH/$ARCH
PYTHON_FRAMEWORK_PATH="/Library/Frameworks/Python.framework/Versions/${MAJOR_VERSION}.${MINOR_VERSION}" PYTHON_FRAMEWORK_PATH="/Library/Frameworks/Python.framework/Versions/${MAJOR_VERSION}.${MINOR_VERSION}"
PYTHON_APPLICATION_PATH="/Applications/Python ${MAJOR_VERSION}.${MINOR_VERSION}" PYTHON_APPLICATION_PATH="/Applications/Python ${MAJOR_VERSION}.${MINOR_VERSION}"
echo "Check if Python hostedtoolcache folder exist..." # Check if zlib is installed
echo "Checking if zlib is installed..."
if ! brew list zlib &>/dev/null; then
echo "Installing zlib via brew..."
brew install zlib
else
echo "zlib already installed."
fi
# Only for Python 3.7.17, install additional dependencies like zlib and others
if [ "$MAJOR_VERSION" -eq 3 ] && [ "$MINOR_VERSION" -eq 7 ] && [ "$PYTHON_FULL_VERSION" == "3.7.17" ]; then
echo "Installing additional dependencies for Python 3.7.17..."
brew install bzip2 readline ncurses sqlite3 openssl@3
# Ensure the environment variables for zlib are set correctly
ZLIB_PREFIX=$(brew --prefix zlib)
export LDFLAGS="-L${ZLIB_PREFIX}/lib"
export CFLAGS="-I${ZLIB_PREFIX}/include"
export CPPFLAGS="-I${ZLIB_PREFIX}/include"
echo "zlib linked at ${ZLIB_PREFIX}/lib"
fi
# Check if Python hostedtoolcache folder exists...
echo "Check if Python hostedtoolcache folder exists..."
if [ ! -d $PYTHON_TOOLCACHE_PATH ]; then if [ ! -d $PYTHON_TOOLCACHE_PATH ]; then
echo "Creating Python hostedtoolcache folder..." echo "Creating Python hostedtoolcache folder..."
mkdir -p $PYTHON_TOOLCACHE_PATH mkdir -p $PYTHON_TOOLCACHE_PATH
else else
# remove ALL other directories for same major.minor python versions # Remove ALL other directories for same major.minor python versions
find $PYTHON_TOOLCACHE_PATH -name "${MAJOR_VERSION}.${MINOR_VERSION}.*"|while read python_version;do find $PYTHON_TOOLCACHE_PATH -name "${MAJOR_VERSION}.${MINOR_VERSION}.*" | while read python_version; do
python_version_arch="$python_version/$ARCH" python_version_arch="$python_version/$ARCH"
if [ -e "$python_version_arch" ];then if [ -e "$python_version_arch" ]; then
echo "Deleting Python $python_version_arch" echo "Deleting Python $python_version_arch"
rm -rf "$python_version_arch" rm -rf "$python_version_arch"
fi fi
done done
fi fi
echo "Install Python binaries from prebuilt package" echo "Installing Python binaries from prebuilt package"
sudo installer -pkg $PYTHON_PKG_NAME -target / sudo installer -pkg $PYTHON_PKG_NAME -target /
echo "Create hostedtoolcach symlinks (Required for the backward compatibility)" echo "Creating hostedtoolcache symlinks (Required for the backward compatibility)"
echo "Create Python $PYTHON_FULL_VERSION folder" echo "Create Python $PYTHON_FULL_VERSION folder"
mkdir -p $PYTHON_TOOLCACHE_VERSION_ARCH_PATH mkdir -p $PYTHON_TOOLCACHE_VERSION_ARCH_PATH
cd $PYTHON_TOOLCACHE_VERSION_ARCH_PATH cd $PYTHON_TOOLCACHE_VERSION_ARCH_PATH
@@ -51,7 +73,7 @@ ln -s "${PYTHON_FRAMEWORK_PATH}/include" include
ln -s "${PYTHON_FRAMEWORK_PATH}/share" share ln -s "${PYTHON_FRAMEWORK_PATH}/share" share
ln -s "${PYTHON_FRAMEWORK_PATH}/lib" lib ln -s "${PYTHON_FRAMEWORK_PATH}/lib" lib
echo "Create additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)" echo "Creating additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)"
ln -s ./bin/$PYTHON_MAJOR_DOT_MINOR python ln -s ./bin/$PYTHON_MAJOR_DOT_MINOR python
cd bin/ cd bin/
@@ -73,8 +95,8 @@ export PIP_ROOT_USER_ACTION=ignore
./python -m ensurepip ./python -m ensurepip
./python -m pip install --upgrade --force-reinstall pip --disable-pip-version-check --no-warn-script-location ./python -m pip install --upgrade --force-reinstall pip --disable-pip-version-check --no-warn-script-location
echo "Install OpenSSL certificates" echo "Installing OpenSSL certificates"
sh -e "${PYTHON_APPLICATION_PATH}/Install Certificates.command" sh -e "${PYTHON_APPLICATION_PATH}/Install Certificates.command"
echo "Create complete file" echo "Creating complete file"
touch $PYTHON_TOOLCACHE_VERSION_PATH/${ARCH}.complete touch $PYTHON_TOOLCACHE_VERSION_PATH/${ARCH}.complete

View File

@@ -54,15 +54,15 @@ else:
if os_type == 'Darwin': if os_type == 'Darwin':
### Validate openssl links ### Validate openssl links
if version_major == 3 and version_minor < 7: if version_major == 3 and version_minor < 7:
expected_ldflags = '-L/usr/local/opt/openssl@1.1/lib' expected_ldflags = '-L/usr/local/opt/openssl@3/lib'
ldflags = sysconfig.get_config_var('LDFLAGS') ldflags = sysconfig.get_config_var('LDFLAGS')
if not expected_ldflags in ldflags: if not expected_ldflags in ldflags:
print('Invalid ldflags: %s; Expected: %s' % (ldflags, expected_ldflags)) print('Invalid ldflags: %s; Expected: %s' % (ldflags, expected_ldflags))
exit(1) exit(1)
else: else:
expected_openssl_includes = '-I/usr/local/opt/openssl@1.1/include' expected_openssl_includes = '-I/usr/local/opt/openssl@3/include'
expected_openssl_ldflags ='-L/usr/local/opt/openssl@1.1/lib' expected_openssl_ldflags ='-L/usr/local/opt/openssl@3/lib'
openssl_includes = sysconfig.get_config_var('OPENSSL_INCLUDES') openssl_includes = sysconfig.get_config_var('OPENSSL_INCLUDES')
openssl_ldflags = sysconfig.get_config_var('OPENSSL_LDFLAGS') openssl_ldflags = sysconfig.get_config_var('OPENSSL_LDFLAGS')

File diff suppressed because it is too large Load Diff