Skip to content

Commit

Permalink
Backport PR spyder-ide#22709: PR: Update installing developer repos t…
Browse files Browse the repository at this point in the history
…o accommodate dist-info
  • Loading branch information
ccordoba12 authored and meeseeksmachine committed Oct 24, 2024
1 parent 1e4cd5d commit 6d2fed3
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 6d2fed3

Please sign in to comment.