Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Oct 2012 16:01:39 +0300
From:      Volodymyr Kostyrko <c.kworr@gmail.com>
To:        Ruslan Mahmatkhanov <cvs-src@yandex.ru>
Cc:        freebsd-python@FreeBSD.org
Subject:   Re: py-distribute update leftover
Message-ID:  <506C3733.7000903@gmail.com>
In-Reply-To: <506C2B80.70204@yandex.ru>
References:  <506C1F7F.9020405@gmail.com> <506C2B80.70204@yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
03.10.2012 15:11, Ruslan Mahmatkhanov wrote:
>> Recent py-ditribute update doesn't update easy_install.pth on python2.7:
>>
>> ===>>> The following actions were performed:
>>          Re-installation of py27-distribute-0.6.28
>>
>> # cd /usr/local/lib/python2.7/site-packages/
>> # cat easy-install.pth
>> import sys; sys.__plen = len(sys.path)
>> ./distribute-0.6.27-py2.7.egg
>> ./Pyrseas-0.5.0-py2.7.egg
>> ./Babel-0.9.6-py2.7.egg
>> ./Genshi-0.6-py2.7.egg
>> ./Pygments-1.5-py2.7.egg
>> ./Trac-0.12.3-py2.7.egg
>> ./hg_git-0.3.3-py2.7.egg
>> ./graphviz-0.7.4-py2.7.egg
>> ./TracTocMacro-11.0.0.3-py2.7.egg
>> ./pytz-2012f-py2.7.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)
>>
>> And a new file was created:
>>
>> # cat easy-install.pth.dist
>> import sys; sys.__plen = len(sys.path)
>> ./distribute-0.6.28-py2.7.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)
>
> It's in pkg-plist logic:
> """
> %%PYTHON_SITELIBDIR%%/easy-install.pth.dist
> @exec if [ ! -f %B/easy-install.pth ]; then cp %B/%f
> %B/easy-install.pth; fi
> """
>
> easy-install.pth.dist is always installed, and it will be only copied to
> easy-install.pth if there is no one already.
>
> What about easy-install.pth contents is not updated - I need an testing
> environment. Would you describe the steps you did to stick with
> distribute instead of setuptools and I'll try to reproduce?

I patched bsd.python.mk like this:
@@ -431,7 +431,7 @@

  # setuptools support
  .if defined(USE_PYDISTUTILS) && ${USE_PYDISTUTILS} == "easy_install"
-.if ${PYTHON_SUFFIX} < 30
+.if ${PYTHON_SUFFIX} < 30 && !defined(USE_DISTRIBUTE)
  BUILD_DEPENDS+= 
${PYEASYINSTALL_CMD}:${PORTSDIR}/devel/py-setuptools
  RUN_DEPENDS+= 
${PYEASYINSTALL_CMD}:${PORTSDIR}/devel/py-setuptools
  .else

And USE_DISTRIBUTE is mentioned in environment. I needed this as one of 
the listed packages, Pyrseas, refuses to work with setuptools. I haven't 
submitted it yet but it can be found on redports: 
https://redports.org/browser/kworr/databases/py-Pyrseas

Minimal proof would be hg-git. I just rechecked the steps to reproduce this:

0. Cleaning up (dunno what that thing about easy_install means, it can 
be irrelevant):

# pkg_delete py27-distribute-0.6.28 py27-hg-git-0.3.3
pkg_delete: file '/usr/local/bin/easy_install' doesn't exist
pkg_delete: couldn't entirely delete package `py27-distribute-0.6.28'
(perhaps the packing list is incorrectly specified?)
# cat /usr/local/lib/python2.7/site-packages/easy-install.pth
import sys; sys.__plen = len(sys.path)
./distribute-0.6.27-py2.7.egg
./hg_git-0.3.3-py2.7.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)
# rm /usr/local/lib/python2.7/site-packages/easy-install.pth
# ls /usr/local/lib/python2.7/site-packages | cat
README
drv_libxml2.py
drv_libxml2.pyc
drv_libxml2.pyo
dulwich
dulwich-0.8.5-py2.7.egg-info
easy-install.pth
hgext
libxml2.py
libxml2.pyc
libxml2.pyo
libxml2mod.a
libxml2mod.la
libxml2mod.so
mercurial
mercurial-2.3-py2.7.egg-info
xcbgen

1. Install older py-distribute:

# cd /usr/ports/devel/py-distribute
# svn up -r301510
# make install clean

2. Install hg-git:

# cd /usr/ports/devel/hg-git
# make install clean

3. Update py-distribute:

# cd /usr/ports/devel/py-distribute
# svn up
# make deinstall reinstall clean
.....
/bin/cp /usr/local/lib/python2.7/site-packages/easy-install.pth 
/usr/local/lib/python2.7/site-packages/easy-install.pth.dist
PKG_PREFIX=/usr/local /bin/sh 
/tmp/ports/usr/ports/devel/py-distribute/work/pkg-install 
py27-distribute-0.6.28 POST-INSTALL
if [ -f /usr/ports/devel/py-distribute/pkg-message ]; then /bin/cat 
/usr/ports/devel/py-distribute/pkg-message; fi
===>   Registering installation for py27-distribute-0.6.28

Voila: we have easy-install.pth:

import sys; sys.__plen = len(sys.path)
./distribute-0.6.27-py2.7.egg
./hg_git-0.3.3-py2.7.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)

And easy-install.pth.dist:

import sys; sys.__plen = len(sys.path)
./distribute-0.6.28-py2.7.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)

PS: I'm also using unegg patch.

PPS: This is the only bad thing in switching to py-distribute - 
everything else works: trac, viewvc, others...

-- 
Sphinx of black quartz, judge my vow.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?506C3733.7000903>