From 13cc60c15e6a1efac98ba567283a129c4b7af61d Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Thu, 20 Mar 2025 00:18:26 +0100
Subject: [PATCH] Drop usage of distutils

---
 CHANGELOG.rst          | 7 ++++++-
 django_yarnpkg/conf.py | 4 ++--
 django_yarnpkg/yarn.py | 4 ++--
 setup.py               | 2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 3479ae7..55763d3 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,7 +1,12 @@
+Version 6.1.3 (2025-03-19)
+=====================================================
+
+* Fix compatibility with Python 3.13 by dropping usage of distutils.
+
 Version 6.1.2 (2024-02-10)
 =====================================================
 
-* Explicitly set nodeLinker config to fix compatibility with Yarn 4.x 
+* Explicitly set nodeLinker config to fix compatibility with Yarn 4.x
 
 Version 6.1.1 (2024-02-09)
 =====================================================
diff --git a/django_yarnpkg/conf.py b/django_yarnpkg/conf.py
index c6c42b5..c688f9f 100644
--- a/django_yarnpkg/conf.py
+++ b/django_yarnpkg/conf.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-from distutils.spawn import find_executable
+from shutil import which
 import os
 import sys
 from django.conf import settings
@@ -8,6 +8,6 @@ __all__ = ['NODE_MODULES_ROOT', 'YARN_PATH']
 
 NODE_MODULES_ROOT = getattr(settings, 'NODE_MODULES_ROOT', os.path.abspath(os.path.dirname(__name__)))
 
-default_yarn_path = find_executable('yarnpkg') or find_executable('yarn')
+default_yarn_path = which('yarnpkg') or which('yarn')
 
 YARN_PATH = getattr(settings, 'YARN_PATH', default_yarn_path)
diff --git a/django_yarnpkg/yarn.py b/django_yarnpkg/yarn.py
index 3b9c5a1..c8084a1 100644
--- a/django_yarnpkg/yarn.py
+++ b/django_yarnpkg/yarn.py
@@ -1,5 +1,5 @@
 from . import conf, shortcuts, exceptions
-from distutils.spawn import find_executable
+from shutil import which
 import os
 import subprocess
 import sys
@@ -16,7 +16,7 @@ class YarnAdapter(object):
     def is_yarn_exists(self):
         """Check is bower exists"""
         if shortcuts.is_executable(self._yarn_path)\
-                or find_executable(self._yarn_path):
+                or which(self._yarn_path):
             return True
         else:
             return False
diff --git a/setup.py b/setup.py
index 3478585..e6d2a0a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup, find_packages
 
-version = '6.1.2'
+version = '6.1.3'
 
 setup(
     name='django-yarnpkg',
-- 
GitLab