aboutsummaryrefslogtreecommitdiffstats
path: root/utils/llvm-build
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-11-05 04:07:49 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-11-05 04:07:49 +0000
commit195c6f36634ae1579d4457c188d9b058fbab9973 (patch)
tree93888e7607122f0a1925fb4484fecd2fda1523c9 /utils/llvm-build
parent57574fa35e3fe766b5a5cc6becd9b56ae0aed17a (diff)
downloadexternal_llvm-195c6f36634ae1579d4457c188d9b058fbab9973.zip
external_llvm-195c6f36634ae1579d4457c188d9b058fbab9973.tar.gz
external_llvm-195c6f36634ae1579d4457c188d9b058fbab9973.tar.bz2
utils/llvm-build: Ensure output directory exists for tools which write various fragments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/llvm-build')
-rw-r--r--utils/llvm-build/llvmbuild/main.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
index 5932fb9..f635526 100644
--- a/utils/llvm-build/llvmbuild/main.py
+++ b/utils/llvm-build/llvmbuild/main.py
@@ -31,6 +31,17 @@ def mk_quote_string_for_target(value):
# The only quoting we currently perform is for ':', to support msys users.
return value.replace(":", "\\:")
+def make_install_dir(path):
+ """
+ make_install_dir(path) -> None
+
+ Create the given directory path for installation, including any parents.
+ """
+
+ # os.makedirs considers it an error to be called with an existant path.
+ if not os.path.exists(path):
+ os.makedirs(path)
+
###
class LLVMProjectInfo(object):
@@ -276,6 +287,7 @@ class LLVMProjectInfo(object):
for _,_,deps in entries) + 1
# Write out the library table.
+ make_install_dir(os.path.dirname(output_path))
f = open(output_path, 'w')
print >>f, """\
//===- llvm-build generated file --------------------------------*- C++ -*-===//
@@ -360,6 +372,7 @@ class LLVMProjectInfo(object):
dependencies = list(self.get_fragment_dependencies())
# Write out the CMake fragment.
+ make_install_dir(os.path.dirname(output_path))
f = open(output_path, 'w')
# Write the header.
@@ -419,6 +432,7 @@ configure_file(\"%s\"
dependencies = list(self.get_fragment_dependencies())
# Write out the Makefile fragment.
+ make_install_dir(os.path.dirname(output_path))
f = open(output_path, 'w')
# Write the header.