mirror of https://github.com/pyodide/pyodide.git
added tzdata package (#4697)
For zoneinfo to work, we need the tzdata package. This PR does that.
This commit is contained in:
parent
ed9428e268
commit
f696930e63
|
@ -0,0 +1,17 @@
|
|||
diff --git a/Lib/zoneinfo/_common.pyold b/Lib/zoneinfo/_common.py
|
||||
index 98cdfe37..75f8fd2b 100644
|
||||
--- a/Lib/zoneinfo/_common.py
|
||||
+++ b/Lib/zoneinfo/_common.py
|
||||
@@ -11,6 +11,12 @@ def load_tzdata(key):
|
||||
try:
|
||||
return resources.files(package_name).joinpath(resource_name).open("rb")
|
||||
except (ImportError, FileNotFoundError, UnicodeEncodeError):
|
||||
+ import sys
|
||||
+ if "tzdata" not in sys.modules:
|
||||
+ raise ZoneInfoNotFoundError(
|
||||
+ f"No time zone found with key {key}. \n"
|
||||
+ " On Pyodide you must do pyodide.loadPackage('tzdata')"
|
||||
+ " package before you use zoneinfo.")
|
||||
# There are three types of exception that can be raised that all amount
|
||||
# to "we cannot find this key":
|
||||
#
|
|
@ -46,6 +46,9 @@ Instead, it is better to load individual modules as needed using
|
|||
Pyodide includes some method stubs based on browser APIs:
|
||||
`webbrowser.open()`, `webbrowser.open_new()`, `webbrowser.open_new_tab()`.
|
||||
|
||||
- zoneinfo: The zoneinfo package will only work if you install the timezone data using
|
||||
the tzdata package (i.e. by calling `pyodide.loadPackage("tzdata")`)
|
||||
|
||||
### Synchronous HTTP requests support
|
||||
|
||||
Packages for `urllib3` and `requests` are included in pyodide. In browser, these
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package:
|
||||
name: tzdata
|
||||
version: "2024.1"
|
||||
top-level:
|
||||
- tzdata
|
||||
source:
|
||||
url: https://files.pythonhosted.org/packages/65/58/f9c9e6be752e9fcb8b6a0ee9fb87e6e7a1f6bcab2cdc73f02bb7ba91ada0/tzdata-2024.1-py2.py3-none-any.whl
|
||||
sha256: 9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252
|
||||
about:
|
||||
home: https://github.com/python/tzdata
|
||||
PyPI: https://pypi.org/project/tzdata
|
||||
summary: Provider of IANA time zone data
|
||||
license: Apache-2.0
|
Loading…
Reference in New Issue