|
163 | 163 | '.sh': "cp -a %(filepath)s .", |
164 | 164 | } |
165 | 165 |
|
| 166 | +ZIPPED_PATCH_EXTS = ('.bz2', '.gz', '.xz') |
| 167 | + |
166 | 168 | # global set of names of locks that were created in this session |
167 | 169 | global_lock_names = set() |
168 | 170 |
|
@@ -1493,8 +1495,11 @@ def create_patch_info(patch_spec): |
1493 | 1495 | str(patch_spec)) |
1494 | 1496 |
|
1495 | 1497 | elif isinstance(patch_spec, string_type): |
1496 | | - if not patch_spec.endswith('.patch'): |
1497 | | - _log.deprecated("Use of patch file with filename that doesn't end with .patch: %s" % patch_spec, '5.0') |
| 1498 | + allowed_patch_exts = ['.patch' + x for x in ('',) + ZIPPED_PATCH_EXTS] |
| 1499 | + if not any(patch_spec.endswith(x) for x in allowed_patch_exts): |
| 1500 | + msg = "Use of patch file with filename that doesn't end with correct extension: %s " % patch_spec |
| 1501 | + msg += "(should be any of: %s)" % (', '.join(allowed_patch_exts)) |
| 1502 | + _log.deprecated(msg, '5.0') |
1498 | 1503 | patch_info = {'name': patch_spec} |
1499 | 1504 | else: |
1500 | 1505 | error_msg = "Wrong patch spec, should be string of 2-tuple with patch name + argument: %s" |
@@ -1548,7 +1553,7 @@ def apply_patch(patch_file, dest, fn=None, copy=False, level=None, use_git_am=Fa |
1548 | 1553 | # split in stem (filename w/o extension) + extension |
1549 | 1554 | patch_stem, patch_extension = os.path.splitext(os.path.split(abs_patch_file)[1]) |
1550 | 1555 | # Supports only bz2, gz and xz. zip can be archives which are not supported. |
1551 | | - if patch_extension in ['.gz', '.bz2', '.xz']: |
| 1556 | + if patch_extension in ZIPPED_PATCH_EXTS: |
1552 | 1557 | # split again to get the second extension |
1553 | 1558 | patch_subextension = os.path.splitext(patch_stem)[1] |
1554 | 1559 | if patch_subextension == ".patch": |
|
0 commit comments