From a76586c2fbce12466c62c71dc2a79135926bef86 Mon Sep 17 00:00:00 2001 From: Matt Bogosian Date: Thu, 14 Sep 2023 15:23:56 -0500 Subject: [PATCH] Import bundled `packaging` after path munging (#151) When using the bundled strategy and a vanilla system-wide interpreter (e.g., `/usr/bin/python3`) with `v2023.3.12551007`, `lsp_server.py` would die when attempting to import `packaging`. This is because the import was attempted before any `useBundled`-related path munging was made. This commit corrects for that. Fixes #148. --- bundled/tool/lsp_server.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index e9d8d78..94265b3 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -15,9 +15,6 @@ from dataclasses import dataclass from typing import Any, Dict, List, Optional, Sequence -from packaging.version import Version -from packaging.version import parse as parse_version - # ********************************************************** # Update sys.path before importing any bundled libraries. @@ -46,6 +43,8 @@ def update_sys_path(path_to_add: str, strategy: str) -> None: # ********************************************************** import lsp_utils as utils import lsprotocol.types as lsp +from packaging.version import Version +from packaging.version import parse as parse_version from pygls import server, uris, workspace WORKSPACE_SETTINGS = {}