diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-01-04 00:54:23 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-01-04 00:54:23 +0300 |
commit | a301779304f1a9779b4bd2874d5a8c583e886d03 (patch) | |
tree | d3c976b449948d0bc9736f54792046c499527b74 /boost | |
parent | boost/build: overhaul `build.py download` (diff) | |
download | cmake-common-a301779304f1a9779b4bd2874d5a8c583e886d03.tar.gz cmake-common-a301779304f1a9779b4bd2874d5a8c583e886d03.zip |
boost/build: download older Boost releases from SourceForge
Diffstat (limited to '')
-rwxr-xr-x | boost/build/build.py | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/boost/build/build.py b/boost/build/build.py index 7668330..032bdab 100755 --- a/boost/build/build.py +++ b/boost/build/build.py @@ -12,8 +12,10 @@ import abc import argparse +from collections import namedtuple from contextlib import contextmanager from enum import Enum +from functools import total_ordering import logging import os.path import platform @@ -98,18 +100,41 @@ def _parse_configuration(s): raise argparse.ArgumentTypeError(f'invalid configuration: {s}') +Version = namedtuple('Version', ['major', 'minor', 'patch']) + + +@total_ordering class BoostVersion: def __init__(self, major, minor, patch): - self.major = major - self.minor = minor - self.patch = patch + self._impl = Version(major, minor, patch) + + @property + def major(self): + return self._impl.major + + @property + def minor(self): + return self._impl.minor + + @property + def patch(self): + return self._impl.patch + + def __lt__(self, other): + return self._impl < other._impl + + def __eq__(self, other): + return self._impl == other._impl @staticmethod def from_string(s): result = re.match(r'^(\d+)\.(\d+)\.(\d+)$', s) if result is None: raise ValueError(f'invalid Boost version: {s}') - return BoostVersion(result.group(1), result.group(2), result.group(3)) + major = int(result.group(1)) + minor = int(result.group(2)) + patch = int(result.group(3)) + return BoostVersion(major, minor, patch) def __str__(self): return f'{self.major}.{self.minor}.{self.patch}' @@ -130,6 +155,8 @@ class BoostVersion: return f'{self.dir_name}{self.archive_ext}' def get_download_url(self): + if self._impl < Version(1, 63, 0): + return f'https://sourceforge.net/projects/boost/files/boost/{self}/{self.archive_name}/download' return f'https://dl.bintray.com/boostorg/release/{self}/source/{self.archive_name}' |