From 933bb84a3cc727cd22a15af37eb346efdff47704 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Wed, 7 Dec 2022 17:19:54 -0800 Subject: [PATCH] Get version number from pyproject.toml --- makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index 61db0d4a..0ab2f1de 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ # -*- makefile -*- # this makefile controls the build and packaging of weewx -# Copyright 2013 Matthew Wall +# Copyright 2013-2023 Matthew Wall # if you do not want to sign the packages, set SIGN to 0 SIGN=1 @@ -16,7 +16,7 @@ WEEWX_DOWNLOADS=$(WEEWX_HTMLDIR)/downloads WEEWX_STAGING=$(WEEWX_HTMLDIR)/downloads/development_versions # extract version to be used in package controls and labels -VERSION=$(shell grep "__version__.*=" bin/weewx/__init__.py | sed -e 's/__version__=//' | sed -e 's/"//g') +VERSION=$(shell sed -ne 's/^version = "\(.*\)"/\1/p;' pyproject.toml) # just the major.minor part of the version MMVERSION:=$(shell echo "$(VERSION)" | sed -e 's%.[0-9a-z]*$$%%') @@ -34,7 +34,7 @@ help: info @echo "options include:" @echo " info display values of variables we care about" @echo " install run the generic python install" - @echo " version get version from __init__ and insert elsewhere" + @echo " version get version from pyproject.toml and insert elsewhere" @echo "" @echo " deb-changelog prepend stub changelog entry for deb" @echo " redhat-changelog prepend stub changelog entry for redhat" @@ -168,9 +168,8 @@ done sed -e 's/^SKIN_VERSION = [0-9].*/SKIN_VERSION = $(VERSION)/' $$f > $$f.tmp; \ mv $$f.tmp $$f; \ done - sed -e 's/^VERSION = .*/VERSION = "$(VERSION)"/' setup.py > setup.py.tmp - mv setup.py.tmp setup.py - chmod 755 setup.py + sed -e 's/__version__ *=.*/__version__ = "$(VERSION)"/' bin/weewx/__init__.py > weeinit.py.tmp + mv weeinit.py.tmp bin/weewx/__init__.py DEBREVISION=1 DEBVER=$(VERSION)-$(DEBREVISION)