Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use sysconfig for sitepath #83

Merged
merged 3 commits into from
Jul 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions scooby/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
as available RAM or MKL info.

"""
import distutils.sysconfig as sysconfig
import os
from pathlib import Path
import platform
import sys
import sysconfig

try:
import psutil
Expand Down Expand Up @@ -112,8 +112,9 @@ def in_ipykernel():

def get_standard_lib_modules():
"""Return a set of the names of all modules in the standard library."""
site_path = sysconfig.get_path('stdlib')
if getattr(sys, 'frozen', False): # within pyinstaller
lib_path = os.path.join(sysconfig.get_python_lib(standard_lib=True), '..')
lib_path = os.path.join(site_path, '..')
if os.path.isdir(lib_path):
names = os.listdir(lib_path)
else:
Expand All @@ -126,7 +127,7 @@ def get_standard_lib_modules():
stdlib_pkgs = set(stdlib_pkgs)

else:
names = os.listdir(sysconfig.get_python_lib(standard_lib=True))
names = os.listdir(site_path)

stdlib_pkgs = set([name if not name.endswith(".py") else name[:-3] for name in names])

Expand Down