Mercurial > public > mercurial-scm > hg-stable
changeset 53013:d333e14477f1
packaging: adapt `__version__.py` parsing for `setuptools_scm` output
The file is now generated by `setuptools_scm`, which stores values as strings
with strong quotes. This avoids the following failure at the end of the Inno
installer build:
<snip>
creating installer
Traceback (most recent call last):
File "c:\Users\Matt\projects\mercurial\mercurial-devel\contrib\packaging\packaging.py", line 70, in <module>
run()
File "c:\Users\Matt\projects\mercurial\mercurial-devel\contrib\packaging\packaging.py", line 62, in run
cli.main()
File "c:\Users\Matt\projects\mercurial\mercurial-devel\contrib\packaging\hgpackaging\cli.py", line 154, in main
args.func(**kwargs)
File "c:\Users\Matt\projects\mercurial\mercurial-devel\contrib\packaging\hgpackaging\cli.py", line 35, in build_inno
inno.build_with_pyoxidizer(
File "c:\Users\Matt\projects\mercurial\mercurial-devel\contrib\packaging\hgpackaging\inno.py", line 55, in build_with_pyoxidizer
build_installer(
File "c:\Users\Matt\projects\mercurial\mercurial-devel\contrib\packaging\hgpackaging\inno.py", line 146, in build_installer
version = read_version_py(source_dir)
File "c:\Users\Matt\projects\mercurial\mercurial-devel\contrib\packaging\hgpackaging\util.py", line 188, in read_version_py
raise Exception('could not parse %s' % p)
Exception: could not parse c:\Users\Matt\projects\mercurial\mercurial-devel\mercurial\__version__.py
Note that non-tagged builds end up with complex version strings, and include
characters that WiX rejects. That's probably fine- we don't do nightly or other
non-tagged builds for installers.
Also note that while the Inno installer is capable of using this version string
as part of the installer, the WiX installer is not for some reason. That
installer needs to be built with `--version VERSION` to inject the version into
the installer metadata and the filename.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 24 Feb 2025 12:14:15 -0500 |
parents | 0e2be2abd963 |
children | 80ec613fea43 |
files | contrib/packaging/hgpackaging/util.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/packaging/hgpackaging/util.py Mon Feb 24 11:29:46 2025 -0500 +++ b/contrib/packaging/hgpackaging/util.py Mon Feb 24 12:14:15 2025 -0500 @@ -182,7 +182,7 @@ p = source_dir / 'mercurial' / '__version__.py' with p.open('r', encoding='utf-8') as fh: - m = re.search('version = b"([^"]+)"', fh.read(), re.MULTILINE) + m = re.search("version = '([^']+)'", fh.read(), re.MULTILINE) if not m: raise Exception('could not parse %s' % p)