]> granicus.if.org Git - icu/commitdiff
ICU-20593 Renaming Python buildtool to icutools.databuilder.
authorShane Carr <shane@unicode.org>
Mon, 6 May 2019 23:37:10 +0000 (16:37 -0700)
committerShane F. Carr <shane@unicode.org>
Tue, 7 May 2019 20:42:06 +0000 (13:42 -0700)
24 files changed:
icu4c/source/configure
icu4c/source/configure.ac
icu4c/source/data/BUILDRULES.py
icu4c/source/data/Makefile.in
icu4c/source/data/build.xml
icu4c/source/data/makedata.mak
icu4c/source/python/icutools/__init__.py [new file with mode: 0644]
icu4c/source/python/icutools/databuilder/__init__.py [moved from icu4c/source/data/buildtool/__init__.py with 100% similarity]
icu4c/source/python/icutools/databuilder/__main__.py [moved from icu4c/source/data/buildtool/__main__.py with 95% similarity]
icu4c/source/python/icutools/databuilder/comment_stripper.py [moved from icu4c/source/data/buildtool/comment_stripper.py with 100% similarity]
icu4c/source/python/icutools/databuilder/filtration.py [moved from icu4c/source/data/buildtool/filtration.py with 100% similarity]
icu4c/source/python/icutools/databuilder/filtration_schema.json [moved from icu4c/source/data/buildtool/filtration_schema.json with 100% similarity]
icu4c/source/python/icutools/databuilder/locale_dependencies.py [moved from icu4c/source/data/buildtool/locale_dependencies.py with 100% similarity]
icu4c/source/python/icutools/databuilder/renderers/__init__.py [moved from icu4c/source/data/buildtool/renderers/__init__.py with 100% similarity]
icu4c/source/python/icutools/databuilder/renderers/common_exec.py [moved from icu4c/source/data/buildtool/renderers/common_exec.py with 100% similarity]
icu4c/source/python/icutools/databuilder/renderers/makefile.py [moved from icu4c/source/data/buildtool/renderers/makefile.py with 100% similarity]
icu4c/source/python/icutools/databuilder/request_types.py [moved from icu4c/source/data/buildtool/request_types.py with 100% similarity]
icu4c/source/python/icutools/databuilder/test/__init__.py [moved from icu4c/source/data/buildtool/test/__init__.py with 100% similarity]
icu4c/source/python/icutools/databuilder/test/__main__.py [moved from icu4c/source/data/buildtool/test/__main__.py with 100% similarity]
icu4c/source/python/icutools/databuilder/test/filtration_test.py [moved from icu4c/source/data/buildtool/test/filtration_test.py with 100% similarity]
icu4c/source/python/icutools/databuilder/utils.py [moved from icu4c/source/data/buildtool/utils.py with 100% similarity]
icu4c/source/test/testdata/BUILDRULES.py
icu4c/source/test/testdata/testdata.mak
icu4c/source/tools/genrb/genrb.cpp

index 9ef981d53e66eb031583036b38b31e8fe933a0f2..1db59eb0ed5d562a50f9a53d130b9aeb43214763 100755 (executable)
@@ -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" \
index 8cd270b0d63526e76189b6258370461fd57d37d6..03dad87cb552f4aba0ff69b1cc3e25428561e0d0 100644 (file)
@@ -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" \
index 2442f4e3ff61084b352ddd0a778a23141de25128..30f82936a5cda86eb09a928108d439f3a12b47ee 100644 (file)
@@ -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
index 778b6c7affa28916cd366854fc44f46b8343733d..d1fb80fe19b37853c44ae34bf50bcaf12e39ada3 100644 (file)
@@ -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
index a74eb9abee19a9ce1b0b87647d4dce0e0ed11b1c..93ba8c6ac36dc70645c105430a13ff7c351812fb 100644 (file)
                     <arg name="--specialsdir"     value="${env.ICU4C_DIR}/source/data/xml/main"/>
                     <arg name="--supplementaldir" value="${env.CLDR_DIR}/common/supplemental" />
                     <arg name="--type" value="locales"/>
-                    <arg name="--depgraphfile" value="../buildtool/locale_dependencies.py"/>
+                    <arg name="--depgraphfile" value="../../python/icutools/databuilder/locale_dependencies.py"/>
                 </args>
                <remapper>
                  <remap sourcePath="/Keys" targetDir="lang" />
             <fileset id="resfiles" dir="${env.ICU4C_DIR}/source/data/locales">
                 <include name="resfiles.mk" />
             </fileset>
-            <fileset id="dependencies_py" dir="${env.ICU4C_DIR}/source/data/buildtool">
+            <fileset id="dependencies_py" dir="${env.ICU4C_DIR}/source/python/icutools/databuilder">
                 <include name="locale_dependencies.py" />
             </fileset>
             <fileset id="locales_split" dir="${env.ICU4C_DIR}/source/data">
index 53e1eaaa6d4e6f4f805a601105ec742aa018c8b3..522283d587e8abb21cf58e36314ef7cac8636b2d 100644 (file)
@@ -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 (file)
index 0000000..514ea27
--- /dev/null
@@ -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.
similarity index 95%
rename from icu4c/source/data/buildtool/__main__.py
rename to icu4c/source/python/icutools/databuilder/__main__.py
index 36d99207e554fa07d071e7775cc9f007072fa972..88815aac84fde193f25d9b0e779c83eefa769394 100644 (file)
@@ -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)
index d599e33c82f49e4d0cbe7ead46d6630be5634779..47d3749c842e3bb0912d0b8ebd7005083703b794 100644 (file)
@@ -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):
index 879af99f991514b4b3d11230f7dffef59fb15f4f..2809efd0ca3ef5205b50849cfa0b141ed6141500 100644 (file)
@@ -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)" \
index 120db6844f25b4faeef6422f5f32d81fdfb93aa7..6f3a13a0a6107c77d0cc48269e0810b1616cbdf7 100644 (file)
@@ -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;
     }