diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2022-10-17 10:58:31 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-11-01 19:14:14 +0200 |
commit | 0de7e7a0664b7521dd722faf68a5bcf988ebb011 (patch) | |
tree | e7d8127579e8cd45f3fc5ba667e05432bd9b5a91 /util/locale_database/qlocalexml2cpp.py | |
parent | b77da049bc76ca809e7e2b58e0d554a3bf865b56 (diff) |
LocaleDB: Make passing qtbase root dir on command-lines optional
We can easily enough obtain the root of the present source tree using
the value of __file__, so might as well do so.
Change-Id: If14773ac1127278b6018a090c0b376437b9c6eec
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Diffstat (limited to 'util/locale_database/qlocalexml2cpp.py')
-rwxr-xr-x | util/locale_database/qlocalexml2cpp.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/util/locale_database/qlocalexml2cpp.py b/util/locale_database/qlocalexml2cpp.py index a859fc1da1..3c8fb84abb 100755 --- a/util/locale_database/qlocalexml2cpp.py +++ b/util/locale_database/qlocalexml2cpp.py @@ -4,9 +4,10 @@ """Script to generate C++ code from CLDR data in QLocaleXML form See ``cldr2qlocalexml.py`` for how to generate the QLocaleXML data itself. -Pass the output file from that as first parameter to this script; pass -the ISO 639-3 data file as second parameter; pass the root of the qtbase -check-out as third parameter. +Pass the output file from that as first parameter to this script; pass the ISO +639-3 data file as second parameter. You can optionally pass the root of the +qtbase check-out as third parameter; it defaults to the root of the qtbase +check-out containing this script. The ISO 639-3 data file can be downloaded from the SIL website: @@ -19,7 +20,7 @@ from pathlib import Path from typing import Optional from qlocalexml import QLocaleXmlReader -from localetools import unicode2hex, wrap_list, Error, Transcriber, SourceFileEditor +from localetools import unicode2hex, wrap_list, Error, Transcriber, SourceFileEditor, qtbase_root from iso639_3 import LanguageCodeData class LocaleKeySorter: @@ -521,8 +522,8 @@ class LocaleHeaderWriter (SourceFileEditor): def main(out, err): - # map { CLDR name: Qt file name } calendars_map = { + # CLDR name: Qt file name fragment 'gregorian': 'roman', 'persian': 'jalali', 'islamic': 'hijri', @@ -537,7 +538,8 @@ def main(out, err): metavar='input-file.xml') parser.add_argument('iso_path', help='path to the ISO 639-3 data file', metavar='iso-639-3.tab') - parser.add_argument('qtbase_path', help='path to the root of the qtbase source tree') + parser.add_argument('qtbase_path', help='path to the root of the qtbase source tree', + nargs='?', default=qtbase_root) parser.add_argument('--calendars', help='select calendars to emit data for', nargs='+', metavar='CALENDAR', choices=all_calendars, default=all_calendars) |