Solved Upgrading python3.7 -> 3.8 case no python on the system at all

hello,

According to /usr/ports/UPDATING the method to upgrade python described as:
Code:
portmaster -o lang/python38 python37
REINSTALL="$(pkg info -o "*py37*" | awk '{printf "%s ", $2}')"
pkg delete -f "*py37*"
portmaster $REINSTALL
REBUILD=$(pkg query -g "%n:%dn" '*' | grep py3 | grep -v py38 | cut -d : -f 1 | sort -u)
portmaster $REBUILD
REBUILD2=$(pkg list | grep python-37 | xargs pkg which | awk '{print $6}' | sort -u)
portmaster $REBUILD2

I have tried this on 5 different PC running BSD12.2 release. After this steps on all pc-s had the same result - no python where available on the system ( $ python -> not found)
In my case issue was fixable with # portmaster -df lang/python

Allow me to share my update script:
Bash:
#!/bin/sh
#!/bin/sh
pm_flags="-d -y --no-confirm"


pkg_new="lang/python38"

# get python3x- installed version
pkg_old="$(pkg info 'python3*' | grep -ie 'python3[[:digit:]]-')" 

# get old python shared lib
pkg_old_shlib="$(pkg info -q --provided-shlibs $pkg_old )"


###############################################################
# upgrade
portmaster ${pm_flags} -o "${pkg_new}" "${pkg_old}"

# fix nonexisting python
portmaster ${pm_flags} -f lang/python


REINSTALL="$(pkg info -o "*py37*" | awk '{printf "%s ", $2}')"
pkg delete -f "*py37*"
portmaster ${pm_flags} $REINSTALL


REBUILD=$(pkg query -g "%n:%dn" '*' | grep py3 | grep -v py38 | cut -d : -f 1 | sort -u)
portmaster ${pm_flags} $REBUILD

REBUILD2=$(pkg list | grep python-37 | xargs pkg which | awk '{print $6}' | sort -u)
portmaster ${pm_flags} $REBUILD2

# rebuild ports that depends on old python shared lib
REBUILD="$(pkg shlib -qR ${pkg_old_shlib})"
portmaster -df $REBUILD
Hope this might help someone.

update:
2021-06-26 - added post rebuild depending on shared library ports
 
Last edited:
Back
Top