Unverified Commit b88f75b7 authored by dotlambda's avatar dotlambda Committed by GitHub
Browse files

python3Packages.importmagic: 0.1.7 -> 0.2.0; several improvements (#502009)

parents 69804fe5 340c068a
Loading
Loading
Loading
Loading
+14 −16
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  six,
  fetchFromGitHub,
  hatchling,
  pytestCheckHook,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "importmagic";
  version = "0.1.7";
  format = "setuptools";
  version = "0.2.0";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-P3dXpbdMmikeIOEgI7s79xvC+jrfsVoIVwZIq4Pq+Ng=";
  src = fetchFromGitHub {
    owner = "alecthomas";
    repo = "importmagic";
    tag = finalAttrs.version;
    hash = "sha256-776HbSRl5hIrSyIyIF7jnNAJF41QzdjXe0vDaKwlCnc=";
  };

  patches = [
    # https://github.com/alecthomas/importmagic/issues/67
    ./python-312.patch
  ];

  propagatedBuildInputs = [ six ];
  build-system = [ hatchling ];

  nativeCheckInputs = [ pytestCheckHook ];

@@ -30,7 +27,8 @@ buildPythonPackage rec {
  meta = {
    description = "Python Import Magic - automagically add, remove and manage imports";
    homepage = "https://github.com/alecthomas/importmagic";
    license = lib.licenses.bsd0;
    changelog = "https://github.com/alecthomas/importmagic/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.bsd2;
    maintainers = with lib.maintainers; [ onny ];
  };
}
})
+0 −24
Original line number Diff line number Diff line
--- a/importmagic/index.py
+++ b/importmagic/index.py
@@ -8,18 +8,14 @@
 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'), 'S'),
+    (sysconfig.get_path('platlib'), '3'),
 )), key=lambda l: -len(l[0]))
 
 # Regex matching modules that we never attempt to index.