Fixed utils/build-dists.py which was broken by 49ae7c7 (#316)

* Fixed utils/build-dists.py which was broken by 49ae7c7
Previously the async helpers imported AsyncOpenSearch and therefore failed to import anytime it did

Signed-off-by: Roger Aiudi <aiudirog@gmail.com>

* Refactor async helpers try block to a simple if statement

Signed-off-by: Roger Aiudi <aiudirog@gmail.com>

* Remove newline to pass black

Signed-off-by: Roger Aiudi <aiudirog@gmail.com>

---------

Signed-off-by: Roger Aiudi <aiudirog@gmail.com>
This commit is contained in:
aiudirog
2023-03-08 17:34:43 -08:00
committed by GitHub
parent 4f66eb8ab9
commit f1f73e7ff2
2 changed files with 4 additions and 8 deletions
+2 -7
View File
@@ -57,11 +57,8 @@ __all__ = [
]
try:
# Asyncio only supported on Python 3.6+
if sys.version_info < (3, 6):
raise ImportError
# Asyncio only supported on Python 3.6+
if sys.version_info >= (3, 6):
from .._async.helpers import (
async_bulk,
async_reindex,
@@ -70,5 +67,3 @@ try:
)
__all__ += ["async_scan", "async_bulk", "async_reindex", "async_streaming_bulk"]
except (ImportError, SyntaxError):
pass
+2 -1
View File
@@ -105,11 +105,12 @@ def test_dist(dist):
f"from {dist_name} import AsyncOpenSearch",
expect_exit_code=256,
)
# Ensure async helpers are available regardless of aiohttp installation
run(
venv_python,
"-c",
f"from {dist_name}.helpers import async_scan, async_bulk, async_streaming_bulk, async_reindex",
expect_exit_code=256,
)
# Install aiohttp and see that async is now available