python - An interpreted, interactive, object-oriented programming language ChangeLog

HOWTO


# Python
# ======
# Slackware 14.0: python 2.7.3
# Slackware 14.1: python 2.7.5
# Slackware 14.2: python 2.7.11
# Slackware 15.0: python2 2.7.18, python3 3.9.10
#
# Some of them include security-patched versions in 'patches'.
#
# Slackware 9.1 and up also include 'python-demo' and 'python-tools'
# packages, but they were merged back into 'python' in 11.0
#
# Slackware 14.2 and up include python-pillow (instead of pil) and
# python-setuptools packages.  Those are covered here:
# PIL
# setuptools

# Below I include the latest 3.8 and 2.7 releases.

# If you are using Mailman 2.x, you need Python 2.7
# If you are using Mailman 3.x, you need Python >= 3.4 for the core and
# 2.7 for the web UI and archiver (it may be >= 3.x for all now, it's been a
# while)

# As long as your shebang (1st line of a script) uses the path to the
# specific version, you should be able to have multiple major versions of
# Python installed.
#
# #!/usr/bin/python2
# #!/usr/bin/python2.7
# #!/usr/bin/python3
#
# You should also run programs like 'pip' as the specific
# version, like 'pip2.7' or 'pip3' if you have one 2.x and one 3.x version
# installed.

# If you want to make sure there are no old files left over from previous
# releases that may cause issues when upgrading, skip down to the bottom
# for uninstall instructions.

# Prerequisites:
# OpenSSL (for Python's socket module)
# pkg-config
# Tcl/Tk (for _tkinter)

# If you are upgrading from Python 2.x to 3.x, read:
# Should I use Python 2 or Python 3 for my development activity?


# Python 3.8.18 (2023-08-24)
# =============
# If you're about to upgrade from 3.7.x to 3.8.x, read this:
# https://docs.python.org/3/whatsnew/3.8.html
# for info about changes between the two versions.  For more info read
# Misc/NEWS.

# Python 3.8.18 Release Notes
# Python 3.8.18 Changelog

# Get it
cd
test -f installed/Python-3.8.18.tar.xz && mv installed/Python-3.8.18.tar.xz .
test ! -f Python-3.8.18.tar.xz &&
wget https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tar.xz

# Verify tarball w/ md5sum:
# (from the Python site)
echo "5ea6267ea00513fc31d3746feb35842d  Python-3.8.18.tar.xz" | md5sum -c

# Verify tarball w/ sha256sum:
# (this came from my md5sum and gpg-verified tarball)
echo "3ffb71cd349a326ba7b2fadc7e7df86ba577dd9c4917e52a8401adbda7405e\
3f  Python-3.8.18.tar.xz" | sha256sum -c

# Verify tarball w/ gpg:
wget -O - https://www.python.org/static/files/pubkeys.txt | gpg --import -
( gpg --list-keys AA65421D > /dev/null 2>&1 || gpg --recv-keys AA65421D ) &&
wget -nc http://www.python.org/ftp/python/3.8.18/\
Python-3.8.18.tar.xz.asc &&
  gpg --verify Python-3.8.18.tar.xz.asc && rm Python-3.8.18.tar.xz.asc

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "Python-3.*" -exec rm -r {} \;
tar xJvf ~/Python-3.8.18.tar.xz
cd Python-3.8.18
test $UID = 0 && chown -R root:root .

# Apply this patch if you are 64-bit and do not want everything to
# end up in /usr/lib (instead of /usr/lib64)
# (configure does not abide by it's own --libdir flag)
# https://stackoverflow.com/questions/41558535/python-3-6-installation-and-lib64
# https://build.opensuse.org/package/view_file/openSUSE:Factory/python38/F00102-lib64.patch?expand=1
test $(uname -m) = 'x86_64' &&
wget -nc https://englanders.us/pub/linux/patches/notmine/\
python-3.8.18-lib64.diff && patch -p1 < python-3.8.18-lib64.diff

## Configure the build

# If you don't need pip, leave off --with-ensurepip=install
# You could just install it later, but every way I tried to do it a while
# back with 2.x, I'd get stuck with a dependency loop between the get-pip.py
# script needing urllib3, not having it, that requires something else, ...

# If you have source-installed OpenSSL under /usr/local/ssl and are 64-bit:
# (as with < 1.1.0)
test $(uname -m) = 'x86_64' -a -d /usr/local/ssl/lib64 &&
LDFLAGS=-L/usr/local/ssl/lib64 \
./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man \
--enable-shared --with-ensurepip=install

# If you are 64-bit but do not have a /usr/local/ssl/lib64
# (as with OpenSSL 1.1.0 and 3.0)
test $(uname -m) = 'x86_64' -a ! -d /usr/local/ssl/lib64 &&
./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man \
--enable-shared --with-ensurepip=install

# Any other situation:
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --enable-shared --mandir=/usr/man \
--with-ensurepip=install

# Build it
make $(nproc)

# Test the build
make test

# Become root to clean up old files and to install it
su

# Remove the Slackware packages:
test -x /sbin/removepkg &&
/sbin/removepkg python python3 python-demo python-pillow python-setuptools \
python-tools

# I don't do this when upgrading from one minor version to another (3.8.17 to
# 3.8.18), but when I upgrade from one major version to another (3.7.x to
# 3.8.x) I sometimes like to blow everything away from the old version(s) to
# make sure there aren't old files lying around that will cause problems
# later.  Skip down to the bottom if you want to zap everything before
# proceeding ...which may break lots of things for you.

# Install the new version
#
# Use 'make install' for whatever you want your default version of
# Python to be.  i.e. what you get when you run 'python'.
#
# If you use 'make altinstall' instead, that will leave existing python
# and python-config (usually in /usr/bin) pointing to whatever it was
# already pointing to.  In that case, you would need to run 'python3.8'
# this is the only 3.x one, or 'python3.8' if there are others like 3.7.x
make install
ldconfig

# If you have Python 2.x and 3.8.18 installed, and want to be able to run
# python, python-config, pip, pydoc and get 3.8.18:
( cd /usr/bin
  test -L pip && rm pip
  test -L pydoc && rm pydoc
  test -L python && rm python
  test -L python-config && rm python-config
  ln -sf pip3.8 pip
  ln -sf pydoc3.8 pydoc
  ln -sf python3.8 python
  ln -sf python3.8-config python-config )

# If this is your only Python 3.x, create symlinks so you can run
# python3, python3-config, pip3, pydoc3, ...
( cd /usr/bin
  test -L pip3 && rm pip3
  test -L pydoc3 && rm pydoc3
  test -L python3 && rm python3
  test -L python3-config && rm python3-config
  ln -sf pip3.8 pip3
  ln -sf pydoc3.8 pydoc3
  ln -sf python3.8 python3
  ln -sf python3.8-config python3-config )

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# If you used 'make altinstall' and already had Python 2.x installed, then
# the python and python-config symlinks should still point to Python 2.x
# If you used 'make install' and you want 'python' to be 2.x, you may
# need to do this:
# ln -sf /usr/bin/python2 /usr/bin/python
# ln -sf /usr/bin/python2-config /usr/bin/python-config

# If you want to upgrade pip, with pip, run the following:
# (you may get a message saying there is a newer version of pip while using
# it)
pip install --upgrade pip

# For pip usage:
pip --help
pip install --help

# Become yourself again
exit

# Keep the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/Python-3.*.tgz installed/Python-3.*.tar.*
mv Python-3.8.18.tar.xz installed/

# Skip down to the bottom for a list of some common Python-using apps


# Python 2.7.18 (2020-04-20)
# =============
# Python 2.7 became EoL (End of Life, no more support/upgrades) on January 1, 2020
# If you're about to upgrade from 2.6.x to 2.7.x, read this:
# http://docs.python.org/whatsnew/2.7.html
# for info about changes between the two versions.  For more info read
# Misc/NEWS.

# Python 2.7.18 Release Notes
# Python 2.7.18 Changelog

# Get it
cd
test -f installed/Python-2.7.18.tar.xz && mv installed/Python-2.7.18.tar.xz .
test ! -f Python-2.7.18.tar.xz &&
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz

# Verify tarball w/ md5sum:
# (from the Python site)
echo "fd6cc8ec0a78c44036f825e739f36e5a  Python-2.7.18.tar.xz" | md5sum -c

# Verify tarball w/ sha256sum:
# (this came from my md5 and gpg-verified tarball)
echo "b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef\
43  Python-2.7.18.tar.xz" | sha256sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 18ADD4FF > /dev/null 2>&1 || gpg --recv-keys 18ADD4FF ) &&
wget -nc https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz.asc &&
  gpg --verify Python-2.7.18.tar.xz.asc && rm Python-2.7.18.tar.xz.asc

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "Python-2.*" -exec rm -r {} \;
tar xJvf ~/Python-2.7.18.tar.xz
cd Python-2.7.18
test $UID = 0 && chown -R root:root .

# If you are 64-bit, get this patch so we don't end up with
# /usr/lib/python2.7 and /usr/lib64/python2.7 because they hard code /lib/
# in the Python source without listening to their own configure --libdir
# Slackware source has a diff like this, but it was partial fuzz and some
# .rej this time.  (fuzz for years but all successful)
test $(uname -m) = 'x86_64' &&
wget -nc https://englanders.us/pub/linux/patches/Python-2.7.18-x86_64.diff &&
  patch -p1 < Python-2.7.18-x86_64.diff

## Configure the build

# If you don't need pip, leave off --with-ensurepip=install
# You could install it later, and I did not try with 2.7.18, but in the
# past, every way I tried to do install it separate from the Python
# installation itself, I would get stuck with a dependency loop between the
# get-pip.py script needing urllib3, not having it, that requires something
# else, ...

# If you have source-installed OpenSSL under /usr/local/ssl and are 64-bit:
test $(uname -m) = 'x86_64' -a -d /usr/local/ssl/lib64 &&
LDFLAGS=-L/usr/local/ssl/lib64 \
./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man \
--enable-shared --with-ensurepip=install

# If you are 64-bit but do not have a /usr/local/ssl/lib64
# (which is the default for OpenSSL 1.1.1 and 3.0)
test $(uname -m) = 'x86_64' -a ! -d /usr/local/ssl/lib64 &&
./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man \
--enable-shared --with-ensurepip=install

# Any other situation:
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --enable-shared --mandir=/usr/man \
--with-ensurepip=install

# Build it
make

# Become root to clean up old files and to install it
su

# Remove the Slackware packages, if there are any:
test -x /sbin/removepkg &&
/sbin/removepkg python python2 python-demo python-pillow python-setuptools \
python-tools

# I don't do this when upgrading from one minor version to another (2.7.17 to
# 2.7.18), but when I upgrade from one major version to another (2.6.x to
# 2.7.x) I sometimes like to blow everything away from the old version(s) to
# make sure there aren't old files lying around that will cause problems
# later.  Skip down to the bottom if you want to zap everything before
# proceeding ...which may break lots of things for you.

# Install the new version
make install
ldconfig

## If you already had Python 3.x and just installed 2.x, but want the
## 'python' and 'python-config' symlinks to point to 3.x:
# ln -sf /usr/bin/python3 /usr/bin/python
# ln -sf /usr/bin/python3-config /usr/bin/python-config

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# If you want to upgrade pip, with pip, run the following:
# (you may get a message saying there is a newer version of pip while using
# it)
pip install --upgrade pip

# For pip usage:
pip --help
pip install --help

# Become yourself again
exit

# Keep the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/Python-2.*.tgz installed/Python-2.*.tar.*
mv Python-2.7.18.tar.xz installed/

# Skip down to the bottom for a list of some common Python-using apps


# List of some things that I reinstall or at least verify that they still
# work, after upgrading from one major version to another.
#
# This will give you an idea of some that are part of a Slackware package
# as well:
#
#   grep site-packages /var/adm/packages/* | cut -d: -f1 | sort | uniq
#
# BitTorrent and dnspython
# cracklib
# D-BUS and Pyrex
# fetchmail's fetchmailconf
# file's Python bindings (see the bottom)
# gcalcli
# gnome-python
# HPLIP
# kdebindings
# libieee1284
# libxml2
# libxslt
# linkchecker and psyco
# mysql-python
# newt seems to be the owner of _snackmodule.so and snack.*
# PIL (pil/python-pillow)
# gnome-menus (GMenuSimpleEditor)
# pycairo
# pycrypto
# PyGTK
# PyOpenGL
# pyorbit (CORBA.py*, ORBit.*, PortableServer.*)
# PyQT and sip
# pyao, pyvorbis
# Pyzor (in the MIMEDefang howto)
# ReportLab (in the gramps howto)
# Revelation
# vte
# wxPython


# If you ever want to uninstall Python, this should do it:
# (stick to *.* to avoid matching python-thisname, python-thatname ...)
cd
su
for pfx in /usr /usr/local; do
  ( cd ${pfx}/bin ; rm -f python python-config python2 python2-config )
  find ${pfx}/bin -type l -name "python*" -exec rm {} \;
  find ${pfx}/bin -type f -name "python*.*" -exec rm {} \;
  find ${pfx}/include -maxdepth 1 -type d -name "python*.*" \
   -exec rm -r {} \; 2> /dev/null
  find ${pfx}/{lib,lib64} -maxdepth 1 -type d -name "python*.*" \
   -exec rm -r {} \; 2> /dev/null
  find ${pfx}/{lib,lib64} -maxdepth 1 -type l -name "libpython*.so" \
   -exec rm {} \; 2> /dev/null
  find ${pfx}/{lib,lib64} -maxdepth 1 -type f -name "libpython*.so.*" \
   -exec rm {} \; 2> /dev/null
  find ${pfx}/{lib,lib64}/pkgconfig -name "python*.pc" -exec rm {} \;
  test -d ${pfx}/man/man1 &&
   ( cd ${pfx}/man/man1 ; rm -f python.1 python2.1 )
  find ${pfx}/man/man1 -type f -name "python*.1" -exec rm {} \;
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "Python-*" -exec rm -r {} \;
rm -f ~/installed/Python-*.tar.* ~/installed/Python-*.tgz

List of HOWTOs

Web page itself last updated: 2023-12-20 8:06pm (EST -0500)
HOWTO last updated: 2023-09-30 12:01am
Copyright © 2001-2024 Jason Englander. All Rights reserved.
[HTML5]