-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Append conda tzdata location instead of overriding #1
Comments
$ python -c 'import sys, sysconfig; print(sys.version, sysconfig.get_config_var("TZPATH"), sep="\n")'
3.9.0 | packaged by conda-forge | (default, Oct 14 2020, 22:59:50)
[GCC 7.5.0]
/opt/conda/envs/tmp/share/zoneinfo:/opt/conda/envs/tmp/share/tzinfo |
That isn't intended. |
The duplication is because we have https://github.com/conda-forge/python-feedstock/blob/master/recipe/build_base.sh#L239 as well as https://github.com/conda-forge/python-feedstock/blob/master/recipe/build_base.sh#L444. |
Yep, see conda-forge/python-feedstock#403 |
From what you wrote, I assume you don't want https://github.com/conda-forge/python-feedstock/blob/master/recipe/build_base.sh#L239 but only https://github.com/conda-forge/python-feedstock/blob/master/recipe/build_base.sh#L444 ? |
Yep. My ubuntu only offers |
I think it would be surprising for a user to install the latest I was thinking of refactoring the logic to be: def reset_tzpath(to=None):
global TZPATH
tzpaths = to
if tzpaths is not None:
if isinstance(tzpaths, (str, bytes)):
raise TypeError(
f"tzpaths must be a list or tuple, "
+ f"not {type(tzpaths)}: {tzpaths!r}"
)
if not all(map(os.path.isabs, tzpaths)):
raise ValueError(_get_invalid_paths_message(tzpaths))
base_tzpath = tzpaths
else:
env_var = os.environ.get("PYTHONTZPATH", None)
if env_var is not None:
base_tzpath = _parse_python_tzpath(env_var)
else:
base_tzpath = [os.path.join(sys.base_prefix, "share", "zoneinfo")]
if sys.platform != "win32":
extra_tzpath = [
"/usr/share/zoneinfo",
"/usr/lib/zoneinfo",
"/usr/share/lib/zoneinfo",
"/etc/zoneinfo",
]
extra_tzpath = extra_tzpath.sort(
key=lambda x: not os.path.exists(x)
)
base_tzpath += extra_tzpath
TZPATH = tuple(base_tzpath)
if TZPATH_CALLBACKS:
for callback in TZPATH_CALLBACKS:
callback(TZPATH) Thoughts? |
This matches the behaviour of the zoneinfo module in python 3.9
The text was updated successfully, but these errors were encountered: