1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-22 15:39:07 +00:00

Set modification time via os.utime

Hopefully quicker on Windows
This commit is contained in:
Thom Wiggers 2019-03-05 15:45:09 +01:00
parent fe1ba0e615
commit e450cd6042
No known key found for this signature in database
GPG Key ID: 001BB0A7CE26E363

View File

@ -24,20 +24,9 @@ def test_makefile_dependencies():
def touch(time, *files):
if not files:
raise Exception("Please specify the files to update")
if os.name == 'nt':
formatstring = "Get-Date -year %Y -month %m -day %d -hour %H -minute %M -second %S"
time = time.strftime(formatstring)
commands = []
for file in files:
commands.append('(ls {}).LastWriteTime = {}'.format(file, time))
helpers.run_subprocess(['powershell', '; '.join(commands)])
else:
formatstring = "%Y%m%d%H%M.%S"
time = time.strftime(formatstring)
helpers.run_subprocess(['touch', '-t', time, *files])
for path in files:
times = (time.timestamp(), time.timestamp())
os.utime(path, times)
def make_check(path, expect_error=False):