| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
import os |
| 10 |
|
| 11 |
import rsyncfns |
| 12 |
from rsyncfns import FROMDIR, TODIR, checkit, run_rsync, test_skipped |
| 13 |
|
| 14 |
|
| 15 |
vv = run_rsync('-VV', check=True, capture_output=True) |
| 16 |
if '"atimes": true' not in vv.stdout: |
| 17 |
test_skipped("Rsync is configured without atimes support") |
| 18 |
|
| 19 |
FROMDIR.mkdir(parents=True, exist_ok=True) |
| 20 |
foo = FROMDIR / 'foo' |
| 21 |
foo.touch() |
| 22 |
|
| 23 |
|
| 24 |
import datetime |
| 25 |
atime = datetime.datetime(2001, 2, 3, 17, 17, 42).timestamp() |
| 26 |
mtime = foo.stat().st_mtime |
| 27 |
os.utime(foo, (atime, mtime)) |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
rsyncfns.TLS_ARGS = '--atimes' |
| 32 |
|
| 33 |
checkit(['-rtUgvvv', f'{FROMDIR}/', f'{TODIR}/'], FROMDIR, TODIR) |