Skip to content

Commit

Permalink
Fixed python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanMabille committed Sep 26, 2023
1 parent 431a0e2 commit 43488f7
Show file tree
Hide file tree
Showing 8 changed files with 508 additions and 193 deletions.
10 changes: 7 additions & 3 deletions libmamba/include/mamba/core/download.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace mamba
bool sort = true;
termination_function on_unexpected_termination = std::nullopt;
};

class DownloadMonitor
{
public:
Expand All @@ -118,8 +118,12 @@ namespace mamba
DownloadMonitor() = default;
};

MultiDownloadResult
download(MultiDownloadRequest requests, const Context& context, DownloadOptions options = {}, DownloadMonitor* monitor = nullptr);
MultiDownloadResult download(
MultiDownloadRequest requests,
const Context& context,
DownloadOptions options = {},
DownloadMonitor* monitor = nullptr
);

}

Expand Down
3 changes: 1 addition & 2 deletions libmamba/src/api/channel_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace mamba
expected_t<void> download_res;
if (DownloadProgressBar::can_monitor(ctx))
{
DownloadProgressBar check_monitor({true, true});
DownloadProgressBar check_monitor({ true, true });
DownloadProgressBar index_monitor;
download_res = MSubdirData::download_indexes(subdirs, ctx, &check_monitor, &index_monitor);
}
Expand All @@ -120,7 +120,6 @@ namespace mamba
{
return tl::unexpected(mamba_aggregated_error(std::move(error_list)));
}

}

if (ctx.offline)
Expand Down
8 changes: 6 additions & 2 deletions libmamba/src/core/download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,12 @@ namespace mamba
{
}

MultiDownloadResult
download(MultiDownloadRequest requests, const Context& context, DownloadOptions options, DownloadMonitor* monitor)
MultiDownloadResult download(
MultiDownloadRequest requests,
const Context& context,
DownloadOptions options,
DownloadMonitor* monitor
)
{
if (!context.remote_fetch_params.curl_initialized)
{
Expand Down
4 changes: 2 additions & 2 deletions libmamba/src/core/download_progress_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace mamba
: m_options(std::move(options))
{
}

void DownloadProgressBar::reset_options(MonitorOptions options)
{
m_options = std::move(options);
Expand Down Expand Up @@ -43,7 +43,7 @@ namespace mamba
{
pbar_manager.watch_print();
}

options.on_unexpected_termination = [this]() { on_unexpected_termination(); };
}

Expand Down
2 changes: 1 addition & 1 deletion libmamba/src/core/subdirdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ namespace mamba
}
}
download(std::move(check_requests), context, {}, check_monitor);

if (is_sig_interrupted())
{
return make_unexpected("Interrupted by user", mamba_error_code::user_interrupted);
Expand Down
Loading

0 comments on commit 43488f7

Please sign in to comment.