classification
Title: packaging.command.Command.copy_file doesn't implement preserve_mode and preserve_times
Type: Stage: resolved
Components: Distutils2, Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: tarek Nosy List: alexis, eric.araujo, tarek, vinay.sajip
Priority: normal Keywords:

Created on 2011-11-03 18:06 by vinay.sajip, last changed 2014-03-13 03:33 by eric.araujo. This issue is now closed.

Messages (3)
msg146957 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-11-03 18:06
The packaging.command.Command.copy_file method does not honour the preserve_mode and preserve_times keyword arguments.

Likewise, packaging.command.Command.copy_tree does not honour the preserve_mode, preserve_times and preserve_symlinks keyword arguments.
msg147476 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-11-12 11:39
Thanks for the report.  Have you found the bug with a real setup.cfg or hook, or were you just reading the code?

I’m not sure how hard to fix this will be.  The copy_file method delegates to shutil.copyfile, but this does not have the arguments we need, contrary to the former distutils file_util.copy_file function.

Currently it’s only build_py that uses this parameter: 

        # if a file is read-only in the working
        # directory, we want it to be installed read/write so that the next
        # installation of the same module distribution can overwrite it
        # without problems.  (This might be a Unix-specific issue.)  Thus
        # we turn off 'preserve_mode' when copying to the build directory,
        # since the build directory is supposed to be exactly what the
        # installation will look like (ie. we preserve mode when
        # installing).

Depending on whether shutil supports what we need, different patches could be made:
- Change code to use the right shutil function
- Add code in copy_file to walk and chmod
- Remove the preserve_* arguments and add another method for build_py
msg147506 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-11-12 15:48
> 

> 
> Éric Araujo <merwok@netwok.org> added the comment:
> 
> Thanks for the report.  Have you found the bug with a real setup.cfg or hook, or 
> were you just reading the code?
> 

I found the bug with a real setup.cfg (executable permission not set IIRC) and tracked it to copy_file. The copy_tree function wasn't used, I was just making an observation from scanning the code.
History
Date User Action Args
2014-03-13 03:33:16eric.araujosetstatus: open -> closed
resolution: out of date
stage: resolved
2011-11-12 15:48:56vinay.sajipsetmessages: + msg147506
2011-11-12 11:39:17eric.araujosetmessages: + msg147476
2011-11-03 18:06:36vinay.sajipcreate