diff options
Diffstat (limited to '')
| -rw-r--r-- | project/boost/archive.py | 4 | ||||
| -rw-r--r-- | project/boost/build.py | 12 | ||||
| -rw-r--r-- | project/boost/directory.py | 10 | ||||
| -rw-r--r-- | project/boost/download.py | 20 |
4 files changed, 24 insertions, 22 deletions
diff --git a/project/boost/archive.py b/project/boost/archive.py index efed3a0..04a5842 100644 --- a/project/boost/archive.py +++ b/project/boost/archive.py @@ -10,7 +10,7 @@ import os.path import shutil from project.boost.directory import BoostDir -from project.utils import temp_file +from project import utils class Archive: @@ -75,7 +75,7 @@ class TemporaryStorage(ArchiveStorage): @contextmanager def write_archive(self, version, contents): - tmp = temp_file( + tmp = utils.temp_file( prefix=f"boost_{version}_", suffix=version.archive_ext, dir=self._dir ) with tmp as archive_path: diff --git a/project/boost/build.py b/project/boost/build.py index 98b605a..bbe2d91 100644 --- a/project/boost/build.py +++ b/project/boost/build.py @@ -38,7 +38,7 @@ from project.configuration import Configuration from project.linkage import Linkage from project.platform import Platform from project.toolset import Toolset, ToolsetVersion -from project.utils import normalize_path, setup_logging +from project import utils import project.version DEFAULT_PLATFORMS = (Platform.AUTO,) @@ -66,10 +66,10 @@ class BuildParameters: b2_args=None, ): - boost_dir = normalize_path(boost_dir) + boost_dir = utils.normalize_path(boost_dir) libraries = libraries or [] if build_dir is not None: - build_dir = normalize_path(build_dir) + build_dir = utils.normalize_path(build_dir) platforms = platforms or DEFAULT_PLATFORMS configurations = configurations or DEFAULT_CONFIGURATIONS link = link or Linkage.default_link() @@ -228,7 +228,7 @@ def _parse_args(argv=None): "--build", metavar="DIR", dest="build_dir", - type=normalize_path, + type=utils.normalize_path, help="Boost build directory (temporary directory unless specified)", ) @@ -244,7 +244,7 @@ def _parse_args(argv=None): parser.add_argument( "boost_dir", metavar="BOOST_DIR", - type=normalize_path, + type=utils.normalize_path, help="root Boost directory", ) parser.add_argument( @@ -260,7 +260,7 @@ def _parse_args(argv=None): def _main(argv=None): args = _parse_args(argv) - with setup_logging(): + with utils.setup_logging(): build(BuildParameters.from_cmd_args(args)) diff --git a/project/boost/directory.py b/project/boost/directory.py index 1cb3a77..cc3d129 100644 --- a/project/boost/directory.py +++ b/project/boost/directory.py @@ -8,7 +8,7 @@ import os.path from project.os import on_windows from project.toolset import Toolset -from project.utils import cd, run +from project import utils class BoostDir: @@ -18,7 +18,7 @@ class BoostDir: self.path = path def _go(self): - return cd(self.path) + return utils.cd(self.path) def build(self, params): with self._go(): @@ -33,11 +33,13 @@ class BoostDir: def bootstrap(self, params): with self._go(): - run([self._bootstrap_path()] + self._bootstrap_args(params.toolset_version)) + utils.run( + [self._bootstrap_path()] + self._bootstrap_args(params.toolset_version) + ) def _b2(self, params): for b2_params in params.enum_b2_args(): - run([self._b2_path()] + b2_params) + utils.run([self._b2_path()] + b2_params) @staticmethod def _bootstrap_path(): diff --git a/project/boost/download.py b/project/boost/download.py index 1576bab..2780be6 100644 --- a/project/boost/download.py +++ b/project/boost/download.py @@ -27,7 +27,7 @@ import urllib.request from project.boost.archive import Archive, PermanentStorage, TemporaryStorage from project.boost.version import Version -from project.utils import normalize_path, mkdir_parent, retry, setup_logging +from project import utils import project.version @@ -41,11 +41,11 @@ class Download: else: unpack_dir = cache_dir - unpack_dir = normalize_path(unpack_dir) - mkdir_parent(unpack_dir) + unpack_dir = utils.normalize_path(unpack_dir) + utils.mkdir_parent(unpack_dir) if cache_dir is not None: - cache_dir = normalize_path(cache_dir) - mkdir_parent(cache_dir) + cache_dir = utils.normalize_path(cache_dir) + utils.mkdir_parent(cache_dir) self.version = version self.unpack_dir = unpack_dir @@ -70,7 +70,7 @@ class Download: return request.read() @staticmethod - @retry(urllib.request.URLError) + @utils.retry(urllib.request.URLError) def _download_url_retry(url): return Download._download_url(url) @@ -135,14 +135,14 @@ def _parse_args(argv=None): "--unpack", metavar="DIR", dest="unpack_dir", - type=normalize_path, + type=utils.normalize_path, help="directory to unpack the archive to", ) parser.add_argument( "--cache", metavar="DIR", dest="cache_dir", - type=normalize_path, + type=utils.normalize_path, help="download directory (temporary file unless specified)", ) parser.add_argument( @@ -160,7 +160,7 @@ def _parse_args(argv=None): "dest_path", metavar="DIR", nargs="?", - type=normalize_path, + type=utils.normalize_path, help="rename the boost directory to DIR", ) @@ -169,7 +169,7 @@ def _parse_args(argv=None): def _main(argv=None): args = _parse_args(argv) - with setup_logging(): + with utils.setup_logging(): download(Download.from_args(args)) |
