From 01e08c9c10cf5fdf898bcc413c770e76839b7e6e 2024-08-20 07:33:17 From: M Bussonnier Date: 2024-08-20 07:33:17 Subject: [PATCH] Apply suggestions from code review Co-authored-by: James Beith --- diff --git a/IPython/core/profiledir.py b/IPython/core/profiledir.py index 95bc59f..a1b94f2 100644 --- a/IPython/core/profiledir.py +++ b/IPython/core/profiledir.py @@ -76,7 +76,7 @@ class ProfileDir(LoggingConfigurable): This is a version of os.mkdir, with the following differences: - - returns wether the directory has been created or not. + - returns whether the directory has been created or not. - ignores EEXIST, protecting against race conditions where the dir may have been created in between the check and the creation @@ -130,15 +130,15 @@ class ProfileDir(LoggingConfigurable): get_ipython_package_dir(), "core", "profile", "README_STARTUP" ) - if not os.path.exists(src): + if os.path.exists(src): + if not os.path.exists(readme): + shutil.copy(src, readme) + else: self.log.warning( "Could not copy README_STARTUP to startup dir. Source file %s does not exist.", src, ) - if os.path.exists(src) and not os.path.exists(readme): - shutil.copy(src, readme) - @observe('security_dir') def check_security_dir(self, change=None): self._mkdir(self.security_dir, 0o40700)