aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--project/boost/download.py12
-rw-r--r--project/ci/boost.py8
2 files changed, 13 insertions, 7 deletions
diff --git a/project/boost/download.py b/project/boost/download.py
index d1fc8ea..c3451a8 100644
--- a/project/boost/download.py
+++ b/project/boost/download.py
@@ -20,6 +20,7 @@ Usage examples:
import argparse
from contextlib import contextmanager
import logging
+import os
import sys
import urllib.request
@@ -68,7 +69,7 @@ def _download_if_necessary(version, storage):
class DownloadParameters:
- def __init__(self, version, unpack_dir=None, cache_dir=None):
+ def __init__(self, version, unpack_dir=None, cache_dir=None, dest_path=None):
if unpack_dir is None:
if cache_dir is None:
unpack_dir = '.'
@@ -81,17 +82,23 @@ class DownloadParameters:
if cache_dir is not None:
cache_dir = normalize_path(cache_dir)
self.storage = PermanentStorage(cache_dir)
+ self.dest_path = dest_path
@staticmethod
def from_args(args):
return DownloadParameters(**vars(args))
+ def rename_if_necessary(self, boost_dir):
+ if self.dest_path is not None:
+ os.rename(boost_dir.path, self.dest_path)
+
def download(params):
with _download_if_necessary(params.version, params.storage) as path:
archive = Archive(params.version, path)
boost_dir = archive.unpack(params.unpack_dir)
boost_dir.bootstrap()
+ params.rename_if_necessary(boost_dir)
def _parse_args(argv=None):
@@ -112,6 +119,9 @@ def _parse_args(argv=None):
parser.add_argument('version', metavar='VERSION',
type=Version.from_string,
help='Boost version (in the MAJOR.MINOR.PATCH format)')
+ parser.add_argument('dest_path', metavar='DIR', nargs='?',
+ type=normalize_path,
+ help='rename the boost directory to DIR')
return parser.parse_args(argv)
diff --git a/project/ci/boost.py b/project/ci/boost.py
index 75e73f3..c17c9db 100644
--- a/project/ci/boost.py
+++ b/project/ci/boost.py
@@ -5,8 +5,6 @@
import argparse
import logging
-import os
-import os.path
import sys
from project.boost.download import DownloadParameters, download
@@ -43,11 +41,9 @@ def build_ci(dirs, argv=None):
version = dirs.get_boost_version()
build_dir = dirs.get_build_dir()
- download(DownloadParameters(version, unpack_dir=build_dir))
-
- unpacked_boost_dir = version.dir_path(build_dir)
boost_dir = dirs.get_boost_dir()
- os.rename(unpacked_boost_dir, boost_dir)
+ params = DownloadParameters(version, unpack_dir=build_dir, dest_path=boost_dir)
+ download(params)
params = BuildParameters(boost_dir,
platforms=(dirs.get_platform(),),