Page 1 of 1
[RESOLVED] Changing the date of copied files
Published: January 28, 2022 - 4:38 PM
by Erousseau
Hello,
I'm trying to create a package for installing a "portable" software application (internal development).
However, when installing files (using CopyTree2), the modification date of these files changes to the installation date.
I find this annoying (especially for EXEs, DLLs, etc.). Is there a way to prevent this?
Thanks,
Etienne
- WAPT version installed: 2.1.2
- Server OS: Linux
- Administration/package creation machine OS: Windows 10
Re: Changing the date of copied files
Published: February 1, 2022 - 3:32 PM
by dcardon
Hi Etienne,
indeed, Python's Zip library doesn't restore timestamps; it's a bug/limitation/feature of Python.
That said, the data is present in the archive, and the API is available to retrieve the timestamp from the zip file. So we should be able to do something, but it needs to be done at the time of unzipping. However, this implies accessing the unzipped files twice, so we need to consider the impact.
For now, you can correct the timestamps with the Python function `os.utime(...)`, noting the timestamps you need to restore.
I'll create an internal ticket before zipping.
Best regards,
Denis Cardon
Re: Changing the date of copied files
Published: February 2, 2022 - 12:44 PM
by Erousseau
Hello Denis,
Thank you for your reply.
It seems to me that, in most cases, when you unzip a file, you expect the modification date to remain unchanged. The way Python's Zip library works seems strange to me...
If it were possible to do something similar in WAPT, that would be fantastic!
In the meantime, is there a way to read the WAPT archive during installation (from the "install" procedure) to retrieve the file dates?
Etienne
Re: Changing the date of copied files
Published: February 3, 2022 - 10:37 AM
by dcardon
Hello Etienne,
erousseau wrote: ↑Feb 2, 2022 - 12:44
It seems to me that, in most cases, when you unzip a file, you expect the modification date to remain unchanged. The way Python's Zip library works seems strange to me...
Yes, I admit that I also found it quite curious.
erousseau wrote: ↑Feb 2, 2022 - 12:44
If it were possible to do something in WAPT, that would be fantastic!
The ticket has been submitted, but it probably won't be included in the upcoming version 2.2, which should be released very soon. We'll have to wait for version 2.3.
erousseau wrote: ↑Feb 2, 2022 - 12:44
In the meantime, is there a way to read the WAPT archive at the time of installation (from the "install" procedure) to retrieve the file dates?
If I remember correctly, the package is only removed from the WAPT cache once it's properly installed. You should therefore be able to find it in $WAPT_HOME\cache (please verify).
Denis
Re: Changing the date of copied files
Published: February 4, 2022 - 11:11 AM
by Erousseau
Hello Denis,
Thank you for your replies.
While waiting for version 2.3 (which would simplify things considerably), I'll try to retrieve the dates from the archive; otherwise, I'll create an installer for my application (in addition to the WAPT package).
Etienne