Skip to content

Commit

Permalink
Merge pull request #22709 from mrclary/bootstrap
Browse files Browse the repository at this point in the history
PR: Update installing developer repos to accommodate dist-info
  • Loading branch information
ccordoba12 authored Oct 24, 2024
2 parents 3274e79 + 8adda53 commit 3fcdd8a
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 3fcdd8a

Please sign in to comment.