You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by da...@apache.org on 2026/10/23 14:27:16 UTC

(wicket) branch build-versions-python3-9.x created (now dd78e21ab8)

This is an automated email from the ASF dual-hosted git repository.

dashorst pushed a change to branch build-versions-python3-9.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


      at dd78e21ab8 Port build-versions.py to Python 3 and read its modules from the poms

This branch includes the following new commits:

     new dd78e21ab8 Port build-versions.py to Python 3 and read its modules from the poms

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(wicket) 01/01: Port build-versions.py to Python 3 and read its modules from the poms

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dashorst pushed a commit to branch build-versions-python3-9.x
in repository https://gitbox.apache.org/repos/asf/wicket.git

commit dd78e21ab8c754604940e60ec0f8eaebe47737aa
Author: Martijn Dashorst <ma...@topicus.nl>
AuthorDate: Fri Oct 23 16:24:59 2026 +0200

    Port build-versions.py to Python 3 and read its modules from the poms
    
    release.sh builds release.properties for release:prepare from the
    output of build-versions.py, which gives every module its release
    version and the next development version. The script was Python 2
    behind #!/usr/bin/python, so where python is Python 3 release.sh
    stopped there with a SyntaxError.
    
    Its module list was also incomplete. It read the <modules> of the root
    pom and of wicket-native-websocket only, derived artifact IDs from
    directory names and always added wicket-experimental under the
    org.apache.wicket.experimental.wicket8 groupId. The modules under
    wicket-experimental were missing (wicket-metrics, and on 9.x and 8.x
    wicket-http2 and its submodules), and wicket-experimental itself was
    listed twice, under two wrong groupIds. The release plugin then fell
    back to prompting or its own default for those modules.
    
    The script now runs on Python 3 and walks the <modules> tree from the
    root pom, taking the groupId and artifactId each pom declares. Its
    output matches the reactor: 34 modules on master. Adding or removing a
    module no longer needs a change to the script.
    
    GitHub issue #1708
    
    Generated-by: Claude Code (Claude Opus 5.5)
    (cherry picked from commit 8d0bfa19cc0fc27e918bfa5fd96975590cef4c70)
---
 build-versions.py | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/build-versions.py b/build-versions.py
index 3f6ae085d2..d5a5e56df3 100755
--- a/build-versions.py
+++ b/build-versions.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 #
 # prints a release.properties file for instructing the Maven Release Plugin
 # to generate the proper release artefacts without having to manually version
@@ -13,16 +13,17 @@
 #
 # Example:
 #
-#    build-milestone.py 7.0.0-M1 7.0.0-SNAPSHOT
+#    build-versions.py 7.0.0-M1 7.0.0-SNAPSHOT
 #
 
+import os
 import sys
-from xml.dom.minidom import parse
+import xml.etree.ElementTree as ET
 
-groupId = "org.apache.wicket"
+NS = {"pom": "http://maven.apache.org/POM/4.0.0"}
 
 if len(sys.argv) != 3:
-    print "Usage: %s <release-version> <dev-version>" % sys.argv[0]
+    print("Usage: %s <release-version> <dev-version>" % sys.argv[0])
     sys.exit(1)
 
 relVersion = sys.argv[1]
@@ -31,27 +32,25 @@ devVersion = sys.argv[2]
 relVersions = []
 devVersions = []
 
-def addVersions(groupId, module):
-    relVersions.append("project.rel." + groupId + "\\:" + module + "=" + relVersion)
-    devVersions.append("project.dev." + groupId + "\\:" + module + "=" + devVersion)
+def addVersions(groupId, artifactId):
+    relVersions.append("project.rel." + groupId + "\\:" + artifactId + "=" + relVersion)
+    devVersions.append("project.dev." + groupId + "\\:" + artifactId + "=" + devVersion)
 
-def getModulesFromParent(parentPomFile):
-    pom = parse(parentPomFile)
+def addModule(directory):
+    pom = ET.parse(os.path.join(directory, "pom.xml")).getroot()
 
-    for moduleTag in pom.getElementsByTagName('module'):
-        module = moduleTag.childNodes[0].nodeValue.replace("testing/", "").replace("archetypes/quickstart", "wicket-archetype-quickstart")
-        addVersions(groupId, module)
+    groupId = pom.findtext("pom:groupId", namespaces=NS) or pom.findtext("pom:parent/pom:groupId", namespaces=NS)
+    addVersions(groupId, pom.findtext("pom:artifactId", namespaces=NS))
 
-addVersions(groupId, "wicket-parent")
-addVersions("org.apache.wicket.experimental.wicket8", "wicket-experimental")
+    for module in pom.iterfind(".//pom:modules/pom:module", NS):
+        addModule(os.path.join(directory, module.text))
 
-getModulesFromParent("pom.xml")
-getModulesFromParent("wicket-native-websocket/pom.xml")
+addModule(".")
 
 for version in relVersions:
-    print version
+    print(version)
 
-print
+print()
 
 for version in devVersions:
-    print version
+    print(version)