8000 Merge pull request #23245 from meeseeksmachine/auto-backport-of-pr-23… · matplotlib/matplotlib@b38b97e · GitHub
[go: up one dir, main page]

Skip to content

Commit b38b97e

Browse files
authored
Merge pull request #23245 from meeseeksmachine/auto-backport-of-pr-23144-on-v3.5.x
Backport PR #23144 on branch v3.5.x (Only import setuptools_scm when we are in a matplotlib git repo)
2 parents a0b0df8 + f2a3ec5 commit b38b97e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.matplotlib-repo

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The existence of this file signals that the code is a matplotlib source repo
2+
and not an installed version. We use this in __init__.py for gating version
3+
detection.

lib/matplotlib/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,13 @@ def _parse_to_version_info(version_str):
160160

161161
def _get_version():
162162
"""Return the version string used for __version__."""
163-
# Only shell out to a git subprocess if really needed, and not on a
164-
# shallow clone, such as those used by CI, as the latter would trigger
165-
# a warning from setuptools_scm.
163+
# Only shell out to a git subprocess if really needed, i.e. when we are in
164+
# a matplotlib git repo but not in a shallow clone, such as those used by
165+
# CI, as the latter would trigger a warning from setuptools_scm.
166166
root = Path(__file__).resolve().parents[2]
167-
if (root / ".git").exists() and not (root / ".git/shallow").exists():
167+
if ((root / ".matplotlib-repo").exists()
168+
and (root / ".git").exists()
169+
and not (root / ".git/shallow").exists()):
168170
import setuptools_scm
169171
return setuptools_scm.get_version(
170172
root=root,

0 commit comments

Comments
 (0)
0