-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version floor for transfer feature (#3957)
- Loading branch information
1 parent
5d80bae
commit 7230084
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,7 +182,8 @@ def create_transfer_manager(client, config, osutil=None): | |
|
||
|
||
def _should_use_crt(config): | ||
if HAS_CRT: | ||
# This feature requires awscrt>=0.19.17 | ||
if HAS_CRT and has_minimum_crt_version((0, 19, 17)): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nateprewitt
Author
Contributor
|
||
is_optimized_instance = awscrt.s3.is_optimized_for_system() | ||
else: | ||
is_optimized_instance = False | ||
|
@@ -205,6 +206,21 @@ def _should_use_crt(config): | |
return False | ||
|
||
|
||
def has_minimum_crt_version(minimum_version): | ||
"""Not intended for use outside boto3.""" | ||
if not HAS_CRT: | ||
return False | ||
|
||
crt_version_str = awscrt.__version__ | ||
try: | ||
crt_version_ints = map(int, crt_version_str.split(".")) | ||
crt_version_tuple = tuple(crt_version_ints) | ||
except (TypeError, ValueError): | ||
return False | ||
|
||
return crt_version_tuple >= minimum_version | ||
|
||
|
||
def _create_default_transfer_manager(client, config, osutil): | ||
"""Create the default TransferManager implementation for s3transfer.""" | ||
executor_cls = None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
looking at how has_minimum_crt_version is implemented, the check for HAS_CRT is extraneous