aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-03-14 11:01:39 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-03-14 14:53:06 +0300
commit8ceaf795d891b75fead6893c8efe8d999b7ff551 (patch)
tree9b2180082b034141a81bd227df86fa3c5ca31043 /project
parentworkflows/ci_appveyor: create C:\projects before caching (diff)
downloadcmake-common-8ceaf795d891b75fead6893c8efe8d999b7ff551.tar.gz
cmake-common-8ceaf795d891b75fead6893c8efe8d999b7ff551.zip
project.boost.download: create missing directories
Diffstat (limited to 'project')
-rw-r--r--project/boost/download.py14
-rw-r--r--project/cmake/build.py5
-rw-r--r--project/utils.py4
3 files changed, 16 insertions, 7 deletions
diff --git a/project/boost/download.py b/project/boost/download.py
index ca113a6..a065dab 100644
--- a/project/boost/download.py
+++ b/project/boost/download.py
@@ -26,7 +26,7 @@ import urllib.request
from project.boost.archive import Archive, PermanentStorage, TemporaryStorage
from project.boost.version import Version
-from project.utils import normalize_path, retry, setup_logging
+from project.utils import normalize_path, mkdir_parent, retry, setup_logging
@retry(urllib.request.URLError)
@@ -76,11 +76,17 @@ class DownloadParameters:
else:
unpack_dir = cache_dir
- self.version = version
- self.unpack_dir = normalize_path(unpack_dir)
- self.storage = TemporaryStorage(unpack_dir)
+ unpack_dir = normalize_path(unpack_dir)
+ mkdir_parent(unpack_dir)
if cache_dir is not None:
cache_dir = normalize_path(cache_dir)
+ mkdir_parent(cache_dir)
+
+ self.version = version
+ self.unpack_dir = unpack_dir
+ if cache_dir is None:
+ self.storage = TemporaryStorage(unpack_dir)
+ else:
self.storage = PermanentStorage(cache_dir)
self.dest_path = dest_path
diff --git a/project/cmake/build.py b/project/cmake/build.py
index ee5772e..1e9a90d 100644
--- a/project/cmake/build.py
+++ b/project/cmake/build.py
@@ -31,7 +31,7 @@ from project.cmake.toolchain import Toolchain
from project.configuration import Configuration
from project.platform import Platform
from project.toolchain import ToolchainType
-from project.utils import normalize_path, run, setup_logging
+from project.utils import normalize_path, mkdir_parent, run, setup_logging
DEFAULT_PLATFORM = None
@@ -153,8 +153,7 @@ class BuildParameters:
def create_build_dir(self):
if self.build_dir is not None:
logging.info('Build directory: %s', self.build_dir)
- if not os.path.exists(self.build_dir):
- os.makedirs(self.build_dir, exist_ok=True)
+ mkdir_parent(self.build_dir)
yield self.build_dir
return
diff --git a/project/utils.py b/project/utils.py
index 76557b1..c63b8a4 100644
--- a/project/utils.py
+++ b/project/utils.py
@@ -16,6 +16,10 @@ def normalize_path(s):
return os.path.abspath(os.path.normpath(s))
+def mkdir_parent(path):
+ os.makedirs(path, exist_ok=True)
+
+
@contextmanager
def setup_logging():
logging.basicConfig(