diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-04-03 21:02:15 +0100 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-06-15 16:43:45 +0100 |
| commit | 5bb97d0f8b833bec6f6d4c70561b68dc2c559168 (patch) | |
| tree | cc2c8e623383a549f46f4c23306ff37a12b2d4b8 /setuptools/command | |
| parent | 821d664b7a9fe9779061812d540b5cd7a7386f5e (diff) | |
| download | python-setuptools-git-5bb97d0f8b833bec6f6d4c70561b68dc2c559168.tar.gz | |
Remove unecessary editable dependency
Diffstat (limited to 'setuptools/command')
| -rw-r--r-- | setuptools/command/editable_wheel.py | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index c827efa3..94284d55 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -6,12 +6,14 @@ Create a wheel that, when installed, will make the source package 'editable' # TODO doesn't behave when called outside the hook +import base64 import os import time from pathlib import Path from distutils.core import Command from distutils.errors import DistutilsError +from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo import pkg_resources @@ -68,13 +70,7 @@ class editable_wheel(Command): # with the dist-info directory and .pth from 'editables' library # ... - import zipfile - import editables # could we use 'develop' command's .pth file - - project = editables.EditableProject( - self.distribution.metadata.name, self.target - ) - project.add_to_path(self.target) + mtime = time.gmtime(SOURCE_EPOCH_ZIP)[:6] dist_dir = Path(self.dist_dir) dist_info_dir = self.dist_info_dir @@ -89,32 +85,20 @@ class editable_wheel(Command): if wheel_path.exists(): wheel_path.unlink() - with zipfile.ZipFile( - wheel_path, "a", compression=zipfile.ZIP_DEFLATED - ) as archive: - + with ZipFile(wheel_path, "a", compression=ZIP_DEFLATED) as archive: # copy .pth file - for f, data in project.files(): - archive.writestr( - zipfile.ZipInfo(f, time.gmtime(SOURCE_EPOCH_ZIP)[:6]), data - ) + pth = ZipInfo(f"{fullname}_ed.pth", mtime) + archive.writestr(pth, f"{self.target}\n") # copy .dist-info directory for f in sorted(os.listdir(dist_dir / dist_info_dir)): with (dist_dir / dist_info_dir / f).open() as metadata: - archive.writestr( - zipfile.ZipInfo( - str(dist_info_dir / f), time.gmtime(SOURCE_EPOCH_ZIP)[:6] - ), - metadata.read(), - ) + info = ZipInfo(str(dist_info_dir / f), mtime) + archive.writestr(info, metadata.read()) add_manifest(archive, dist_info_dir) -import base64 - - def urlsafe_b64encode(data): """urlsafe_b64encode without padding""" return base64.urlsafe_b64encode(data).rstrip(b"=") |
