Skip to content

Installing files should NOT preserve timestamps #118

@jdemeyer

Description

@jdemeyer

This issue is meant as a pointer to python/cpython#76954 so please discuss it there.

When a Python project is installed, distutils (which is also used by other tools like pip) copies the files from the build to install directory using the copy_file() function. In this copy operation, timestamps are preserved. In other words, the timestamp of the installed file equals the timestamp of the source file.

By contrast, autotools does not preserve timestamps: the timestamp of the installed files equals the time of installation. This makes more sense because of dependency checking: if you reinstall a package, you typically want to rebuild everything depending on that package.

This issue is particularly relevant for installing .h files: most build systems (including distutils itself) provide a way to recompile C/C++ source files if they depend on a changed header file. But that only works if the timestamp of the header is updated when it is installed.

Note that distutils/command/build_py.py contains a comment

        # XXX copy_file by default preserves atime and mtime.  IMHO this is
        # the right thing to do, but perhaps it should be an option -- in
        # particular, a site administrator might want installed files to
        # reflect the time of installation rather than the last
        # modification time before the installed release.

but without any justification.

In my opinion, there should not be an option. The current behaviour is simply wrong and should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions