[aur-general] Python packaging: to build or not to build (Re: Review request for 3 related PKGBUILDs)

Bruno Pagani bruno.n.pagani at gmail.com
Tue Feb 14 23:11:52 UTC 2017

Le 03/01/2017 à 22:36, Eli Schwartz via aur-general a écrit :

> On 01/03/2017 04:12 PM, Leonid Bloch wrote:
>> Thanks! That was very helpful!
>> All applied, except... "--skip-build" - indeed it makes sense, but I
>> have never seen it with other Python packages. So I wonder if indeed it
>> is a good practice, or is there some reason not to include it?
> Well, python-setuptools does it, but it doesn't seem to be very popular.
> Really, for Make-powered builds the dependencies for "install" are going
> to run anyway (but they were built during build() and usually do
> nothing, silently).
> Then again, a lot of python PKGBUILDs don't have a build() function at
> all, which means the package() function will invoke "build" itself.
> Apparently, there is an arcane difference between building a python
> module and compiling an ELF binary, but no one has told me what that
> difference may be... I don't usually pay attention to what other people
> do. :)
> It makes no difference whether you look at the repos or the AUR, both
> have people who do all three styles.
> The only practical difference would be if someone, say, ran `makepkg
> --nobuild && makepkg --repackage` on a VCS package, which they shouldn't.

I’m sort of reviving this thread, because I’ve stumbled upon discussions
around this recently, and in fact I see one practical reason of doing
the build in the package() function rather than in the build() one:

– split python2-lib/python-lib package without build() function (only
the relevant parts):
package_python-lib() {
    python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
    python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1

– vs with build() function:
prepare() {
    cp -a libname{,-py2}
build() {
    cd libname
    python setup.py build

    cd libname-py2
    python2 setup.py build
package_python-lib() {
    python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
    python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1

Now, whether this is a good practice or not and what may be the
implications regarding makepkg, that’s a different thing. But it would
be good to agree on one way or another, and keep it the same everywhere
for consistency. If they are good reason to do it the second way, I’d
like to know them. Else, I have a tendency to find the shortest one to
be the best. ;)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 520 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20170215/364c62ec/attachment-0001.asc>

More information about the aur-general mailing list