Skip to content

ICU-23333 Create equivalent build.py scripts for all ant tasks - #3912

Merged
mihnita merged 1 commit into
unicode-org:mainfrom
mihnita:mihai_build_ant_to_python
Mar 27, 2026
Merged

mihnita merged 1 commit into
unicode-org:mainfrom
mihnita:mihai_build_ant_to_python

Conversation

@mihnita

@mihnita mihnita commented Mar 19, 2026

Copy link
Copy Markdown
Contributor
  • Everything was tested on real repos and the results compared against the equivalent ant tasks
  • All files were checked with pylint, mypy (type annotations), and formatted with pyink

The code is a very close equivalent of the ant scripts, even if that means it's not very idiomatic Python.
Global variables (a few), each ant task becomes a function, task dependencies means that the function calls the dependent functions first.
We might polish later if desired.

Checklist

  • Required: Issue filed: ICU-23333
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-NNNNN Fix xyz"
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-NNNNN Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable
  • Approver: Feel free to merge on my behalf

@mihnita mihnita assigned mihnita and markusicu and unassigned mihnita Mar 19, 2026
@mihnita
mihnita force-pushed the mihai_build_ant_to_python branch from 36763f0 to 9caccc9 Compare March 19, 2026 15:18
@jira-pull-request-webhook

Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • tools/py/libs/py.typed is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@mihnita

mihnita commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

A small description on how I "mapped" Ant to Python

Ant has <target>(s), with a name and dependencies, sometime conditions.

I mapped each <target> to a Python def.
I made private def(s) for targets that didn't seem relevant to be called directly from command line (for example <target name="init"> becomes def _init():)


For dependencies I had the dependent method call the dependencies:

<target name="cleanprod" depends="init, setup">

becomes:

def cleanprod():
    _init()
    _setup()

Also, ant invokes the proper target if I pass it in command line:
ant foo will invoke <target name="foo">

For Python I am doing something similar "by hand", by parsing the cli.
So that's the argparse.ArgumentParser piece, with no direct equivalent in the Ant scripts. Each public ex-task (now def) there is a cli option.


This probably accounts >90% "tricks" in this ant->python conversion.

@echeran echeran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't take a deep look, but I assume it's fine. Left a few comments where it's worth making a change / easy to make a change, even given that this will be cleaned up again once Ant is fully removed soon.

Comment thread docs/processes/cldr-icu.md Outdated
Comment thread docs/processes/cldr-icu.md Outdated
Comment thread icu4c/source/data/build.py
Comment thread tools/cldr/build.py Outdated

@markusicu markusicu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly optional

Comment thread tools/currency/readme.txt Outdated
Comment thread tools/py/libs/icuproc.py Outdated
Comment thread tools/py/libs/icudirs.py Outdated
Comment thread tools/py/libs/icudirs.py Outdated
Comment thread tools/py/libs/icudirs.py Outdated
Comment thread tools/py/libs/test_icudirs.py
@mihnita
mihnita requested review from echeran and markusicu March 27, 2026 18:11
@mihnita

mihnita commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

All feedback implemented, thank you.

markusicu
markusicu previously approved these changes Mar 27, 2026
@mihnita
mihnita force-pushed the mihai_build_ant_to_python branch from 21c3ed0 to bdbeeef Compare March 27, 2026 19:00
@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@mihnita
mihnita force-pushed the mihai_build_ant_to_python branch from 33c8c05 to 96ed4dc Compare March 27, 2026 20:06
@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@mihnita
mihnita merged commit f83f165 into unicode-org:main Mar 27, 2026
98 checks passed
@mihnita
mihnita deleted the mihai_build_ant_to_python branch March 27, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants