Compare commits

..

6 Commits

Author SHA1 Message Date
priya-kinthali
1c71e7fbce Update test-tk.yml 2024-12-05 09:33:47 +05:30
priya-kinthali
75c061081b Update test-tk.yml 2024-12-05 09:32:13 +05:30
priya-kinthali
e50bc1c2bf Create tk_min.py 2024-12-05 09:28:59 +05:30
priya-kinthali
4fd1d81fcf Create test-tk.yml 2024-12-05 09:27:59 +05:30
priya-kinthali
acd80ba7b4 Update macos-python-builder.psm1 2024-12-05 08:57:17 +05:30
github-actions[bot]
5bbc2cab12 Update versions-manifest (#322)
Co-authored-by: Service account <no-reply@microsoft.com>
2024-12-04 13:29:08 -06:00
5 changed files with 263 additions and 53 deletions

44
.github/workflows/test-tk.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Test Python Tk
on:
push:
branches:
- tcl-tk
workflow_dispatch:
jobs:
tests-poetry:
strategy:
matrix:
os: [macos-latest-large]
# python-version: ["3.8.10", "3.8.17", "3.9.1", "3.9.19", "3.9.19", "3.10.1", "3.10.14", "3.11.9"]
python-version: [ "3.10.16"]
fail-fast: false
name: ${{ matrix.python-version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# uses: priya-kinthali/setup-python@test-930
uses: priya-kinthali/setup-python@test-tcl
with:
python-version: ${{ matrix.python-version }}
# - name: Print Tcl/Tk version
# run: |
# tclsh <<< 'puts [info patchlevel]; exit'
# wish <<< 'puts [info patchlevel]; exit'
- name: Verify Python Tk Version
run: |
python -c "import tkinter; print(f'Tkinter TkVersion: {tkinter.TkVersion}')"
- name: Prepare Ubuntu xvfb
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libxkbcommon-x11-0 xvfb
- name: Run tk script (closes itself after 5 seconds) - Ubuntu
if: runner.os == 'Linux'
run: xvfb-run python tk_min.py
- name: Run tk script (closes itself after 5 seconds)
if: runner.os != 'Linux'
run: python tk_min.py

View File

@@ -6,17 +6,18 @@ class macOSPythonBuilder : NixPythonBuilder {
MacOS Python builder class. MacOS Python builder class.
.DESCRIPTION .DESCRIPTION
Contains methods required to build macOS Python artifacts from sources. Inherited from base NixPythonBuilder. Contains methods that required to build macOS Python artifact 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 the platform for which Python should be built. The full name of 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(
@@ -31,16 +32,12 @@ 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") {
Write-Host "Installing additional dependencies for Python 3.7.17..." # We have preinstalled ncurses and readLine on the hoster runners. But we need to install bzip2 for
# Install necessary dependencies for Python 3.7.17 # setting up an environemnt
Execute-Command -Command "brew install bzip2 zlib readline ncurses sqlite3 openssl@3" # If we get any issues realted to ncurses or readline we can try to run this command
# brew install ncurses readline
# Ensure the environment variables for zlib are set correctly Execute-Command -Command "brew install bzip2"
$zlibPrefix = (brew --prefix zlib)
$env:LDFLAGS += " -L$($zlibPrefix)/lib"
$env:CFLAGS += " -I$($zlibPrefix)/include"
} }
} }
@@ -74,22 +71,20 @@ class macOSPythonBuilder : NixPythonBuilder {
$env:LDFLAGS = "-L/usr/local/opt/openssl@3/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@3/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" # For Python 3.7.x, use OpenSSL 1.1 $configureString += " --with-openssl=/usr/local/opt/openssl@3"
# For Python 3.7.2, 3.7.3, and 3.7.17 we need to provide PATH for zlib to pack it properly. # 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
# Otherwise, the build will fail with the error: zipimport.ZipImportError: can't decompress data; zlib not available # 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"
} }
if ($this.Version -gt "3.7.12") { if ($this.Version -lt "3.10") {
$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/tcl-tk' --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,34 +23,12 @@ 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}"
# Check if zlib is installed echo "Check if Python hostedtoolcache folder exist..."
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
@@ -60,10 +38,10 @@ else
done done
fi fi
echo "Installing Python binaries from prebuilt package" echo "Install Python binaries from prebuilt package"
sudo installer -pkg $PYTHON_PKG_NAME -target / sudo installer -pkg $PYTHON_PKG_NAME -target /
echo "Creating hostedtoolcache symlinks (Required for the backward compatibility)" echo "Create hostedtoolcach 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
@@ -73,7 +51,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 "Creating additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)" echo "Create 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/
@@ -95,8 +73,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 "Installing OpenSSL certificates" echo "Install OpenSSL certificates"
sh -e "${PYTHON_APPLICATION_PATH}/Install Certificates.command" sh -e "${PYTHON_APPLICATION_PATH}/Install Certificates.command"
echo "Creating complete file" echo "Create complete file"
touch $PYTHON_TOOLCACHE_VERSION_PATH/${ARCH}.complete touch $PYTHON_TOOLCACHE_VERSION_PATH/${ARCH}.complete

7
tk_min.py Normal file
View File

@@ -0,0 +1,7 @@
import tkinter as tk
root = tk.Tk()
label = tk.Label(root, text="Hello World!")
label.pack(padx=20, pady=20)
root.after(5000, root.destroy) # Close the Window after 5 seconds
root.mainloop()

View File

@@ -185,6 +185,78 @@
} }
] ]
}, },
{
"version": "3.13.1",
"stable": true,
"release_url": "https://github.com/actions/python-versions/releases/tag/3.13.1-12154081405",
"files": [
{
"filename": "python-3.13.1-darwin-arm64.tar.gz",
"arch": "arm64",
"platform": "darwin",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-darwin-arm64.tar.gz"
},
{
"filename": "python-3.13.1-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-darwin-x64.tar.gz"
},
{
"filename": "python-3.13.1-linux-20.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "20.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-20.04-x64.tar.gz"
},
{
"filename": "python-3.13.1-linux-22.04-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"platform_version": "22.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-22.04-arm64.tar.gz"
},
{
"filename": "python-3.13.1-linux-22.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "22.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-22.04-x64.tar.gz"
},
{
"filename": "python-3.13.1-linux-24.04-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"platform_version": "24.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-24.04-arm64.tar.gz"
},
{
"filename": "python-3.13.1-linux-24.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "24.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-linux-24.04-x64.tar.gz"
},
{
"filename": "python-3.13.1-win32-arm64.zip",
"arch": "arm64",
"platform": "win32",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-win32-arm64.zip"
},
{
"filename": "python-3.13.1-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-win32-x64.zip"
},
{
"filename": "python-3.13.1-win32-x86.zip",
"arch": "x86",
"platform": "win32",
"download_url": "https://github.com/actions/python-versions/releases/download/3.13.1-12154081405/python-3.13.1-win32-x86.zip"
}
]
},
{ {
"version": "3.13.0", "version": "3.13.0",
"stable": true, "stable": true,
@@ -1004,6 +1076,78 @@
} }
] ]
}, },
{
"version": "3.12.8",
"stable": true,
"release_url": "https://github.com/actions/python-versions/releases/tag/3.12.8-12154062663",
"files": [
{
"filename": "python-3.12.8-darwin-arm64.tar.gz",
"arch": "arm64",
"platform": "darwin",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-darwin-arm64.tar.gz"
},
{
"filename": "python-3.12.8-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-darwin-x64.tar.gz"
},
{
"filename": "python-3.12.8-linux-20.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "20.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-linux-20.04-x64.tar.gz"
},
{
"filename": "python-3.12.8-linux-22.04-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"platform_version": "22.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-linux-22.04-arm64.tar.gz"
},
{
"filename": "python-3.12.8-linux-22.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "22.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-linux-22.04-x64.tar.gz"
},
{
"filename": "python-3.12.8-linux-24.04-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"platform_version": "24.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-linux-24.04-arm64.tar.gz"
},
{
"filename": "python-3.12.8-linux-24.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "24.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-linux-24.04-x64.tar.gz"
},
{
"filename": "python-3.12.8-win32-arm64.zip",
"arch": "arm64",
"platform": "win32",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-win32-arm64.zip"
},
{
"filename": "python-3.12.8-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-win32-x64.zip"
},
{
"filename": "python-3.12.8-win32-x86.zip",
"arch": "x86",
"platform": "win32",
"download_url": "https://github.com/actions/python-versions/releases/download/3.12.8-12154062663/python-3.12.8-win32-x86.zip"
}
]
},
{ {
"version": "3.12.7", "version": "3.12.7",
"stable": true, "stable": true,
@@ -2216,6 +2360,48 @@
} }
] ]
}, },
{
"version": "3.11.11",
"stable": true,
"release_url": "https://github.com/actions/python-versions/releases/tag/3.11.11-12160100664",
"files": [
{
"filename": "python-3.11.11-linux-20.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "20.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.11.11-12160100664/python-3.11.11-linux-20.04-x64.tar.gz"
},
{
"filename": "python-3.11.11-linux-22.04-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"platform_version": "22.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.11.11-12160100664/python-3.11.11-linux-22.04-arm64.tar.gz"
},
{
"filename": "python-3.11.11-linux-22.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "22.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.11.11-12160100664/python-3.11.11-linux-22.04-x64.tar.gz"
},
{
"filename": "python-3.11.11-linux-24.04-arm64.tar.gz",
"arch": "arm64",
"platform": "linux",
"platform_version": "24.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.11.11-12160100664/python-3.11.11-linux-24.04-arm64.tar.gz"
},
{
"filename": "python-3.11.11-linux-24.04-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"platform_version": "24.04",
"download_url": "https://github.com/actions/python-versions/releases/download/3.11.11-12160100664/python-3.11.11-linux-24.04-x64.tar.gz"
}
]
},
{ {
"version": "3.11.10", "version": "3.11.10",
"stable": true, "stable": true,