Mercurial > public > mercurial-scm > hg
diff mercurial/util.py @ 52679:30510238284e
packaging: get version with setuptools-scm
Now that Mercurial is compatible with PEP 517, i.e. that setup.py is called
by a PEP 517 frontend (pip, build, pipx, UV, ...) in an isolated environment,
we can use setuptools-scm to obtain the version when building from the repo.
After these changes, it is no longer supported to get the version from the
repo when Mercurial is not installed.
Of course, it is still possible to install Mercurial from source without
Mercurial by getting an archive of the repo or the sdist on PyPI.
A case becomes slightly more complicated: building mercurial from source in
an environment where you cannot download anything from the web. One would
need to get setuptools and setuptools-scm wheels from PyPI, transfer them
to the computer, create a venv, install setuptools and setuptools-scm with
pip in the venv and install Mercurial with
`pip install . --no-build-isolation`.
Of course, it is still very simple to install Mercurial in an environment
where you cannot download anything from the web: just get a wheel and install.
No need for setuptools and setuptools-scm in this case.
author | paugier <pierre.augier@univ-grenoble-alpes.fr> |
---|---|
date | Fri, 25 Oct 2024 11:15:29 +0200 |
parents | e627cc25b6f3 |
children | 4eede65d68cf |
line wrap: on
line diff
--- a/mercurial/util.py Tue Jan 21 18:26:32 2025 -0500 +++ b/mercurial/util.py Fri Oct 25 11:15:29 2024 +0200 @@ -1197,7 +1197,8 @@ try: from . import __version__ # pytype: disable=import-error - return __version__.version + # setuptools-scm uses py3 str + return __version__.version.encode() except ImportError: return b'unknown'