summaryrefslogtreecommitdiff
path: root/tools/normalize_path.py
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2015-10-28 14:33:40 -0700
committerYing Wang <wangying@google.com>2015-10-28 15:20:41 -0700
commita17426104219f3c06244f92d73b6c938949d0fe3 (patch)
tree4ae96fc8323b274c3a79aa84a6536a81ffb86183 /tools/normalize_path.py
parentdda5e96b144c15a75d625ceac7e92b50cf9c363a (diff)
Normalize the product makefile path in inherit-product.
Some vendor product makefiles call $(inherit-product) on the same product makefile with different paths, by using "../" in relative paths. However inherit-product requires unique path as ID for a product makefile, for bookkeeping purpose. Normalize the product makefile path in inherit-product, if the path contains "../". Change-Id: I1a864ce120c713d8e79ec179213b9fc9352aba53
Diffstat (limited to 'tools/normalize_path.py')
-rwxr-xr-xtools/normalize_path.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/normalize_path.py b/tools/normalize_path.py
index 1b3d42e64c..6c4d5486dc 100755
--- a/tools/normalize_path.py
+++ b/tools/normalize_path.py
@@ -14,11 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
-Normalize and output paths read from stdin.
+Normalize and output paths from arguments, or stdin if no arguments provided.
"""
import os.path
import sys
+if len(sys.argv) > 1:
+ for p in sys.argv[1:]:
+ print os.path.normpath(p)
+ sys.exit(0)
+
for line in sys.stdin:
print os.path.normpath(line.strip())