|
|
|
@ -33,9 +33,10 @@ if T.TYPE_CHECKING: |
|
|
|
|
from ._typing import ImmutableListProtocol |
|
|
|
|
from .mesonlib import ExecutableSerialisation |
|
|
|
|
|
|
|
|
|
archive_choices = ['gztar', 'xztar', 'zip'] |
|
|
|
|
archive_choices = ['bztar', 'gztar', 'xztar', 'zip'] |
|
|
|
|
|
|
|
|
|
archive_extension = {'gztar': '.tar.gz', |
|
|
|
|
archive_extension = {'bztar': '.tar.bz2', |
|
|
|
|
'gztar': '.tar.gz', |
|
|
|
|
'xztar': '.tar.xz', |
|
|
|
|
'zip': '.zip'} |
|
|
|
|
|
|
|
|
@ -47,7 +48,7 @@ def add_arguments(parser: argparse.ArgumentParser) -> None: |
|
|
|
|
parser.add_argument('--allow-dirty', action='store_true', |
|
|
|
|
help='Allow even when repository contains uncommitted changes.') |
|
|
|
|
parser.add_argument('--formats', default='xztar', |
|
|
|
|
help='Comma separated list of archive types to create. Supports xztar (default), gztar, and zip.') |
|
|
|
|
help='Comma separated list of archive types to create. Supports xztar (default), bztar, gztar, and zip.') |
|
|
|
|
parser.add_argument('--include-subprojects', action='store_true', |
|
|
|
|
help='Include source code of subprojects that have been used for the build.') |
|
|
|
|
parser.add_argument('--no-tests', action='store_true', |
|
|
|
@ -230,6 +231,7 @@ class HgDist(Dist): |
|
|
|
|
os.makedirs(self.dist_sub, exist_ok=True) |
|
|
|
|
tarname = os.path.join(self.dist_sub, self.dist_name + '.tar') |
|
|
|
|
xzname = tarname + '.xz' |
|
|
|
|
bz2name = tarname + '.bz2' |
|
|
|
|
gzname = tarname + '.gz' |
|
|
|
|
zipname = os.path.join(self.dist_sub, self.dist_name + '.zip') |
|
|
|
|
# Note that -X interprets relative paths using the current working |
|
|
|
@ -248,6 +250,11 @@ class HgDist(Dist): |
|
|
|
|
with lzma.open(xzname, 'wb') as xf, open(tarname, 'rb') as tf: |
|
|
|
|
shutil.copyfileobj(tf, xf) |
|
|
|
|
output_names.append(xzname) |
|
|
|
|
if 'bztar' in archives: |
|
|
|
|
import bz2 |
|
|
|
|
with bz2.open(bz2name, 'wb') as bf, open(tarname, 'rb') as tf: |
|
|
|
|
shutil.copyfileobj(tf, bf) |
|
|
|
|
output_names.append(bz2name) |
|
|
|
|
if 'gztar' in archives: |
|
|
|
|
with gzip.open(gzname, 'wb') as zf, open(tarname, 'rb') as tf: |
|
|
|
|
shutil.copyfileobj(tf, zf) |
|
|
|
|