From b4aef0a53ba63c34e45413754705af4e438ef5df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Wed, 5 May 2021 10:59:02 +0200
Subject: [PATCH] Legacy: Use sysconfig.get_default_scheme() where available
 (#2109)

---
 .pre-commit-config.yaml      | 43 ------------------------------------
 docs/changelog/2109.misc.rst |  1 +
 virtualenv.py                |  3 ++-
 3 files changed, 3 insertions(+), 44 deletions(-)
 delete mode 100644 .pre-commit-config.yaml
 create mode 100644 docs/changelog/2109.misc.rst

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
deleted file mode 100644
index 0b8234b7d..000000000
--- a/.pre-commit-config.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
-repos:
--   repo: https://github.com/ambv/black
-    rev: 19.10b0
-    hooks:
-    -   id: black
-        args: [--safe]
-        language_version: python3.8
--   repo: https://github.com/asottile/blacken-docs
-    rev: v1.3.0
-    hooks:
-    -   id: blacken-docs
-        additional_dependencies: [black==19.3b0]
-        language_version: python3.8
--   repo: https://github.com/asottile/seed-isort-config
-    rev: v1.9.3
-    hooks:
-    -   id: seed-isort-config
-        args: [--application-directories, '.']
--   repo: https://github.com/pre-commit/mirrors-isort
-    rev: v4.3.21
-    hooks:
-    -   id: isort
--   repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v2.4.0
-    hooks:
-    -   id: trailing-whitespace
-    -   id: end-of-file-fixer
-    -   id: check-yaml
-    -   id: debug-statements
-    -   id: check-merge-conflict
-    -   id: trailing-whitespace
-    -   id: check-docstring-first
-    -   id: flake8
-        additional_dependencies: ["flake8-bugbear == 19.8.0"]
-        language_version: python3.8
--   repo: https://github.com/asottile/pyupgrade
-    rev: v1.25.1
-    hooks:
-    -   id: pyupgrade
--   repo: https://github.com/pre-commit/pygrep-hooks
-    rev: v1.4.2
-    hooks:
-    -   id: rst-backticks
diff --git a/docs/changelog/2109.misc.rst b/docs/changelog/2109.misc.rst
new file mode 100644
index 000000000..985f955df
--- /dev/null
+++ b/docs/changelog/2109.misc.rst
@@ -0,0 +1 @@
+Preserve compatibility with Python 3.10 - by ``hroncok``
diff --git a/virtualenv.py b/virtualenv.py
index 3085d1d18..86aa65674 100755
--- a/virtualenv.py
+++ b/virtualenv.py
@@ -1809,7 +1809,8 @@ def fix_local_scheme(home_dir, symlink=True):
         pass
     else:
         # noinspection PyProtectedMember
-        if sysconfig._get_default_scheme() == "posix_local":
+        get_scheme = getattr(sysconfig, "get_default_scheme", None) or sysconfig._get_default_scheme
+        if get_scheme() == "posix_local":
             local_path = os.path.join(home_dir, "local")
             if not os.path.exists(local_path):
                 os.mkdir(local_path)
