From 4f9f6ab8b73a6e2de871db62161adf967e248265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Tue, 21 Jul 2026 15:41:26 +0200 Subject: [PATCH 1/2] Makefile: Fix "make rpm" and "make release-rpm" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the setuptools version and SPEC_VERSION might not be in-sync, which breaks "make rpm" and "make release-rpm". Let's prioritize the spec-version for RPM builds and VERSION everywhere else. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Lukáš Doktor --- Makefile | 9 +++++---- python-aexpect.spec | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4ca686f..3c94fad 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ PYTHON=$(shell which python 2>/dev/null || which python3 2>/dev/null) PROJECT=aexpect -VERSION=$(shell $(PYTHON) -m setuptools_scm) +VERSION=$(shell $(PYTHON) -m setuptools_scm 2>/dev/null || grep '^Version:' python-$(PROJECT).spec | awk '{print $$2}') +SPEC_VERSION=$(shell grep '^Version:' python-$(PROJECT).spec | awk '{print $$2}') COMMIT=$(shell git log --pretty=format:'%H' -n 1) SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1) COMMIT_DATE=$(shell git log --pretty='format:%cd' --date='format:%Y%m%d' -n 1) @@ -25,7 +26,7 @@ source: clean source-release: clean mkdir -p SOURCES - git archive --prefix="$(PROJECT)-$(VERSION)/" -o "SOURCES/$(PROJECT)-$(VERSION).tar.gz" $(VERSION) + git archive --prefix="$(PROJECT)-$(SPEC_VERSION)/" -o "SOURCES/$(PROJECT)-$(SPEC_VERSION).tar.gz" $(SPEC_VERSION) install: rm -r dist 2>/dev/null || true @@ -74,7 +75,7 @@ srpm: source rpm: srpm mkdir -p BUILD/RPM - mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/python-$(PROJECT)-$(VERSION)-*.src.rpm + mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/python-$(PROJECT)-$(SPEC_VERSION)-*.src.rpm srpm-release: source-release mkdir -p BUILD/SRPM @@ -82,7 +83,7 @@ srpm-release: source-release rpm-release: srpm-release mkdir -p BUILD/RPM - mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/python-$(PROJECT)-$(VERSION)-*.src.rpm + mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/python-$(PROJECT)-$(SPEC_VERSION)-*.src.rpm clean: $(MAKE) -f $(CURDIR)/debian/rules clean || true diff --git a/python-aexpect.spec b/python-aexpect.spec index 955ef09..46420b6 100644 --- a/python-aexpect.spec +++ b/python-aexpect.spec @@ -37,6 +37,7 @@ Source0: %{url}/archive/%{commit}/%{gittar} BuildArch: noarch BuildRequires: python3-devel +BuildRequires: python3-pip BuildRequires: python3-setuptools %description From 0d2aca8b05f8e6af3414a373077406cf09cc7007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Tue, 21 Jul 2026 16:10:23 +0200 Subject: [PATCH 2/2] pyproject: Keep using dynamic for pypi with fallback for rpm build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with hardcoded versions we can not distinguish between released or any development or even dirty versions, which could have terrible consequences when reading issues. Let's bring back the "dynamic" versioning but add "fallback_version" to use the hardcoded value in rpm builds. Note the "make rpm" should always use the spec-version, this is deliberate to ensure rpms use spec files while pipy/devel versions use dirty versioning. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Lukáš Doktor --- pyproject.toml | 3 ++- python-aexpect.spec | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 085928f..6d196a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" name = "aexpect" description = "Python library used to control interactive programs" readme = "README.rst" -version = "1.8.0" +dynamic = ["version"] license = {text = "GPL-2.0-or-later"} authors = [{name = "Aexpect developers", email = "avocado-devel@redhat.com"}] maintainers = [{name = "Aexpect developers", email = "avocado-devel@redhat.com"}] @@ -44,6 +44,7 @@ include = ["aexpect*"] [tool.setuptools_scm] version_scheme = "post-release" local_scheme = "node-and-date" +fallback_version = "1.8.0" [tool.black] line-length = 79 diff --git a/python-aexpect.spec b/python-aexpect.spec index 46420b6..cd6b14f 100644 --- a/python-aexpect.spec +++ b/python-aexpect.spec @@ -39,6 +39,7 @@ BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-pip BuildRequires: python3-setuptools +BuildRequires: python3-setuptools_scm %description Aexpect is a python library used to control interactive applications, very @@ -61,6 +62,7 @@ sftp, telnet, among others. %endif %build +export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_wheel %install