pw_build: Restructure as Python package
Change-Id: I2c0d2412f4ae6cd350591ad563931f9493bde6bd
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/14720
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
diff --git a/pw_build/exec.gni b/pw_build/exec.gni
index 3e51d57..9641f26 100644
--- a/pw_build/exec.gni
+++ b/pw_build/exec.gni
@@ -109,7 +109,7 @@
}
pw_python_script(target_name) {
- script = "$dir_pw_build/py/exec.py"
+ script = "$dir_pw_build/py/pw_build/exec.py"
args = _script_args
forward_variables_from(invoker,
diff --git a/pw_build/facade.gni b/pw_build/facade.gni
index a9b3d3a..e9604fc 100644
--- a/pw_build/facade.gni
+++ b/pw_build/facade.gni
@@ -91,7 +91,7 @@
pw_python_script(_main_target_name + "_NO_BACKEND_SET") {
stamp = true
- script = "$dir_pw_build/py/null_backend.py"
+ script = "$dir_pw_build/py/pw_build/null_backend.py"
args = [ _main_target_name ]
not_needed(invoker, "*")
}
diff --git a/pw_build/host_tool.gni b/pw_build/host_tool.gni
index b9890bb..4ace101 100644
--- a/pw_build/host_tool.gni
+++ b/pw_build/host_tool.gni
@@ -60,7 +60,7 @@
}
pw_python_script(target_name) {
- script = "$dir_pw_build/py/host_tool.py"
+ script = "$dir_pw_build/py/pw_build/host_tool.py"
args = _script_args
deps = _deps
stamp = true
diff --git a/pw_build/input_group.gni b/pw_build/input_group.gni
index b1cfd3f..3c71453 100644
--- a/pw_build/input_group.gni
+++ b/pw_build/input_group.gni
@@ -30,7 +30,7 @@
"stamp",
]
forward_variables_from(invoker, "*", ignore_vars)
- script = "$dir_pw_build/py/nop.py"
+ script = "$dir_pw_build/py/pw_build/nop.py"
stamp = true
}
}
diff --git a/pw_build/py/exec.py b/pw_build/py/pw_build/exec.py
similarity index 100%
rename from pw_build/py/exec.py
rename to pw_build/py/pw_build/exec.py
diff --git a/pw_build/py/host_tool.py b/pw_build/py/pw_build/host_tool.py
similarity index 100%
rename from pw_build/py/host_tool.py
rename to pw_build/py/pw_build/host_tool.py
diff --git a/pw_build/py/nop.py b/pw_build/py/pw_build/nop.py
similarity index 100%
rename from pw_build/py/nop.py
rename to pw_build/py/pw_build/nop.py
diff --git a/pw_build/py/null_backend.py b/pw_build/py/pw_build/null_backend.py
similarity index 100%
rename from pw_build/py/null_backend.py
rename to pw_build/py/pw_build/null_backend.py
diff --git a/pw_build/py/python_runner.py b/pw_build/py/pw_build/python_runner.py
similarity index 100%
rename from pw_build/py/python_runner.py
rename to pw_build/py/pw_build/python_runner.py
diff --git a/pw_build/py/setup.py b/pw_build/py/setup.py
new file mode 100644
index 0000000..784b8e0
--- /dev/null
+++ b/pw_build/py/setup.py
@@ -0,0 +1,25 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+"""pw_build"""
+
+import setuptools
+
+setuptools.setup(
+ name='pw_build',
+ version='0.0.1',
+ author='Pigweed Authors',
+ author_email='pigweed-developers@googlegroups.com',
+ description='Python scripts that support the GN build',
+ packages=setuptools.find_packages(),
+)
diff --git a/pw_build/python_script.gni b/pw_build/python_script.gni
index a8f1782..b251a41 100644
--- a/pw_build/python_script.gni
+++ b/pw_build/python_script.gni
@@ -138,7 +138,7 @@
]
forward_variables_from(invoker, "*", _ignore_vars)
- script = "$dir_pw_build/py/python_runner.py"
+ script = "$dir_pw_build/py/pw_build/python_runner.py"
args = _script_args
inputs = _inputs
outputs = _outputs
diff --git a/pw_toolchain/host_clang/BUILD.gn b/pw_toolchain/host_clang/BUILD.gn
index 8b1e642..529b6e1 100644
--- a/pw_toolchain/host_clang/BUILD.gn
+++ b/pw_toolchain/host_clang/BUILD.gn
@@ -34,7 +34,7 @@
# Locate XCode's sysroot for Clang.
config("xcode_sysroot") {
if (host_os == "mac") {
- _xcode_sysroot = exec_script("$dir_pw_build/py/exec.py",
+ _xcode_sysroot = exec_script("$dir_pw_build/py/pw_build/exec.py",
[
"--",
"/usr/bin/xcrun",
diff --git a/pw_unit_test/test.gni b/pw_unit_test/test.gni
index 42b1c51..f288341 100644
--- a/pw_unit_test/test.gni
+++ b/pw_unit_test/test.gni
@@ -51,7 +51,7 @@
# action with the original target's sources as inputs to ensure that
# the source files exist (even if they don't compile).
pw_python_script(target_name) {
- script = "$dir_pw_build/py/nop.py"
+ script = "$dir_pw_build/py/pw_build/nop.py"
stamp = true
inputs = []