You are not logged in.
I made a package for installing sympy (https://github.com/sympy/sympy) from source (latest git). The python-sympy package installs the latest release. I thought this might be useful to someone else. This is my first PKGBUILD, so please tell me everything I am doing wrong.
# Maintainer: Ryan Greenblatt <ryan_greenblatt at brown dot edu>
pkgname=python-sympy-git
_pkgname=python-sympy-git
pkgver=sympy.1.6.r1717.ga24d96d03e
pkgrel=1
pkgdesc="Computer algebra system (CAS) in Python, written in pure Python - git version"
arch=('any')
license=(BSD)
url='https://sympy.org/en/index.html'
license=('BSD')
depends=('python-mpmath')
conflicts=('python-sympy')
provides=('python-sympy')
optdepends=('ipython: user friendly interface for isympy')
makedepends=('python-setuptools' 'git')
source=("$pkgname::git+https://github.com/sympy/sympy.git"
"LICENSE::https://raw.githubusercontent.com/sympy/sympy/master/LICENSE")
sha256sums=('SKIP' 'SKIP')
if [ -n "$VIRTUAL_ENV" ]; then
echo "Warning: You're building within a virtualenv. Use"
echo "a shell without virtualenv to build this package!"
exit 1
fi
pkgver() {
cd "$pkgname"
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
package() {
cd "$_pkgname"
python setup.py install --root="$pkgdir" --optimize=1
install -Dm644 ../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
# vim:set ts=2 sw=2 et:
Offline
Since _pkgname has the same value as pkgname, the former is redundant and may be deleted.
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
The license array is duplicated
The license appears to already be in the repo, why download it separately?
'sympy.' should be stripped from the pkgver in the pkgver function
Why are you renaming the dir when downloading the repo?
Offline
Thanks for the feedback.
I think that the dir needs to renamed to avoid potential name conflicts in the SRCDEST.
See https://wiki.archlinux.org/index.php/PKGBUILD#Sources.
I think "python-sympy-git" would be less likely to have conflicts than "sympy".
Maybe it should even include the version in the dir name.
Perhaps I misunderstand when name conflicts can occur.
Also, I changed to pkgver regex to filter out "sympy-". I considered instead using "\w\+-" but I decided being specific was better.
I have updated the PKGBUILD to this:
# Maintainer: Ryan Greenblatt <ryan_greenblatt at brown dot edu>
pkgname=python-sympy-git
pkgver=1.6.r1717.ga24d96d03e
pkgrel=1
pkgdesc="Computer algebra system (CAS) in Python, written in pure Python - git version"
arch=('any')
url='https://sympy.org/en/index.html'
license=('BSD')
depends=('python-mpmath')
conflicts=('python-sympy')
provides=('python-sympy')
optdepends=('ipython: user friendly interface for isympy')
makedepends=('python-setuptools' 'git')
source=("$pkgname::git+https://github.com/sympy/sympy.git")
sha256sums=('SKIP')
if [ -n "$VIRTUAL_ENV" ]; then
echo "Warning: You're building within a virtualenv. Use"
echo "a shell without virtualenv to build this package!"
exit 1
fi
pkgver() {
cd "$pkgname"
git describe --long --tags | sed 's/sympy-\(.*\)/\1/g;s/\([^-]*-g\)/r\1/;s/-/./g'
}
package() {
cd "$pkgname"
python setup.py install --root="$pkgdir" --optimize=1
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
# vim:set ts=2 sw=2 et:
Offline
Package is live https://aur.archlinux.org/packages/python-sympy-git/
Offline
Thanks for the feedback.
I think that the dir needs to renamed to avoid potential name conflicts in the SRCDEST.
See https://wiki.archlinux.org/index.php/PKGBUILD#Sources.
I think "python-sympy-git" would be less likely to have conflicts than "sympy".
Maybe it should even include the version in the dir name.
Perhaps I misunderstand when name conflicts can occur.
Name conflicts occur when generic names are used, which are very likely to clash. For example, the filename "v1.0.tar.gz"
I think it's very unlikely that someone else is downloading a PKGBUILD source git repo named "sympy" which is something other than the well-known SymPy software. Note the "py" is for "python" already. And the "-git" at the end is literally meaningless as by the same logic, every git repo source would include "-git", so this imaginary sympy alternative software would also include a "-git" and thus clash once more.
You're utterly forbidden from including the $pkgver in the dir name, since the pkgver() function would then update the expected dir name after prepare() and pkgver(), but before build(), and then it would not be able to find the old dir name.
Versions in source names are only for stable files e.g. tarballs and are used in PKGBUILDs that do *not* include a pkgver() function.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
I think it's very unlikely that someone else is downloading a PKGBUILD source git repo named "sympy" which is something other than the well-known SymPy software. Note the "py" is for "python" already. And the "-git" at the end is literally meaningless as by the same logic, every git repo source would include "-git", so this imaginary sympy alternative software would also include a "-git" and thus clash once more.
You're utterly forbidden from including the $pkgver in the dir name, since the pkgver() function would then update the expected dir name after prepare() and pkgver(), but before build(), and then it would not be able to find the old dir name.
Versions in source names are only for stable files e.g. tarballs and are used in PKGBUILDs that do *not* include a pkgver() function.
Ok, makes sense. I have switched the repo directory name to sympy.
Offline