PATCH: Installation with DESTDIR leaves DESTDIR/ prefixes in .pyc files

Bug #1241770 reported by Matthias Andree
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
Low
Mark Sapiro

Bug Description

Packaging mailman 2.1.16 for FreeBSD's new STAGEDIR (think DESTDIR) support, the FreeBSD Q/A scripts complained that the .pyc files contain the DESTDIR prefix, and thus might misrepresent their own path in tracebacks.

I debugged this and figured that Makefile.in is the culprit,
$(PYTHON) -c 'from compileall import *; compile_dir("$(DESTDIR)$(prefix)/Mailman")'

Read this in context with the Python reference, http://docs.python.org/2/library/compileall.html#module-compileall (about the ddir argument), and http://docs.python.org/2/library/py_compile.html#module-py_compile.

I am offering a patch to remedy this problem, and ask that it be included in all future releases (2.1.17, for instance). Assume it is under the 2-clause BSD license.

Related branches

Revision history for this message
Matthias Andree (matthias-andree) wrote :
Revision history for this message
Mark Sapiro (msapiro) wrote :

Is there some reason why your patch does

 (cd "$(DESTDIR)$(prefix)" \
     && $(PYTHON) -c 'from compileall import *; compile_dir("Mailman", ddir="$(prefix)/Mailman")')

instead of just

 $(PYTHON) -c 'from compileall import *; compile_dir("$(DESTDIR)$(prefix)/Mailman", ddir="$(prefix)/Mailman")'

Changed in mailman:
assignee: nobody → Mark Sapiro (msapiro)
importance: Undecided → Low
milestone: none → 2.1.17
status: New → Confirmed
Revision history for this message
Matthias Andree (matthias-andree) wrote : Re: [Bug 1241770] Re: PATCH: Installation with DESTDIR leaves DESTDIR/ prefixes in .pyc files

Mark,

Thanks for the prompt response. No, there is no special reason, I
simply have not explored alternative solutions once I had one that worked.

Your proposed solution works for me, too (tested with Python 2.7.5 on
FreeBSD 9.2-amd64).

Best regards
Matthias Andree

Mark Sapiro (msapiro)
Changed in mailman:
status: Confirmed → Fix Committed
Revision history for this message
Matthias Andree (matthias-andree) wrote :

Excellent, thank you.

Mark Sapiro (msapiro)
Changed in mailman:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers