alecthomas / alecthomas/importmagic

distutils removed in python 3.12

Đang mở
#67 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
122
Fork
21
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

importmagic 0.1.7 uses distutils.sysconfig to find some library paths and unfortunately distutils was removed in Python 3.12.

This was my stab at replacing it. After glancing at I'm not sure what the difference is between prefix=None and sys.prefix is.

On my system the calculated prefix (from prefix=None) always ends up the same as sys.prefix

```
--- a/importmagic/index.py
+++ b/importmagic/index.py
@@ -8,18 +8,16 @@
import logging
import re
from contextlib import contextmanager
-from distutils import sysconfig
+import sysconfig

from importmagic.util import parse_ast


LIB_LOCATIONS = sorted(set((
- (sysconfig.get_python_lib(standard_lib=True), 'S'),
- (sysconfig.get_python_lib(plat_specific=True), '3'),
- (sysconfig.get_python_lib(standard_lib=True, prefix=sys.prefix), 'S'),
- (sysconfig.get_python_lib(plat_specific=True, prefix=sys.prefix), '3'),
- (sysconfig.get_python_lib(standard_lib=True, prefix='/usr/local'), 'S'),
- (sysconfig.get_python_lib(plat_specific=True, prefix='/usr/local'), '3'),
+ (sysconfig.get_path('stdlib', scheme='deb_system'), 'S'),
+ (sysconfig.get_path('platlib', scheme='deb_system'), '3'),
+ (sysconfig.get_path('stdlib', scheme='posix_local'), 'S'),
+ (sysconfig.get_path('platlib', scheme='posix_local'), '3'),
)), key=lambda l: -len(l[0]))

# Regex matching modules that we never attempt to index.

```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.