Why is an egg-info file created when I'm using distutils?

孤街浪徒 提交于 2019-12-12 19:08:19

问题


Below is my setup.py. I don't use anything from setuptools in my code and my project has no external dependencies

#!/usr/bin/env python

from distutils.core import setup

setup(name='dots',
        ...
        packages=['dots','dots.configs','dots.management','dots.utils','dots.test'],
        scripts=['dots/dots.py']
        )

When I run python setup.py install, I get the following

running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
changing mode of /Users/kevinlin/.virtualenvs/p-dots/bin/dots.py to 755
running install_egg_info                                                                                <- why?
Removing /Users/kevinlin/.virtualenvs/p-dots/lib/python2.7/site-packages/dots-0.1-py2.7.egg-info
Writing /Users/kevinlin/.virtualenvs/p-dots/lib/python2.7/site-packages/dots-0.1-py2.7.egg-info
(p-dots)Kevins-MacBook-Pro-2% python setup.py install
running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
changing mode of /Users/kevinlin/.virtualenvs/p-dots/bin/dots.py to 755
running install_egg_info
Removing /Users/kevinlin/.virtualenvs/p-dots/lib/python2.7/site-packages/dots-0.1-py2.7.egg-info
Writing /Users/kevinlin/.virtualenvs/p-dots/lib/python2.7/site-packages/dots-0.1-py2.7.egg-info

I notice that an .egg-info file is installed

ls -dl /Users/kevinlin/.virtualenvs/p-dots/lib/python2.7/site-packages/dots*
drwxr-xr-x  10 kevinlin  staff  340 May  4 11:36 /Users/kevinlin/.virtualenvs/p-dots/lib/python2.7/site-packages/dots
-rw-r--r--   1 kevinlin  staff  205 May  4 11:36 /Users/kevinlin/.virtualenvs/p-dots/lib/python2.7/site-packages/dots-0.1-py2.7.egg-info

Why?


回答1:


There was discussion about adding setuptools to the stdlib for Python 2.5, and then about adding only pkg_resource (one part of setuptools). Various reasons made that not happen. The core devs recognized that setuptools was an important third-party tool, and accepted a change to make projects installed with a pure-distutils setup.py write this egg-info file, to enable setuptools and tools built on top of it to know that these projects are already installed.

Changeset: http://hg.python.org/cpython/rev/93344da76acd

Ticket: http://bugs.python.org/issue1459476

(I haven’t checked the dates of the 2.5 discussions about setuptools, so my first sentences may be wrong. The rationale is still valid, see the ticket.)



来源:https://stackoverflow.com/questions/23460191/why-is-an-egg-info-file-created-when-im-using-distutils

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!