Skip to content

Commit

Permalink
-allow Python upgrade on Windows
Browse files Browse the repository at this point in the history
-pin dotenv version on Linux
  • Loading branch information
roasterdave committed Feb 14, 2024
1 parent 8807ac1 commit 0f2fb73
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
14 changes: 12 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ environment:
# Set the Appveyor Python version for windows, macos and linux here. Does not affect windows_legacy.
PYTHON_V: 3.11
# Upgrade to specific version (for platforms supporting upgrade). Upgrade skipped if env var is missing or blank.
PYUPGRADE_V: 3.11.5
#PYUPGRADE_WIN_V: 3.12.2
PYUPGRADE_MACOS_V: 3.11.5

matrix:
- job_name: windows_legacy
Expand Down Expand Up @@ -140,6 +141,14 @@ for:
install:
- cmd: echo Windows Install

# Update the Python version when PYUPGRADE_WIN_V is set. The upgrade happens in install-win.bat
# Note that the paths set below may not exist yet.
- ps: |
if (Test-Path env:PYUPGRADE_WIN_V) {
$env:PREV_PYTHON_V = $env:PYTHON_V
$env:PYTHON_V = ($env:PYUPGRADE_WIN_V -split '\.')[0..1] -join '.'
}
# derive the python path from the version number
- ps: $env:PYTHON_PATH = "C:/Python$($env:PYTHON_V -replace '\.','')-x64"
- ps: Write-Host $env:PYTHON_PATH
Expand Down Expand Up @@ -266,9 +275,10 @@ for:
- chmod +x .ci/*.sh

# pull library versions from requirments file
# - ps: $env:LIBUSB_VER = Select-String -Path ./src/requirements.txt 'libusb==([\d\.]*)' -List | ForEach-Object {$_.Matches.Groups[1].Value}
- ps: $env:LIBUSB_VER = Select-String -Path ./src/requirements.txt "libusb==([\d\.]*).*platform_system='Linux'" -List | ForEach-Object {$_.Matches.Groups[1].Value}
- ps: Write-Host "LIBUSB_VER= $env:LIBUSB_VER"
- ps: $env:DOTENV_VER = Select-String -Path ./src/requirements.txt "dotenv==([\d\.]*).*platform_system='Linux'" -List | ForEach-Object {$_.Matches.Groups[1].Value}
- ps: Write-Host "DOTENV_VER= $env:DOTENV_VER"

# update the __revision__ field with the left seven of the GIT commit hash
- export GIT_VERSION=`git rev-parse --verify --short HEAD 2>/dev/null|| echo "???"`
Expand Down
3 changes: 2 additions & 1 deletion .ci/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ sudo apt-get install -y -q fakeroot
# add libs not installed by default on Qt5.15/Qt6 any longer
sudo apt-get install -y -q libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libxcb-cursor0

gem install fpm -v 1.12.0 # Linux build fails using 1.13.0
gem install dotenv -v ${DOTENV_VER}
gem install fpm # Linux build fails using 1.13.0
pip install --upgrade pip
pip install -r src/requirements.txt | sed '/^Ignoring/d'

Expand Down
12 changes: 6 additions & 6 deletions .ci/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ set -e # reduced logging
echo "** Running install-macos.sh"
#.ci/silence.sh brew update # this seems to help to work around some homebrew issues; and fails on others

# upgrade Python version when PYUPGRADE_V exists and has a value
if [ -n "${PYUPGRADE_V:-}" ]; then
# upgrade Python version when PYUPGRADE_MACOS_V exists and has a value
if [ -n "${PYUPGRADE_MACOS_V:-}" ]; then
# first deactivate current venv
source ${VIRTUAL_ENV}/bin/activate
deactivate
Expand All @@ -41,11 +41,11 @@ if [ -n "${PYUPGRADE_V:-}" ]; then
brew reinstall openssl # needed to get the ssl certificates properly installed for artisan.plus communication

# create new venv
python3 -m venv /Users/appveyor/venv${PYUPGRADE_V}
source /Users/appveyor/venv${PYUPGRADE_V}/bin/activate
python3 -m venv /Users/appveyor/venv${PYUPGRADE_MACOS_V}
source /Users/appveyor/venv${PYUPGRADE_MACOS_V}/bin/activate
# update symbolic link to point to our new venv
ln -vfns /Users/appveyor/venv${PYUPGRADE_V} /Users/appveyor/venv${PYTHON_V}
export PATH=/Users/appveyor/venv${PYUPGRADE_V}/bin:${PATH} # not exported?
ln -vfns /Users/appveyor/venv${PYUPGRADE_MACOS_V} /Users/appveyor/venv${PYTHON_V}
export PATH=/Users/appveyor/venv${PYUPGRADE_MACOS_V}/bin:${PATH} # not exported?
fi

hash -r
Expand Down
16 changes: 16 additions & 0 deletions .ci/install-win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ ver
echo Python Version
python -V

::
:: Upgrade the Python version to PYUPGRADE_WIN_V when the environment variable exists.
::
if NOT %PYUPGRADE_WIN_V% == "" (
echo ***** Upgrading from Python %PREV_PYTHON_V% to %PYUPGRADE_WIN_V%
echo *** Downloading Python install exe
curl -L -O https://www.python.org/ftp/python/%PYUPGRADE_WIN_V%/python-%PYUPGRADE_WIN_V%-amd64.exe
if not exist python-%PYUPGRADE_WIN_V%-amd64.exe (exit /b 80)
echo *** Installing Python %PYUPGRADE_WIN_V%
python-%PYUPGRADE_WIN_V%-amd64.exe /quiet PrependPath=1 Include_doc=0 Include_debug=0 Include_tcltk=0 Include_test=0
if not exist %PYTHON_PATH%\python.exe (exit /b 90)
echo ***** Upgrade Complete
echo Python Version
python -V
)

::
:: get pip up to date
::
Expand Down
1 change: 1 addition & 0 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#
# pyinstaller==6.4.0; platform_system='Windows'
# libusb==1.0.26; platform_system='Linux'
# dotenv==2.8.1; platform_system='Linux' # v3.0.0 not compatible with fpm # gem installed, not pip
#
######
# packages that are required on all platforms
Expand Down

0 comments on commit 0f2fb73

Please sign in to comment.