FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix _is_dev_install by using importlib.metadata API by diegorusso · Pull Request #371 · python/pyperformance · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 7 additions & 11 deletions pyperformance/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
import os.path
import sys
from importlib.metadata import distribution


VERSION = (1, 11, 0)
Expand Down Expand Up @@ -33,14 +35,8 @@ def _is_devel_install():
# pip install -e <path-to-git-checkout> will do a "devel" install.
# This means it creates a link back to the checkout instead
# of copying the files.
try:
import packaging
except ModuleNotFoundError:
return False
sitepackages = os.path.dirname(os.path.dirname(packaging.__file__))
if os.path.isdir(os.path.join(sitepackages, 'pyperformance')):
return False
if not os.path.exists(os.path.join(sitepackages, 'pyperformance.egg-link')):
# XXX Check the contents?
return False
return True

direct_url = distribution("pyperformance").read_text("direct_url.json")
if direct_url:
return json.loads(direct_url).get("dir_info", {}).get("editable", False)
return False

Back | FazBrowse Home | New Git URL