8.88. Jinja2-3.1.6

Jinja2 is a Python module that implements a simple pythonic template language.

Approximate build time: less than 0.1 SBU
Required disk space: 2.5 MB

8.88.1. Installation of Jinja2

Create the PKGBUILD for the Jinja2 package with the following commands:

mkdir /sources/jinja2
cd /sources/jinja2
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="jinja2"
pkgver="3.1.6"
pkgrel="1"
pkgdesc="A Python module that implements a simple pythonic template language." 
arch=('any')
url="https://jinja.palletsprojects.com/en/3.1.x/"
license=('BSD3C')
groups=('core')
depends=('markupsafe'
         'python')
makedepends=('setuptools'
             'wheel')
source=('https://pypi.org/packages/source/J/Jinja2/jinja2-3.1.6.tar.gz')
md5sums=('66d4c25ff43d1deaf9637ccda523dec8')

build(){
  cd "${pkgname}-${pkgver}
  pip3 wheel -w dist --no-cache-dir --no-build-isolation --no-deps $PWD
}

package(){
  cd "${pkgname}-${pkgver}
  pip3 install --root "${pkgdir}" --no-index --find-links dist Jinja2
}
REALEOF

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp jinja2-3.1.6-1-any.pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/jinja2-3.1.6-1-any.pkg.tar.xz

Update the local cache and install the Jinja2 package:

pacman -Syu
pacman -S jinja2 --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/jinja2
cp PKGBUILD /srv/pacman/source/LFS/jinja2
cd /sources
rm -rf jinja2

8.88.2. Contents of Jinja2

Installed directory: /usr/lib/python3.13/site-packages/Jinja2-3.1.6.dist-info