summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 34803112b289d9ee161c78461e8358dba267c29f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Maintainer: dreieck

_pkgname="python-condconfigparser"
pkgname="${_pkgname}-git"
pkgdesc="Python library designed to help parsing configuration files. Main specificity: Allows to define conditions using boolean operators and specific sections in the configuration file that are only applied when the corresponding condition is fulfilled."
url="https://frougon.net/projects/CondConfigParser/"
license=("BSD-2-Clause")
epoch=0
pkgver=1.0.6+1.r38.20250415.77c0a62
pkgrel=2
arch=(
  'any'
)
depends=(
  'python>=3.4'
)
makedepends=(
  'git'
  'gitlog-to-changelog'
  'python-build'
  'python-installer'
  'python-setuptools>=77.0.3'
  'python-wheel'
)
provides=(
  "python3-condconfigparser=${pkgver}"
  "${_pkgname}=${pkgver}"
)
conflicts=(
  "python3-condconfigparser"
  "${_pkgname}"
)
optdepends=()
source=(
  "${_pkgname}::git+https://github.com/frougon/CondConfigParser"
  # "workaround_license_double_specification.pyproject-toml.patch::https://github.com/user-attachments/files/19757701/workaround_license_double_specification.pyproject-toml.patch.txt"
)
sha256sums=(
  'SKIP'
  # '978b615bb7a5a1b5d19bc021cf6e21030a457c78aa5ca2f06f457174ed7b44da'
)

validpgpkeys=(
  '125B5A0FDB788FDD0EF41A9DC785B90B5053A3A2'
)

prepare() {
  cd "${srcdir}/${_pkgname}"

  # for _patch in "${srcdir}/workaround_license_double_specification.pyproject-toml.patch"; do
  #   printf '%s\n' "   > Applying patch '$(basename "${_patch}")' ..."
  #   patch -Np1 --follow-symlinks -i "${_patch}"
  # done

  git log > git.log
}

pkgver() {
  cd "${srcdir}/${_pkgname}"
  _rev="$(git rev-list HEAD --count)"
  _date="$(git log -1 --format=%cd --date=format:%Y%m%d)"
  _hash="$(git rev-parse --short HEAD)"
  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  #cd condconfigparser
  #_ver="$(python -c 'import version; print(version.__version__)')"
  if [ -z ${_ver} ]; then
    error "Could not determine version."
    exit 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}


build() {
  cd "${srcdir}/${_pkgname}"
  printf '%s\n' "${url}" > "upstream.url"

  python -m build --wheel --no-isolation
}

package() {
  cd "${srcdir}/${_pkgname}"

  python -m installer --destdir="$pkgdir" --compile-bytecode=2 dist/*.whl

  for _docfile in git.log upstream.url AUTHORS README.distributors README.rst INSTALL.txt TODO; do
    install -D -m644 -v "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/${_docfile}"
  done

  for _license in COPYING COPYING.Sphinx; do
    install -D -m644 -v "${_license}" "${pkgdir}/usr/share/licenses/${pkgname}/${_license}"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/${_license}" "${pkgdir}/usr/share/doc/${_pkgname}/${_license}"
  done
}