summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcell Meszaros2023-12-02 15:08:03 +0100
committerMarcell Meszaros2023-12-02 15:18:40 +0100
commit3a99a19f71b626e7d50ec1bdd0197f1896f05256 (patch)
treec92c0aa79ffe91766f0d4e6d96e0cf677fef0ea4
parent0872d97eb3e02f2b1b7e2e2f970a90bdba7ddc63 (diff)
downloadaur-3a99a19f71b626e7d50ec1bdd0197f1896f05256.tar.gz
Modernize PKGBUILD, sync with extra/python-magic
-rw-r--r--.SRCINFO21
-rw-r--r--.gitignore21
-rw-r--r--PKGBUILD77
3 files changed, 84 insertions, 35 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 172d2bc5fc42..639f32c8d029 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,22 @@
pkgbase = python-magic-git
- pkgdesc = Python 3 packages for alternative (github) implementation of python-magic
- pkgver = 0.4.6
- pkgrel = 5
- url = https://github.com/ahupp/python-magic
+ pkgdesc = File type identification library; unofficial wrapper for file/libmagic (git)
+ pkgver = 0.4.27.r22.g54d86fd
+ pkgrel = 1
+ url = https://pypi.org/project/python-magic
arch = any
license = MIT
+ checkdepends = python-pytest
makedepends = git
- makedepends = python
+ makedepends = python-build
+ makedepends = python-installer
makedepends = python-setuptools
+ makedepends = python-wheel
+ depends = file
depends = python
+ provides = python-magic=1:0.4.27
conflicts = python-magic
- source = python-magic-git::git+https://github.com/ahupp/python-magic
- md5sums = SKIP
+ conflicts = python-file-magic
+ source = python-magic::git+https://github.com/ahupp/python-magic.git
+ b2sums = SKIP
pkgname = python-magic-git
-
diff --git a/.gitignore b/.gitignore
index bbbff9a04fd9..e1cc0116832e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,17 @@
-src
-pkg
-python-magic-git
-*.pkg.tar.xz
+# based on https://github.com/github/gitignore/blob/master/ArchLinuxPackages.gitignore
+*.tar
+*.tar.*
+*.rpm
+*.jar
+*.exe
+*.msi
+*.zip
+*.tgz
+*.log
+*.log.*
+
+*/
+*.orig
+*.bak
+*.backup
+*.kate-swp
diff --git a/PKGBUILD b/PKGBUILD
index 2cb90078a79c..9af6b6e8504d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,33 +1,64 @@
-# Maintainer: Richard Neumann aka. rne <r dot neumann at homeinfo fullstop de>
+# Contributor: Marcell Meszaros < marcell.meszaros AT runbox.eu >
+# Contributor: David Runge <dvzrv@archlinux.org>
+# Contributor: Lukas Fleischer <lfleischer@archlinux.org>
+# Contributor: Richard Neumann aka. rne <r dot neumann at homeinfo fullstop de>
-pkgname='python-magic-git'
-pkgver='0.4.6'
-pkgrel=5
-pkgdesc="Python 3 packages for alternative (github) implementation of python-magic"
+_pkgbase=python-magic
+pkgname="${_pkgbase}-git"
+pkgver=0.4.27.r22.g54d86fd
+pkgrel=1
+_stablepkg_epoch=1
+pkgdesc="File type identification library; unofficial wrapper for file/libmagic (git)"
arch=('any')
-url='https://github.com/ahupp/python-magic'
+url='https://pypi.org/project/python-magic'
+_repourl='https://github.com/ahupp/python-magic'
license=('MIT')
-depends=('python')
-makedepends=('git' 'python' 'python-setuptools')
-conflicts=('python-magic')
-source=("${pkgname}::git+https://github.com/ahupp/python-magic")
-md5sums=('SKIP')
-pkgdir='pkg'
-srcdir='src'
+depends=(
+ 'file'
+ 'python'
+)
+makedepends=(
+ 'git'
+ 'python-build'
+ 'python-installer'
+ 'python-setuptools'
+ 'python-wheel'
+)
+checkdepends=('python-pytest')
+provides=("${_pkgbase}=${_stablepkg_epoch}:${pkgver%.r*}")
+conflicts=(
+ "${_pkgbase}"
+ 'python-file-magic' # official libmagic bindings - https://pypi.org/project/file-magic
+)
+source=("${_pkgbase}::git+${_repourl}.git")
+b2sums=('SKIP')
+pkgver() {
+ cd "${_pkgbase}"
-package() {
- local LICENSE_DIR="${pkgdir}/usr/share/licenses/${pkgname}"
-
- # Set up directories
- install -d -m 755 ${LICENSE_DIR}
+ # Generate git tag based version. Count only proper (v)#.#* [#=number] tags.
+ local _gitversion=$(git describe --long --tags --match '[v0-9][0-9.][0-9.]*' | sed -e 's|^v||' | tr '[:upper:]' '[:lower:]')
- cd "${srcdir}/${pkgname}"
+ # Format git-based version for pkgver
+ # Expected format: e.g. 1.5.0rc2.r521.g99982a1c
+ echo "${_gitversion}" | sed \
+ -e 's|^\([0-9][0-9.]*\)-\([a-zA-Z]\+\)|\1\2|' \
+ -e 's|\([0-9]\+-g\)|r\1|' \
+ -e 's|-|.|g'
+}
- # Install python packages to $pkgdir
- python setup.py install --root ${pkgdir}
+build() {
+ cd "${_pkgbase}"
+ python -m build --wheel --no-isolation
+}
- # Install license file
- install -m 644 LICENSE ${LICENSE_DIR}
+check() {
+ cd "${_pkgbase}"
+ LC_ALL=en_US.UTF-8 pytest -vv "${pytest_options[@]}"
}
+package() {
+ cd "${_pkgbase}"
+ python -m installer --destdir="$pkgdir" dist/*.whl
+ install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
+}