Bug 146957

Summary: Mk/bsd.python.mk: PYTHONOPTIMIZE=1 in environ(7) breaks plist
Product: Ports & Packages Reporter: swell.k <swell.k>
Component: Individual Port(s)Assignee: freebsd-python (Nobody) <python>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description swell.k 2010-05-25 09:10:00 UTC

How-To-Repeat: 1. export PYTHONOPTIMIZE=1
2. install any py- port, e.g. textproc/py-chardet
3. make deinstall
===>   Deinstalling py26-chardet-2.0.1
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/__init__.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/big5freq.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/big5prober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/chardistribution.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/charsetgroupprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/charsetprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/codingstatemachine.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/constants.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/escprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/escsm.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/eucjpprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/euckrfreq.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/euckrprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/euctwfreq.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/euctwprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/gb2312freq.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/gb2312prober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/hebrewprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/jisfreq.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/jpcntx.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/langbulgarianmodel.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/langcyrillicmodel.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/langgreekmodel.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/langhebrewmodel.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/langhungarianmodel.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/langthaimodel.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/latin1prober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/mbcharsetprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/mbcsgroupprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/mbcssm.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/sbcharsetprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/sbcsgroupprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/sjisprober.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/test.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/universaldetector.pyc' doesn't exist
pkg_delete: file '/home/holo/aaa/lib/python2.6/site-packages/chardet/utf8prober.pyc' doesn't exist
pkg_delete: couldn't entirely delete package (perhaps the packing list is
incorrectly specified?)
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2010-05-25 09:10:47 UTC
Responsible Changed
From-To: freebsd-ports-bugs->perky

bsd.python.mk is perky territory (via the GNATS Auto Assign Tool)
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-05-25 16:07:19 UTC
Responsible Changed
From-To: perky->freebsd-python

Currently maintained by python mailing list.
Comment 3 wenheping 2010-11-04 13:44:08 UTC
Hi,

    When set PYTHONOPTIMIZE=1, that enable python use the optimize mode,
just as run python with -O args. And when python run with -O args, it compile
.py source file directly to .pyo file but without .pyc file. It will lead to
 the pkg-plist error that you mentioned.

   So it is not a bug in bsd.python.mk.

   Maybe we can resolve it by:
   1) Add a pkg-plist variable PYTHONOPT in bsd.python.mk:
    PLIST_SUB+=      PYTHONOPT=${PYTHONOPT}
   2) set PYTHONOPT='' when PYTHONOPTIMIZE is not defined and
      set it to "@comment" when it is defined.
   3) Add %%PYTHONOPT%% to all lines ended with .pyc in pkg-plist file

   But I do not think it is a good way to resolv it and currently I could not
find a simple way to resolv it. Maybe the best way is just let it be?  :)

wen
Comment 4 olli 2010-11-04 14:17:46 UTC
wen heping <wenheping@gmail.com> wrote:
 > Maybe we can resolve it by:
 > 1) Add a pkg-plist variable PYTHONOPT in bsd.python.mk:
 >    PLIST_SUB+=      PYTHONOPT=${PYTHONOPT}
 > 2) set PYTHONOPT='' when PYTHONOPTIMIZE is not defined and
 >    set it to "@comment" when it is defined.
 > 3) Add %%PYTHONOPT%% to all lines ended with .pyc in pkg-plist file
 >  
 > But I do not think it is a good way to resolv it and currently I could not
 > find a simple way to resolv it. Maybe the best way is just let it be?  :)

Why not simply remove PYTHONOPTIMIZE from the environment
when it is set, or override it to be =""?  Then you will
always get the standard behaviour, i.e. both .pyc and .pyo
will be created, and no change to the plist is necessary.

If you want to make the creation of .pyc and/or .pyo files
configurable, it should be done properly with the OPTIONS
framework, with two settings, for example CREATE_PYC and
CREATE_PYO, which should both default to ON.  But I really
don't think this is required ...  I can't think of a reason
why a user wouldn't want to have both installed.  Disk
space shouldn't be an issue nowadays.  And on restricted
hardware (such as small or embedded systems) you will
probably create a hand-crafted installation anyway, omitting
more than just the .pyc files which account for less than
25% of the size of the package.

Anyawy, my point is that variables from the user's environment
should not accidentally affect the contents of the package.
Therefore I think that the Python ports makefile should unset
or override the PYTHONOPTIMIZE variable.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
        -- Robert Firth
Comment 5 dfilter service freebsd_committer freebsd_triage 2012-06-17 13:28:34 UTC
mva         2012-06-17 12:28:19 UTC

  FreeBSD ports repository

  Modified files:
    Mk                   bsd.python.mk 
  Log:
  - Ensure that PYTHONOPTIMIZE and PYTHONDONTWRITEBYTECODE are ignored on
    using PY_DISTUTILS to avoid plist corruptions
  
  PR:             ports/146957
  Reported by:    swell.k@gmail.com
  On behalf of:   python@
  
  Revision  Changes    Path
  1.147     +2 -2      ports/Mk/bsd.python.mk
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 Marcus von Appen freebsd_committer freebsd_triage 2012-06-17 13:29:54 UTC
State Changed
From-To: open->closed

A fix has been applied. Thanks for noticing!