FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(build): keep editable version fallback out of wheels · gitpython-developers/GitPython@5714844 · GitHub

Repository navigation

Commit 5714844

Browse files
authored andcommitted
fix(build): keep editable version fallback out of wheels
The existing release stamper matches every line containing `__version__ =`. A comparison with the version variable on the left is also matched, causing it to replace the placeholder in the new editable-import guard. That would incorrectly enable the source-tree `VERSION` lookup in a built wheel, which does not ship that file. Put the literal on the left of the guard so stamping changes only the public assignment. Extend the existing isolated installation test to verify public version parity with the running source checkout. The isolated installation and version checks pass with both CLI and Gix; Ruff lint/format and `git diff --check` pass. The full CLI suite also passes: 1,827 passed,162 skipped,1 xfailed and59 passed subtests.
1 parent 1d10bdc commit 5714844

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎git/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
]
8282

8383
__version__ = "git"
84-
if __version__ == "git":
84+
if "git" == __version__:
8585
# Wheels and source distributions stamp this value; editable imports do not.
8686
from pathlib import Path as _Path
8787

‎test/test_installation.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import subprocess
88
import sys
99

10-
from git import _backend
10+
from git import __version__, _backend
1111
from test.lib import TestCase, requires_symlinks
1212
from test.lib.fixtures import ROOT, writable_fixture
1313

@@ -44,6 +44,10 @@ def _test_installation(self, environment):
4444
self._check_result(result, "Backend selection failed")
4545
self.assertEqual(result.stdout.strip(), _backend.name)
4646

47+
result = run([python, "-c", "import git; print(git.__version__)"])
48+
self._check_result(result, "Installed version import failed")
49+
self.assertEqual(result.stdout.strip(), __version__)
50+
4751
result = run([python, "-c", "import gitdb; import smmap"])
4852
self._check_result(result, "Dependencies not installed")
4953

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL