alecthomas / alecthomas/importmagic

distutils removed in python 3.12

オープン
#67 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
122
フォーク
21
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。