Skip to content

Commit

Permalink
Backport PR #22709 on branch 6.x (PR: Update installing developer rep…
Browse files Browse the repository at this point in the history
…os to accommodate dist-info) (#22720)
  • Loading branch information
meeseeksmachine authored Oct 24, 2024
1 parent 1e4cd5d commit fb4681c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions install_dev_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@

import argparse
from importlib.metadata import PackageNotFoundError, distribution
import os
import sys
from json import loads
from logging import Formatter, StreamHandler, getLogger
import os
from pathlib import Path
from subprocess import check_output
import sys

from packaging.requirements import Requirement

# Remove current/script directory from sys.path[0] if added by the Python invocation,
# otherwise Spyder's install status may be incorrectly determined.
# Remove current/script directory from sys.path[0] if added by the Python
# invocation, otherwise Spyder's install status may be incorrectly determined.
SYS_PATH_0 = Path(sys.path[0]).resolve()
if SYS_PATH_0 in (Path(__file__).resolve().parent, Path.cwd()):
sys.path.pop(0)
Expand All @@ -43,7 +44,13 @@
dist = None
editable = None
else:
editable = (p == dist._path or p in dist._path.parents)
direct_url = dist.read_text('direct_url.json')
if direct_url:
editable = (
loads(direct_url).get('dir_info', {}).get('editable', False)
)
else:
editable = (p == dist._path or p in dist._path.parents)

# This fixes detecting that PyLSP was installed in editable mode under
# some scenarios.
Expand Down

0 comments on commit fb4681c

Please sign in to comment.