Skip to content

Commit

Permalink
fix python binding build with deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Dec 15, 2020
1 parent 53a2a35 commit 735c486
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ jobs:
run: |
cd bindings/python
b2 -j2 stage_module stage_dependencies
b2 -j2 deprecated-functions=off
- name: run python tests
run: |
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/src/create_torrent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ void bind_create_torrent()
.def("set_file_hash", &set_file_hash)
#endif
.def("add_url_seed", &create_torrent::add_url_seed)
#if TORRENT_ABI_VERSION < 4
.def("add_http_seed", &create_torrent::add_http_seed)
#endif
.def("add_node", &add_node)
.def("add_tracker", add_tracker, (arg("announce_url"), arg("tier") = 0))
.def("set_priv", &create_torrent::set_priv)
Expand Down
4 changes: 4 additions & 0 deletions bindings/python/src/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,14 @@ namespace
p.url_seeds = extract<std::vector<std::string>>(value);
continue;
}
#if TORRENT_ABI_VERSION < 4
else if(key == "http_seeds")
{
p.http_seeds =
extract<decltype(add_torrent_params::http_seeds)>(value);
continue;
}
#endif
else if(key == "dht_nodes")
{
p.dht_nodes =
Expand Down Expand Up @@ -831,7 +833,9 @@ void bind_session()
.def_readwrite("info_hash", &add_torrent_params::info_hash)
#endif
.def_readwrite("info_hashes", &add_torrent_params::info_hashes)
#if TORRENT_ABI_VERSION < 4
.add_property("http_seeds", PROP(&add_torrent_params::http_seeds))
#endif
.add_property("url_seeds", PROP(&add_torrent_params::url_seeds))
.add_property("peers", PROP(&add_torrent_params::peers))
.add_property("banned_peers", PROP(&add_torrent_params::banned_peers))
Expand Down
4 changes: 4 additions & 0 deletions bindings/python/src/torrent_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace
return ret;
}

#if TORRENT_ABI_VERSION < 4
list http_seeds(torrent_handle& handle)
{
list ret;
Expand All @@ -56,6 +57,7 @@ namespace
ret.append(*i);
return ret;
}
#endif

list piece_availability(torrent_handle& handle)
{
Expand Down Expand Up @@ -491,9 +493,11 @@ void bind_torrent_handle()
.def("add_url_seed", _(&torrent_handle::add_url_seed))
.def("remove_url_seed", _(&torrent_handle::remove_url_seed))
.def("url_seeds", url_seeds)
#if TORRENT_ABI_VERSION < 4
.def("add_http_seed", _(&torrent_handle::add_http_seed))
.def("remove_http_seed", _(&torrent_handle::remove_http_seed))
.def("http_seeds", http_seeds)
#endif
.def("torrent_file", _(&torrent_handle::torrent_file))
.def("set_metadata", set_metadata)
.def("is_valid", _(&torrent_handle::is_valid))
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/src/torrent_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ void bind_torrent_info()

.def("add_tracker", (add_tracker1)&torrent_info::add_tracker, arg("url"), arg("tier") = 0, arg("source") = announce_entry::source_client)
.def("add_url_seed", &torrent_info::add_url_seed)
#if TORRENT_ABI_VERSION < 4
.def("add_http_seed", &torrent_info::add_http_seed)
#endif
.def("web_seeds", get_web_seeds)
.def("set_web_seeds", set_web_seeds)

Expand Down

0 comments on commit 735c486

Please sign in to comment.