Reputation: 1016
I installed a python package My-App
with python setup.py install
and an egg directory My_App-0.2a40-py3.9-linux-x86_64.egg
is created under my site-packages
.
I looked up setuptools docs and source code and some PEPs trying to figure out how the egg dir name My_App-0.2a40-py3.9-linux-x86_64.egg
is generated, but I didn't find anything relavent.
So how is the python egg dir name like My_App-0.2a40-py3.9-linux-x86_64.egg
generated?
My-App
package name in the setup.py
get converted to My_App
in the dir name?py3.9-linux-x86_64
looks like a platform tag, but not exactly - it doesn't contain cp39
etc. I want to know how this is generated.Upvotes: 0
Views: 141
Reputation: 1016
The doc https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html points out the functions used to construct the egg dir name.
The “name” and “version” should be escaped using the to_filename() function provided by pkg_resources, after first processing them with safe_name() and safe_version() respectively. These latter two functions can also be used to later “unescape” these parts of the filename. (For a detailed description of these transformations, please see the “Parsing Utilities” section of the pkg_resources manual.)
The “pyver” string is the Python major version, as found in the first 3 characters of sys.version. “required_platform” is essentially a distutils get_platform() string, but with enhancements to properly distinguish Mac OS versions. (See the get_build_platform() documentation in the “Platform Utilities” section of the pkg_resources manual for more details.)
Finally, the “ext” is either .egg or .egg-info, as appropriate for the egg’s format.
Upvotes: 1