From fb3313fe7fb650c822e9ec89660915b37b7d891e Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarczyk Date: Sat, 26 Nov 2022 13:57:38 +0100 Subject: Catching the exception of utime in order to provide a path to the file that was subject to the utime call; originally, the exception from utime does not point to this filepath. Ref #3667. --- setuptools/command/egg_info.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'setuptools/command/egg_info.py') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 25888ed8..95c81845 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -295,7 +295,11 @@ class egg_info(InfoCommon, Command): def run(self): self.mkpath(self.egg_info) - os.utime(self.egg_info, None) + try: + os.utime(self.egg_info, None) + except OSError as e: + msg = f"Cannot update time stamp of directory '{self.egg_info}'" + raise distutils.errors.DistutilsFileError(msg) from e for ep in metadata.entry_points(group='egg_info.writers'): writer = ep.load() writer(self, ep.name, os.path.join(self.egg_info, ep.name)) -- cgit v1.2.1