summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2023-01-23 23:01:08 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2023-01-24 01:14:44 +0000
commitcbd0cb7d36689598c8cd69f06411b2785065f914 (patch)
tree6d217c7977b333002db9eedf58080f0d8c465366 /setuptools
parentea6df151a0e32013dc4a82bc45ab9355842146fa (diff)
downloadpython-setuptools-git-cbd0cb7d36689598c8cd69f06411b2785065f914.tar.gz
Prefer alternative from egg_info.py to pkg_resources.Distribution.egg_name
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/command/bdist_egg.py15
-rw-r--r--setuptools/command/install_egg_info.py5
-rw-r--r--setuptools/wheel.py9
3 files changed, 13 insertions, 16 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index 11a1c6be..33f483cf 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -11,7 +11,6 @@ import re
import textwrap
import marshal
-from pkg_resources import get_build_platform, Distribution
from setuptools.extension import Library
from setuptools import Command
from .._path import ensure_directory
@@ -64,7 +63,7 @@ class bdist_egg(Command):
('bdist-dir=', 'b',
"temporary directory for creating the distribution"),
('plat-name=', 'p', "platform name to embed in generated filenames "
- "(default: %s)" % get_build_platform()),
+ "(by default uses `pkg_resources.get_build_platform()`)"),
('exclude-source-files', None,
"remove all .py files from the generated egg"),
('keep-temp', 'k',
@@ -98,18 +97,18 @@ class bdist_egg(Command):
self.bdist_dir = os.path.join(bdist_base, 'egg')
if self.plat_name is None:
+ from pkg_resources import get_build_platform
+
self.plat_name = get_build_platform()
self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))
if self.egg_output is None:
-
# Compute filename of the output egg
- basename = Distribution(
- None, None, ei_cmd.egg_name, ei_cmd.egg_version,
- get_python_version(),
- self.distribution.has_ext_modules() and self.plat_name
- ).egg_name()
+ basename = ei_cmd._get_egg_basename(
+ py_version=get_python_version(),
+ platform=self.distribution.has_ext_modules() and self.plat_name,
+ )
self.egg_output = os.path.join(self.dist_dir, basename + '.egg')
diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py
index 65ede406..1c549c98 100644
--- a/setuptools/command/install_egg_info.py
+++ b/setuptools/command/install_egg_info.py
@@ -5,7 +5,6 @@ from setuptools import Command
from setuptools import namespaces
from setuptools.archive_util import unpack_archive
from .._path import ensure_directory
-import pkg_resources
class install_egg_info(namespaces.Installer, Command):
@@ -24,9 +23,7 @@ class install_egg_info(namespaces.Installer, Command):
self.set_undefined_options('install_lib',
('install_dir', 'install_dir'))
ei_cmd = self.get_finalized_command("egg_info")
- basename = pkg_resources.Distribution(
- None, None, ei_cmd.egg_name, ei_cmd.egg_version
- ).egg_name() + '.egg-info'
+ basename = f"{ei_cmd._get_egg_basename()}.egg-info"
self.source = ei_cmd.egg_info
self.target = os.path.join(self.install_dir, basename)
self.outputs = []
diff --git a/setuptools/wheel.py b/setuptools/wheel.py
index 527ed3b2..53ce27e1 100644
--- a/setuptools/wheel.py
+++ b/setuptools/wheel.py
@@ -15,7 +15,7 @@ import setuptools
from pkg_resources import parse_version
from setuptools.extern.packaging.tags import sys_tags
from setuptools.extern.packaging.utils import canonicalize_name
-from setuptools.command.egg_info import write_requirements
+from setuptools.command.egg_info import write_requirements, _egg_basename
from setuptools.archive_util import _unpack_zipfile_obj
@@ -89,10 +89,11 @@ class Wheel:
return next((True for t in self.tags() if t in supported_tags), False)
def egg_name(self):
- return pkg_resources.Distribution(
- project_name=self.project_name, version=self.version,
+ return _egg_basename(
+ self.project_name,
+ self.version,
platform=(None if self.platform == 'any' else get_platform()),
- ).egg_name() + '.egg'
+ ) + ".egg"
def get_dist_info(self, zf):
# find the correct name of the .dist-info dir in the wheel file