Skip to content

Commit

Permalink
address
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Feb 24, 2022
1 parent 595d666 commit 49348e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
9 changes: 4 additions & 5 deletions datadog_checks_downloader/datadog_checks/downloader/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ def download():
sys.exit(1)

tuf_downloader = TUFDownloader(
repository_url_prefix=repository_url_prefix,
root_layout_type=root_layout_type,
ignore_python_version=ignore_python_version,
verbose=verbose,
repository_url_prefix=repository_url_prefix, root_layout_type=root_layout_type, verbose=verbose
)
wheel_relpath = tuf_downloader.get_wheel_relpath(
standard_distribution_name, version=version, ignore_python_version=ignore_python_version
)
wheel_relpath = tuf_downloader.get_wheel_relpath(standard_distribution_name, version=version)
wheel_abspath = tuf_downloader.download(wheel_relpath)
print(wheel_abspath) # pylint: disable=print-statement
11 changes: 3 additions & 8 deletions datadog_checks_downloader/datadog_checks/downloader/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@

class TUFDownloader:
def __init__(
self,
repository_url_prefix=REPOSITORY_URL_PREFIX,
root_layout_type=DEFAULT_ROOT_LAYOUT_TYPE,
ignore_python_version=False,
verbose=0,
self, repository_url_prefix=REPOSITORY_URL_PREFIX, root_layout_type=DEFAULT_ROOT_LAYOUT_TYPE, verbose=0
):
# 0 => 60 (effectively /dev/null)
# 1 => 50 (CRITICAL)
Expand All @@ -79,7 +75,6 @@ def __init__(

tuf_settings.repositories_directory = REPOSITORIES_DIR

self.__ignore_python_version = ignore_python_version
self.__root_layout_type = root_layout_type
self.__root_layout = ROOT_LAYOUTS[self.__root_layout_type]

Expand Down Expand Up @@ -308,7 +303,7 @@ def __get_versions(self, standard_distribution_name):

return wheels

def get_wheel_relpath(self, standard_distribution_name, version=None):
def get_wheel_relpath(self, standard_distribution_name, version=None, ignore_python_version=False):
"""
Returns:
If download over TUF is successful, this function will return the
Expand Down Expand Up @@ -337,7 +332,7 @@ def get_wheel_relpath(self, standard_distribution_name, version=None):

# Otherwise, fuhgedaboutit.
if not href:
if self.__ignore_python_version:
if ignore_python_version:
href = list(python_tags.values())[0]
else:
raise PythonVersionMismatch(standard_distribution_name, version, this_python, python_tags)
Expand Down

0 comments on commit 49348e5

Please sign in to comment.