make python bindinga build without deprecated functions

This commit is contained in:
Arvid Norberg 2013-08-28 02:38:31 +00:00
parent 50f98c124f
commit d616d3592b
3 changed files with 20 additions and 17 deletions

View File

@ -158,7 +158,9 @@ void bind_session_settings()
.def_readwrite("utp_fin_resends", &session_settings::utp_fin_resends)
.def_readwrite("utp_num_resends", &session_settings::utp_num_resends)
.def_readwrite("utp_connect_timeout", &session_settings::utp_connect_timeout)
#ifndef TORRENT_NO_DEPRECATE
.def_readwrite("utp_delayed_ack", &session_settings::utp_delayed_ack)
#endif
.def_readwrite("utp_dynamic_sock_buf", &session_settings::utp_dynamic_sock_buf)
.def_readwrite("utp_loss_multiplier", &session_settings::utp_loss_multiplier)
.def_readwrite("mixed_mode_algorithm", &session_settings::mixed_mode_algorithm)

View File

@ -83,7 +83,7 @@ list file_progress(torrent_handle& handle)
{
allow_threading_guard guard;
p.reserve(handle.get_torrent_info().num_files());
p.reserve(handle.torrent_file()->num_files());
handle.file_progress(p);
}
@ -300,11 +300,6 @@ namespace
}
}
boost::intrusive_ptr<const torrent_info> get_torrent_info(torrent_handle const& h)
{
return boost::intrusive_ptr<const torrent_info>(&h.get_torrent_info());
}
void force_reannounce(torrent_handle& th, int s)
{
th.force_reannounce(boost::posix_time::seconds(s));
@ -316,6 +311,11 @@ void connect_peer(torrent_handle& th, tuple ip, int source)
}
#ifndef TORRENT_NO_DEPRECATE
boost::intrusive_ptr<const torrent_info> get_torrent_info(torrent_handle const& h)
{
return boost::intrusive_ptr<const torrent_info>(&h.get_torrent_info());
}
void set_peer_upload_limit(torrent_handle& th, tuple const& ip, int limit)
{
th.set_peer_upload_limit(tuple_to_endpoint(ip), limit);
@ -376,7 +376,7 @@ void bind_torrent_handle()
.def("add_http_seed", _(&torrent_handle::add_http_seed))
.def("remove_http_seed", _(&torrent_handle::remove_http_seed))
.def("http_seeds", http_seeds)
.def("get_torrent_info", get_torrent_info)
.def("torrent_file", _(&torrent_handle::torrent_file))
.def("set_metadata", set_metadata)
.def("is_valid", _(&torrent_handle::is_valid))
.def("pause", _(&torrent_handle::pause), arg("flags") = 0)
@ -398,6 +398,7 @@ void bind_torrent_handle()
#endif
// deprecated
#ifndef TORRENT_NO_DEPRECATE
.def("get_torrent_info", get_torrent_info)
.def("super_seeding", super_seeding0)
.def("filter_piece", _(&torrent_handle::filter_piece))
.def("is_piece_filtered", _(&torrent_handle::is_piece_filtered))
@ -407,6 +408,8 @@ void bind_torrent_handle()
.def("is_paused", _(&torrent_handle::is_paused))
.def("is_auto_managed", _(&torrent_handle::is_auto_managed))
.def("has_metadata", _(&torrent_handle::has_metadata))
.def("use_interface", &torrent_handle::use_interface)
.def("name", _(&torrent_handle::name))
#endif
.def("add_piece", add_piece)
.def("read_piece", _(&torrent_handle::read_piece))
@ -423,7 +426,6 @@ void bind_torrent_handle()
.def("file_priorities", &file_priorities)
.def("file_priority", &file_prioritity0)
.def("file_priority", &file_prioritity1)
.def("use_interface", &torrent_handle::use_interface)
.def("save_resume_data", _(&torrent_handle::save_resume_data), arg("flags") = 0)
.def("need_save_resume_data", _(&torrent_handle::need_save_resume_data))
.def("force_reannounce", _(force_reannounce0))
@ -432,7 +434,6 @@ void bind_torrent_handle()
.def("force_dht_announce", _(&torrent_handle::force_dht_announce))
#endif
.def("scrape_tracker", _(&torrent_handle::scrape_tracker))
.def("name", _(&torrent_handle::name))
.def("set_upload_mode", _(&torrent_handle::set_upload_mode))
.def("set_share_mode", _(&torrent_handle::set_share_mode))
.def("flush_cache", &torrent_handle::flush_cache)
@ -446,9 +447,9 @@ void bind_torrent_handle()
.def("set_peer_upload_limit", &set_peer_upload_limit)
.def("set_peer_download_limit", &set_peer_download_limit)
.def("set_ratio", _(&torrent_handle::set_ratio))
.def("save_path", _(&torrent_handle::save_path))
#endif
.def("connect_peer", &connect_peer)
.def("save_path", _(&torrent_handle::save_path))
.def("set_max_uploads", _(&torrent_handle::set_max_uploads))
.def("max_uploads", _(&torrent_handle::max_uploads))
.def("set_max_connections", _(&torrent_handle::set_max_connections))

View File

@ -86,6 +86,7 @@ namespace
ti.set_merkle_tree(h);
}
#ifndef TORRENT_NO_DEPRECATE
file_storage::iterator begin_files(torrent_info& i)
{
return i.begin_files();
@ -95,6 +96,7 @@ namespace
{
return i.end_files();
}
#endif
void remap_files(torrent_info& ti, list files) {
file_storage st;
@ -107,9 +109,7 @@ namespace
list files(torrent_info const& ti, bool storage) {
list result;
typedef torrent_info::file_iterator iter;
for (iter i = ti.begin_files(); i != ti.end_files(); ++i)
for (int i = 0; i < ti.num_files(); ++i)
result.append(ti.files().at(i));
return result;
@ -180,7 +180,7 @@ void bind_torrent_info()
return_value_policy<copy_const_reference> copy;
void (torrent_info::*rename_file0)(int, std::string const&) = &torrent_info::rename_file;
#if TORRENT_USE_WSTRING
#if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE
void (torrent_info::*rename_file1)(int, std::wstring const&) = &torrent_info::rename_file;
#endif
@ -198,7 +198,7 @@ void bind_torrent_info()
.def(init<char const*, int, int>((arg("buffer"), arg("length"), arg("flags") = 0)))
.def(init<std::string, int>((arg("file"), arg("flags") = 0)))
.def(init<torrent_info const&, int>((arg("ti"), arg("flags") = 0)))
#if TORRENT_USE_WSTRING
#if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE
.def(init<std::wstring, int>((arg("file"), arg("flags") = 0)))
#endif
@ -216,6 +216,7 @@ void bind_torrent_info()
.def("num_pieces", &torrent_info::num_pieces)
#ifndef TORRENT_NO_DEPRECATE
.def("info_hash", &torrent_info::info_hash, copy)
.def("file_at_offset", &torrent_info::file_at_offset)
#endif
.def("hash_for_piece", &hash_for_piece)
.def("merkle_tree", get_merkle_tree)
@ -224,11 +225,10 @@ void bind_torrent_info()
.def("num_files", &torrent_info::num_files, (arg("storage")=false))
.def("file_at", &torrent_info::file_at)
.def("file_at_offset", &torrent_info::file_at_offset)
.def("files", &files, (arg("storage")=false))
.def("orig_files", &orig_files, (arg("storage")=false))
.def("rename_file", rename_file0)
#if TORRENT_USE_WSTRING
#if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE
.def("rename_file", rename_file1)
#endif