Bug 118301 - [patch] devel/py-setuptools easy-install.pth contents lost on upgrade clobbering ports using it
[patch] devel/py-setuptools easy-install.pth contents lost on upgrade clobber...
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: freebsd-python
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-28 08:30 UTC by douglas
Modified: 2013-08-11 12:41 UTC (History)
0 users

See Also:


Attachments
pr_118301_devel_py-setuptools.patch (2.40 KB, patch)
2012-02-24 16:43 UTC, scheidell
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description douglas 2007-11-28 08:30:01 UTC
The file PREFIX/lib/python2.5/site-packages/easy-install.pth which tells Python what egg files to look in for libraries installed with the Easy Install system is not maintained across upgrading the devel/py-setuptools port. This means that after an upgrade importing libraries which where installed with the Easy Install system will fail.

Fix: 

The current workaround is to reinstall all of the ports which use the Easy Install system.
How-To-Repeat: Upgrade devel/py-setuptools.
Run Python and try to import a library installed with Easy Install (for example devel/py-pytz):
    [douglas@slowhand:~]$ python
    Python 2.5.1 (r251:54863, Nov 10 2007, 23:43:31)
    [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pytz
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named pytz
    >>>
Comment 1 Edwin Groothuis freebsd_committer 2007-11-28 08:30:11 UTC
Responsible Changed
From-To: freebsd-ports-bugs->python

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Mark Linimon freebsd_committer 2007-12-03 11:19:15 UTC
Responsible Changed
From-To: python->freebsd-python

Canonicalize assignment.
Comment 3 lars.eggert 2008-10-16 09:48:21 UTC
Just got bit by this bug, too. Annoying.
Comment 4 vivanov 2008-10-20 15:59:32 UTC
I just hit the same thing and it fried all our Trac sites .. very unpleasant
Somewhat quicker workaround - edit 
/usr/local/lib/pythonX.X/easy-install.pth and add the names of all 
directories under /usr/local/lib/pythonX.X/, that end in .egg

For our setup after update easy-install.pth contains:
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c9-py2.5.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; 
p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = 
p+len(new)

should be:
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c9-py2.5.egg
./Trac-0.11.1-py2.5.egg
./Genshi-0.5.1-py2.5-freebsd-7.0-STABLE-amd64.egg
./Pygments-0.11.1-py2.5.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; 
p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = 
p+len(new)
Comment 5 vivanov 2009-12-04 15:05:42 UTC
Being just bitten by this again, I see it is not fixed yet.

A plain

cd /usr/local/lib/pythonX.X/
awk '\!/setuptools/ {print $0}; /setuptools/ { system("ls -ld *.egg | 
awk '"'"'{ print \"./\"$9 }'"'"'") }' easy-install.pth > temp_file
mv temp_file easy-install.pth

does the job, but I think the proper solution for the port would be to 
simply copy the easy-install.pth file before updating and restore it 
afterwards, because if you have installed some .egg's by some other 
means, you will be doubling their declarations by generating the file in 
this way.


I can't expect that I will remember to copy the file next time we have 
setuptools update, so I thought - prepare yourself, save the awk script 
in the PR. Seems I remembered the place, not the details anyway.
Comment 6 Nicola Vitale freebsd_committer 2011-03-08 15:05:30 UTC
Hi,

> [2007/11/28 Douglas William Thrift <douglas@douglasthrift.net>]
>>Synopsis: =A0 =A0 =A0 devel/py-setuptools easy-install.pth contents lost =
on upgrade clobbering ports using it

The following patch should solve the issue:

http://people.freebsd.org/~nivit/diffs/py-setuptools.txt

--=20
Nicola Vitale
Comment 7 douglas 2011-03-08 16:44:51 UTC
On 3/8/2011 7:05 AM, Nicola Vitale wrote:
> Hi,
> 
>> [2007/11/28 Douglas William Thrift <douglas@douglasthrift.net>]
>>> Synopsis:       devel/py-setuptools easy-install.pth contents lost on upgrade clobbering ports using it
> 
> The following patch should solve the issue:
> 
> http://people.freebsd.org/~nivit/diffs/py-setuptools.txt
> 

Awesome! The patch looks good to me, and it makes me think: "why didn't
I think of that?"

Thanks!
-- 
Douglas William Thrift
<douglas@douglasthrift.net>
<http://douglasthrift.net/>
Comment 8 michael.scheidell 2012-01-02 15:14:33 UTC
is this still open?

2007?  patch added in March 2011 by nivit@FreeBSD.org
?

patch applies cleanly, portlint -C is happy.

any reason this should NOT be committed?


-- 
Michael Scheidell, CTO
o: 561-999-5000
d: 561-948-2259
 >*| *SECNAP Network Security Corporation

    * Best Mobile Solutions Product of 2011
    * Best Intrusion Prevention Product
    * Hot Company Finalist 2011
    * Best Email Security Product
    * Certified SNORT Integrator


______________________________________________________________________
This email has been scanned and certified safe by SpammerTrap(r). 
For Information please see http://www.spammertrap.com/
______________________________________________________________________  
  
Comment 9 scheidell freebsd_committer 2012-01-06 15:23:48 UTC
State Changed
From-To: open->feedback
Comment 10 scheidell freebsd_committer 2012-01-06 16:36:09 UTC
State Changed
From-To: feedback->closed

Committed
Comment 11 dfilter freebsd_committer 2012-01-06 16:36:12 UTC
scheidell    2012-01-06 16:36:03 UTC

  FreeBSD ports repository

  Modified files:
    devel/py-setuptools  Makefile pkg-plist 
  Added files:
    devel/py-setuptools/files pkg-install.in 
  Log:
  - Fixes: easy-install.pth contents lost on upgrade clobbering ports using it
  
  PR:             ports/118301
  Submitted by:   Douglas William Thrift <douglas@douglasthrift.net>
  Approved by:    lars.eggert@nokia.com (maintainer, timeout 3 years), gabor (mentor)
  
  Revision  Changes    Path
  1.23      +11 -1     ports/devel/py-setuptools/Makefile
  1.1       +24 -0     ports/devel/py-setuptools/files/pkg-install.in (new)
  1.12      +4 -2      ports/devel/py-setuptools/pkg-plist
_______________________________________________
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 12 scheidell freebsd_committer 2012-02-22 13:22:46 UTC
State Changed
From-To: closed->suspended

Reopening pr, set to suspended.  This will need more thought.
Comment 13 scheidell freebsd_committer 2012-02-24 16:43:23 UTC
As promissed, attached is a patch to back out portrevision 3, or, most specifically, leave it as an option knob, default 
off.

It packages just fine, with and without:

http://people.freebsd.org/~scheidell/py27-setuptools-0.6c11_4.WITHOUT.log  (the default, just like it did before 
portrevision 3)

and, with: (with option knob set)

by looking at Makefile, and pkg-plist changes, I think I correctly wrapped !defines() around all the changed things.

(note: this sat for 3 years.  python@ got 'open pr' emails, once a week, so, speak up now, or forever hold your peace. or 
nra members, your piece)

I can tell you this packages, both ways, leaves no left overs, but I can't tell you if it solves the original problem with 
the knob, or the problem created with revision 3.  But I can tell you, it looks like this attached patch reverses revision 
3.

Please, if you have any stake in this, test it, or, in when this gets committed, don't complain.
-- 
Michael Scheidell, CTO
SECNAP Network Security Corporation
http://people.freebsd.org/~scheidell

______________________________________________________________________
This email has been scanned and certified safe by SpammerTrap(r). 
For Information please see http://www.spammertrap.com/
______________________________________________________________________  
  
Comment 14 douglaswth 2012-02-24 18:18:05 UTC
On Fri, Feb 24, 2012 at 8:43 AM, Michael Scheidell
<scheidell@freebsd.org> wrote:
> As promissed, attached is a patch to back out portrevision 3, or, most sp=
ecifically, leave it as an option knob, default
> off.
>
> It packages just fine, with and without:
>
> http://people.freebsd.org/~scheidell/py27-setuptools-0.6c11_4.WITHOUT.log=
 =C2=A0(the default, just like it did before
> portrevision 3)
>
> and, with: (with option knob set)
>
> by looking at Makefile, and pkg-plist changes, I think I correctly wrappe=
d !defines() around all the changed things.
>
> (note: this sat for 3 years. =C2=A0python@ got 'open pr' emails, once a w=
eek, so, speak up now, or forever hold your peace. or
> nra members, your piece)
>
> I can tell you this packages, both ways, leaves no left overs, but I can'=
t tell you if it solves the original problem with
> the knob, or the problem created with revision 3. =C2=A0But I can tell yo=
u, it looks like this attached patch reverses revision
> 3.
>
> Please, if you have any stake in this, test it, or, in when this gets com=
mitted, don't complain.
> --
> Michael Scheidell, CTO
> SECNAP Network Security Corporation
> http://people.freebsd.org/~scheidell
>
> ______________________________________________________________________
> This email has been scanned and certified safe by SpammerTrap(r).
> For Information please see http://www.spammertrap.com/
> ______________________________________________________________________
>
>
> _______________________________________________
> freebsd-python@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-python
> To unsubscribe, send any mail to "freebsd-python-unsubscribe@freebsd.org"
>

Hello,

What was the issue with portrevision 3? Also the name and description
of the new knob do not make sense. What the knob enables is preserving
the contents of the easy-install.pth file which specifies what
packages are installed; easy-install itself is core functionality of
setuptools that is not affected by the knob.

It really seems unacceptable that upgrading setuptools pretty much
clobbers dependent ports. When other things like libraries are
upgraded in this fashion there is usually a notice in UPDATING or the
portrevision of dependent ports is bumped.  I don't think having a
knob makes any sense. Either fix whatever problem there is with what
the preservation patch did or back it out and make sure whoever
upgrades setuptools puts notices in UPDATING or bumps portrevisions.

Thanks!
--=20
Douglas William Thrift
<douglaswth@gmail.com>
<http://douglasthrift.net/>
Comment 15 vivanov 2012-02-26 19:50:32 UTC
On 2012-02-24 20:18, Douglas Thrift wrote:
>
> ...
>
> What was the issue with portrevision 3?

+1

> Also the name and description
> of the new knob do not make sense. What the knob enables is 
> preserving
> the contents of the easy-install.pth file which specifies what
> packages are installed; easy-install itself is core functionality of
> setuptools that is not affected by the knob.

+1


Also I would add that setuptools is already superseded by distribute
(devel/py-distribute). It does contain the same solution as
py-setuptools_3. If there is a problem with it, may be a PR regarding
that port is in order, though IMHO it works fine.

Regards,
Velko Ivanov
Comment 16 Li-Wen Hsu freebsd_committer 2013-08-11 12:41:05 UTC
State Changed
From-To: suspended->closed

We have moved to devel/py-distribute and the fix is integrated.  Please 
report if there is any other issues.