FS#59997 - [python-gobject] fix compileall to not reference BUILDDIR

Attached to Project: Arch Linux
Opened by userwithuid (userwithuid) - Sunday, 09 September 2018, 13:09 GMT
Last edited by Jan Alexander Steffens (heftig) - Saturday, 15 September 2018, 20:24 GMT
Task Type General Gripe
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Jan Alexander Steffens (heftig)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The well-known "WARNING: Package contains reference to $pkgdir"


For manual compilation, you use:

python -m compileall "$pkgdir/usr/lib"
python -O -m compileall "$pkgdir/usr/lib"

which leaves this string in the pyc (/build being your BUILDDIR):
-----
/build/pygobject/pkg/python-gobject/usr/lib/python3.7/site-packages/gi/module.py
-----

This could be fixed by switching to something like this:

pushd "$pkgdir"
python -m compileall .
python -O -m compileall .
popd

which would make the string look like this:
-----
./usr/lib/python3.7/site-packages/gi/module.py
-----

For reference, with setuptools --root="$pkgdir" as used in most python-* PKGBUILDs the string looks like this (same except for the leading dot):
-----
/usr/lib/python3.7/site-packages/gi/module.py
-----



This pattern is used in other PKGBUILDs as well, but I thought I'd mention it for a specific example first. :-)
This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Saturday, 15 September 2018, 20:24 GMT
Reason for closing:  Fixed
Additional comments about closing:  python 3.7.0-4
pygobject 3.30.1-3
Comment by Jan Alexander Steffens (heftig) - Saturday, 15 September 2018, 06:21 GMT
I think I got a working pattern, thanks.

pushd "$pkgdir"
python -m compileall -d / usr/lib
python -O -m compileall -d / usr/lib
popd
Comment by userwithuid (userwithuid) - Saturday, 15 September 2018, 13:24 GMT
  • Field changed: Percent Complete (100% → 0%)
FYI: Your approach also does not emulate the setuptools path. It produces a string with no path at all, but sticks a slash in front, e.g.

"/module.py" for gi/module.py
"/keysyms.py" for gi/overrides/keysyms.py

Intentional?
Comment by Jan Alexander Steffens (heftig) - Saturday, 15 September 2018, 15:18 GMT
No. I misinterpreted the compileall code.

This should be right:

python -m compileall -d /usr/lib "$pkgdir/usr/lib"
python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"

However, python3's compileall is buggy and does not properly handle the -d when recursing. This needs to be fixed.

Loading...