diff --git a/icu4c/source/configure b/icu4c/source/configure
index 9ef981d53e6..1db59eb0ed5 100755
--- a/icu4c/source/configure
+++ b/icu4c/source/configure
@@ -9123,7 +9123,8 @@ else
if test -f "$srcdir/data/locales/root.txt";
then
echo "Spawning Python to generate data/rules.mk..."
- PYTHONPATH="$srcdir/data" $PYTHON -m buildtool \
+ PYTHONPATH="$srcdir/python" \
+ $PYTHON -m icutools.databuilder \
--mode gnumake \
--seqmode parallel \
--src_dir "$srcdir/data" \
@@ -9138,7 +9139,8 @@ else
touch data/rules.mk
fi
echo "Spawning Python to generate test/testdata/rules.mk..."
- PYTHONPATH="$srcdir/test/testdata:$srcdir/data" $PYTHON -m buildtool \
+ PYTHONPATH="$srcdir/python" \
+ $PYTHON -m icutools.databuilder \
--mode gnumake \
--seqmode parallel \
--src_dir "$srcdir/test/testdata" \
diff --git a/icu4c/source/configure.ac b/icu4c/source/configure.ac
index 8cd270b0d63..03dad87cb55 100644
--- a/icu4c/source/configure.ac
+++ b/icu4c/source/configure.ac
@@ -1399,7 +1399,8 @@ else
if test -f "$srcdir/data/locales/root.txt";
then
echo "Spawning Python to generate data/rules.mk..."
- PYTHONPATH="$srcdir/data" $PYTHON -m buildtool \
+ PYTHONPATH="$srcdir/python" \
+ $PYTHON -m icutools.databuilder \
--mode gnumake \
--seqmode parallel \
--src_dir "$srcdir/data" \
@@ -1414,7 +1415,8 @@ else
touch data/rules.mk
fi
echo "Spawning Python to generate test/testdata/rules.mk..."
- PYTHONPATH="$srcdir/test/testdata:$srcdir/data" $PYTHON -m buildtool \
+ PYTHONPATH="$srcdir/python" \
+ $PYTHON -m icutools.databuilder \
--mode gnumake \
--seqmode parallel \
--src_dir "$srcdir/test/testdata" \
diff --git a/icu4c/source/data/BUILDRULES.py b/icu4c/source/data/BUILDRULES.py
index 2442f4e3ff6..30f82936a5c 100644
--- a/icu4c/source/data/BUILDRULES.py
+++ b/icu4c/source/data/BUILDRULES.py
@@ -5,10 +5,10 @@
# TODO(ICU-20301): Remove this.
from __future__ import print_function
-from buildtool import *
-from buildtool import locale_dependencies
-from buildtool import utils
-from buildtool.request_types import *
+from icutools.databuilder import *
+from icutools.databuilder import locale_dependencies
+from icutools.databuilder import utils
+from icutools.databuilder.request_types import *
import os
import sys
diff --git a/icu4c/source/data/Makefile.in b/icu4c/source/data/Makefile.in
index 778b6c7affa..d1fb80fe19b 100644
--- a/icu4c/source/data/Makefile.in
+++ b/icu4c/source/data/Makefile.in
@@ -136,7 +136,7 @@ cleanpackage:
$(RMV) $(LIBDIR)/*$(LIB_ICUDATA_NAME)*.$(SO)* $(LIBDIR)/$(LIB_STATIC_ICUDATA_NAME).$(A)
check-local:
- PYTHONPATH=$(srcdir) @PYTHON@ -m buildtool.test
+ PYTHONPATH=$(top_srcdir)/python @PYTHON@ -m icutools.databuilder.test
# Find out if we have a source archive.
# If we have that, then use that instead of building everything from scratch.
@@ -266,7 +266,7 @@ ifeq ($(TZDATA),)
TZDATA = $(firstword $(wildcard $(top_builddir)/tools/tzcode/tzdata*.tar.gz) $(wildcard $(top_srcdir)/tools/tzcode/tzdata*.tar.gz))
endif
-# TODO(ICU-20466): Make the TZDATA override part of Python buildtool
+# TODO(ICU-20466): Make the TZDATA override part of Python icutools.databuilder
ifneq ($(TZDATA),)
TZCODE_DIR=$(top_builddir)/tools/tzcode
diff --git a/icu4c/source/data/build.xml b/icu4c/source/data/build.xml
index a74eb9abee1..93ba8c6ac36 100644
--- a/icu4c/source/data/build.xml
+++ b/icu4c/source/data/build.xml
@@ -111,7 +111,7 @@
-
+
@@ -374,7 +374,7 @@
-
+
diff --git a/icu4c/source/data/makedata.mak b/icu4c/source/data/makedata.mak
index 53e1eaaa6d4..522283d587e 100644
--- a/icu4c/source/data/makedata.mak
+++ b/icu4c/source/data/makedata.mak
@@ -233,7 +233,8 @@ $(TOOLS_TS): "$(ICUTOOLS)\genrb\$(CFGTOOLS)\genrb.exe" "$(ICUTOOLS)\gencnval\$(C
$(COREDATA_TS):
@cd "$(ICUSRCDATA)"
- py -3 -B -m buildtool \
+ set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH%
+ py -3 -B -m icutools.databuilder \
--mode windows-exec \
--src_dir "$(ICUSRCDATA)" \
--tool_dir "$(ICUTOOLS)" \
diff --git a/icu4c/source/python/icutools/__init__.py b/icu4c/source/python/icutools/__init__.py
new file mode 100644
index 00000000000..514ea279273
--- /dev/null
+++ b/icu4c/source/python/icutools/__init__.py
@@ -0,0 +1,4 @@
+# Copyright (C) 2018 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This is the root ICU namespace for build tools.
diff --git a/icu4c/source/data/buildtool/__init__.py b/icu4c/source/python/icutools/databuilder/__init__.py
similarity index 100%
rename from icu4c/source/data/buildtool/__init__.py
rename to icu4c/source/python/icutools/databuilder/__init__.py
diff --git a/icu4c/source/data/buildtool/__main__.py b/icu4c/source/python/icutools/databuilder/__main__.py
similarity index 95%
rename from icu4c/source/data/buildtool/__main__.py
rename to icu4c/source/python/icutools/databuilder/__main__.py
index 36d99207e55..88815aac84f 100644
--- a/icu4c/source/data/buildtool/__main__.py
+++ b/icu4c/source/python/icutools/databuilder/__main__.py
@@ -16,7 +16,6 @@ from .comment_stripper import CommentStripper
from .request_types import CopyRequest
from .renderers import makefile, common_exec
from . import filtration, utils
-import BUILDRULES
flag_parser = argparse.ArgumentParser(
description = """Generates rules for building ICU binary data files from text
@@ -37,11 +36,11 @@ with a lot of intermediate files.
Set LD_LIBRARY_PATH to include the lib directory. e.g., from icu4c/source:
- $ LD_LIBRARY_PATH=lib PYTHONPATH=data python3 -m buildtool ...
+ $ LD_LIBRARY_PATH=lib PYTHONPATH=python python3 -m icutools.databuilder ...
-Once buildtool finishes, you have compiled the data, but you have not packaged
-it into a .dat or .so file. This is done by the separate pkgdata tool in bin.
-Read the docs of pkgdata:
+Once icutools.databuilder finishes, you have compiled the data, but you have
+not packaged it into a .dat or .so file. This is done by the separate pkgdata
+tool in bin. Read the docs of pkgdata:
$ LD_LIBRARY_PATH=lib ./bin/pkgdata --help
@@ -264,9 +263,13 @@ def main(argv):
GLOB_DIR = args.src_dir,
PATTERN = pattern
))
- # For the purposes of buildtool, force Unix-style directory separators.
+ # For the purposes of icutools.databuilder, force Unix-style directory separators.
return [v.replace("\\", "/")[len(args.src_dir)+1:] for v in sorted(result_paths)]
+ # Automatically load BUILDRULES from the src_dir
+ sys.path.append(args.src_dir)
+ import BUILDRULES
+
requests = BUILDRULES.generate(config, glob, common)
requests = filtration.apply_filters(requests, config)
requests = utils.flatten_requests(requests, config, common)
diff --git a/icu4c/source/data/buildtool/comment_stripper.py b/icu4c/source/python/icutools/databuilder/comment_stripper.py
similarity index 100%
rename from icu4c/source/data/buildtool/comment_stripper.py
rename to icu4c/source/python/icutools/databuilder/comment_stripper.py
diff --git a/icu4c/source/data/buildtool/filtration.py b/icu4c/source/python/icutools/databuilder/filtration.py
similarity index 100%
rename from icu4c/source/data/buildtool/filtration.py
rename to icu4c/source/python/icutools/databuilder/filtration.py
diff --git a/icu4c/source/data/buildtool/filtration_schema.json b/icu4c/source/python/icutools/databuilder/filtration_schema.json
similarity index 100%
rename from icu4c/source/data/buildtool/filtration_schema.json
rename to icu4c/source/python/icutools/databuilder/filtration_schema.json
diff --git a/icu4c/source/data/buildtool/locale_dependencies.py b/icu4c/source/python/icutools/databuilder/locale_dependencies.py
similarity index 100%
rename from icu4c/source/data/buildtool/locale_dependencies.py
rename to icu4c/source/python/icutools/databuilder/locale_dependencies.py
diff --git a/icu4c/source/data/buildtool/renderers/__init__.py b/icu4c/source/python/icutools/databuilder/renderers/__init__.py
similarity index 100%
rename from icu4c/source/data/buildtool/renderers/__init__.py
rename to icu4c/source/python/icutools/databuilder/renderers/__init__.py
diff --git a/icu4c/source/data/buildtool/renderers/common_exec.py b/icu4c/source/python/icutools/databuilder/renderers/common_exec.py
similarity index 100%
rename from icu4c/source/data/buildtool/renderers/common_exec.py
rename to icu4c/source/python/icutools/databuilder/renderers/common_exec.py
diff --git a/icu4c/source/data/buildtool/renderers/makefile.py b/icu4c/source/python/icutools/databuilder/renderers/makefile.py
similarity index 100%
rename from icu4c/source/data/buildtool/renderers/makefile.py
rename to icu4c/source/python/icutools/databuilder/renderers/makefile.py
diff --git a/icu4c/source/data/buildtool/request_types.py b/icu4c/source/python/icutools/databuilder/request_types.py
similarity index 100%
rename from icu4c/source/data/buildtool/request_types.py
rename to icu4c/source/python/icutools/databuilder/request_types.py
diff --git a/icu4c/source/data/buildtool/test/__init__.py b/icu4c/source/python/icutools/databuilder/test/__init__.py
similarity index 100%
rename from icu4c/source/data/buildtool/test/__init__.py
rename to icu4c/source/python/icutools/databuilder/test/__init__.py
diff --git a/icu4c/source/data/buildtool/test/__main__.py b/icu4c/source/python/icutools/databuilder/test/__main__.py
similarity index 100%
rename from icu4c/source/data/buildtool/test/__main__.py
rename to icu4c/source/python/icutools/databuilder/test/__main__.py
diff --git a/icu4c/source/data/buildtool/test/filtration_test.py b/icu4c/source/python/icutools/databuilder/test/filtration_test.py
similarity index 100%
rename from icu4c/source/data/buildtool/test/filtration_test.py
rename to icu4c/source/python/icutools/databuilder/test/filtration_test.py
diff --git a/icu4c/source/data/buildtool/utils.py b/icu4c/source/python/icutools/databuilder/utils.py
similarity index 100%
rename from icu4c/source/data/buildtool/utils.py
rename to icu4c/source/python/icutools/databuilder/utils.py
diff --git a/icu4c/source/test/testdata/BUILDRULES.py b/icu4c/source/test/testdata/BUILDRULES.py
index d599e33c82f..47d3749c842 100644
--- a/icu4c/source/test/testdata/BUILDRULES.py
+++ b/icu4c/source/test/testdata/BUILDRULES.py
@@ -3,8 +3,8 @@
from distutils.sysconfig import parse_makefile
-from buildtool import *
-from buildtool.request_types import *
+from icutools.databuilder import *
+from icutools.databuilder.request_types import *
def generate(config, glob, common_vars):
diff --git a/icu4c/source/test/testdata/testdata.mak b/icu4c/source/test/testdata/testdata.mak
index 879af99f991..2809efd0ca3 100644
--- a/icu4c/source/test/testdata/testdata.mak
+++ b/icu4c/source/test/testdata/testdata.mak
@@ -34,8 +34,8 @@ CREATE_DIRS :
"$(TESTDATAOUT)\testdata.dat" :
@echo Building test data
- set PYTHONPATH=$(ICUSRCDATA);%PYTHONPATH%
- py -3 -B -m buildtool \
+ set PYTHONPATH=$(ICUP)\source\python;%PYTHONPATH%
+ py -3 -B -m icutools.databuilder \
--mode windows-exec \
--tool_dir "$(ICUTOOLS)" \
--tool_cfg "$(CFG)" \
diff --git a/icu4c/source/tools/genrb/genrb.cpp b/icu4c/source/tools/genrb/genrb.cpp
index 120db6844f2..6f3a13a0a61 100644
--- a/icu4c/source/tools/genrb/genrb.cpp
+++ b/icu4c/source/tools/genrb/genrb.cpp
@@ -240,7 +240,7 @@ main(int argc,
"\t (--writePoolBundle and --usePoolBundle cannot be combined)\n");
fprintf(stderr,
"\t --filterDir Input directory where filter files are available.\n"
- "\t For more on filter files, see Python buildtool.\n");
+ "\t For more on filter files, see ICU Data Build Tool.\n");
return illegalArg ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
}