Python's datetime module is pretty broken when it comes to handling DST
and date offsets; the tests for the chile DST change would fail on
trusty and xenial due to this, even with the corrected tzdata files.
To addrss this, this commit converts the script to use the pytz
(python3-tz) library, as documented at http://pytz.sourceforge.net/.
This gives better, more accurate results for testing.
Signed-off-by: Steve Beattie <email address hidden>
shutil.copytree() only supports the ignore_dangling_symlinks parameter in newer
python versions and so this does not exist on older Ubuntu releases - so far
this is only needed for apparmor-3.0.7 and newer which is only in Ubuntu 22.10
and so we then now only use this parameter in that case. Otherwise fallback to
the code we used to use before 1aa2b80c0917fe8d8a46f929e0cdb9c60cec477b