Hello there,

I have recently encountered the strangeness of ".pth" files, and am
surprised that Debian uses the dynamic code variants too:

cat /usr/lib/python2.7/dist-packages/zope.interface-4.1.1-nspkg.pth
import sys, types, os;p =
os.path.join(sys._getframe(1).f_locals['sitedir'], *('zope',));ie =
os.path.exists(os.path.join(p,'__init__.py'));m = not ie and
sys.modules.setdefault('zope', types.ModuleType('zope'));mp = (m or []) and
m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)

So, this adds a "zope" package, if the "__init__.py" didn't exist. In all
cases that I checked, on Debian they do exist.

However, these .pth files are scanned for, and this code is executed in an
"exec" from "site.py", needlessly.

I checked Debian policy, and these are not forbidden, but since they
increase the cost of nearly every Python program launch , I wonder why that
would be tolerable, removing the files has no impact.

So I would like Debian Jessie+1 to get rid of these. Do you agree, and how
to go about such things. I have no clue what to raise bugs against there.

Yours,
Kay

Reply via email to