From 73a3946d3c6adc9c821520100e572733eb38743e Mon Sep 17 00:00:00 2001 From: Quinten Stokkink Date: Mon, 24 Jun 2024 10:21:37 +0200 Subject: [PATCH 1/4] fix wheel types not being found --- .github/workflows/linux.yml | 4 +-- Makefile | 70 ++++++++++++++++++------------------ bindings/python/mypy-tox.ini | 1 + bindings/python/setup.py | 15 ++++++-- 4 files changed, 51 insertions(+), 39 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 4d294521a3c..09996fffbda 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -352,5 +352,5 @@ jobs: - name: test-tarball (python bindings) run: | - cd libtorrent-rasterbar-*/ - python3 bindings/python/setup.py build + cd libtorrent-rasterbar-*/bindings/python/ + python3 setup.py build diff --git a/Makefile b/Makefile index 624eafefaa1..6c949af55aa 100644 --- a/Makefile +++ b/Makefile @@ -198,40 +198,42 @@ EXTRA_DIST = \ $(DOCS_IMAGES) PYTHON_FILES= \ - CMakeLists.txt \ - Jamfile \ - client.py \ - make_torrent.py \ - setup.py \ - setup.py.cmake.in \ - simple_client.py \ - src/alert.cpp \ - src/boost_python.hpp \ - src/bytes.hpp \ - src/converters.cpp \ - src/create_torrent.cpp \ - src/file_storage.cpp \ - src/datetime.cpp \ - src/entry.cpp \ - src/error_code.cpp \ - src/fingerprint.cpp \ - src/gil.hpp \ - src/ip_filter.cpp \ - src/load_torrent.cpp \ - src/magnet_uri.cpp \ - src/module.cpp \ - src/optional.hpp \ - src/peer_info.cpp \ - src/session.cpp \ - src/session_settings.cpp \ - src/sha1_hash.cpp \ - src/sha256_hash.cpp \ - src/info_hash.cpp \ - src/string.cpp \ - src/torrent_handle.cpp \ - src/torrent_info.cpp \ - src/torrent_status.cpp \ - src/utility.cpp \ + CMakeLists.txt \ + Jamfile \ + client.py \ + make_torrent.py \ + setup.py \ + setup.py.cmake.in \ + simple_client.py \ + install_data/libtorrent/__init__.pyi \ + install_data/libtorrent/py.typed \ + src/alert.cpp \ + src/boost_python.hpp \ + src/bytes.hpp \ + src/converters.cpp \ + src/create_torrent.cpp \ + src/file_storage.cpp \ + src/datetime.cpp \ + src/entry.cpp \ + src/error_code.cpp \ + src/fingerprint.cpp \ + src/gil.hpp \ + src/ip_filter.cpp \ + src/load_torrent.cpp \ + src/magnet_uri.cpp \ + src/module.cpp \ + src/optional.hpp \ + src/peer_info.cpp \ + src/session.cpp \ + src/session_settings.cpp \ + src/sha1_hash.cpp \ + src/sha256_hash.cpp \ + src/info_hash.cpp \ + src/string.cpp \ + src/torrent_handle.cpp \ + src/torrent_info.cpp \ + src/torrent_status.cpp \ + src/utility.cpp \ src/version.cpp EXAMPLE_FILES= \ diff --git a/bindings/python/mypy-tox.ini b/bindings/python/mypy-tox.ini index 21901418ee1..888502f7013 100644 --- a/bindings/python/mypy-tox.ini +++ b/bindings/python/mypy-tox.ini @@ -1,5 +1,6 @@ [mypy] ignore_missing_imports = True +mypy_path = install_data [mypy-libtorrent] ignore_missing_imports = False diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 7880f9fd50e..b7b834cd586 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -8,6 +8,7 @@ import pathlib import re import shlex +import shutil import subprocess import sys import sysconfig @@ -502,6 +503,15 @@ def find_all_files(path: str) -> Iterator[str]: yield os.path.join(dirpath, filename) +# Our stubs end up in the "libtorrent" directory in the wheel. +# Setuptools expects it to exist beforehand. +if not os.path.exists("libtorrent"): + os.mkdir("libtorrent") +try: + shutil.copytree("install_data/libtorrent", "libtorrent") +except FileExistsError: + pass + setuptools.setup( name="libtorrent", author="Arvid Norberg", @@ -515,7 +525,6 @@ def find_all_files(path: str) -> Iterator[str]: "build_ext": LibtorrentBuildExt, }, distclass=B2Distribution, - data_files=[ - ("libtorrent", list(find_all_files("install_data"))), - ], + packages=["libtorrent"], + package_data={"libtorrent": list(find_all_files("install_data"))}, ) From 627ac2cb2c81354576ff849fc7fdd50024e06053 Mon Sep 17 00:00:00 2001 From: Quinten Stokkink Date: Mon, 24 Jun 2024 13:24:51 +0200 Subject: [PATCH 2/4] fix appveyor boost path --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a3faee4cd21..701e61d221e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,7 +43,7 @@ install: - if not defined ssl_include ( set ssl_include=c:\ ) - if not defined ssl_root_dir ( set ssl_root_dir=c:\ ) - cd %ROOT_DIRECTORY% - - set BOOST_ROOT=c:\Libraries\boost_1_77_0 + - set BOOST_ROOT=c:\Libraries\boost_1_83_0 - set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build - echo %BOOST_ROOT% - echo %BOOST_BUILD_PATH% From 7a1932343a68f19cd873e2c9625cf4890db31f4f Mon Sep 17 00:00:00 2001 From: Quinten Stokkink Date: Mon, 24 Jun 2024 15:57:42 +0200 Subject: [PATCH 3/4] fix missing dlls for appveyor release tests --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 701e61d221e..7e1fe2f0c36 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -100,6 +100,7 @@ build_script: test_script: - cd %ROOT_DIRECTORY%\test + - set PATH=%PATH%;c:\OpenSSL-v111-Win64\bin - if defined tests ( appveyor-retry b2.exe -l500 --hash openssl-lib=%ssl_lib% openssl-include=%ssl_include% warnings=all warnings-as-errors=on %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% link=shared crypto=%crypto% webtorrent=%webtorrent% asserts=on export-extra=on windows-api=%api% windows-version=win10 deterministic-tests ) From 7f6da2940095e2d09e4b71e36e2dff831f61a018 Mon Sep 17 00:00:00 2001 From: Quinten Stokkink Date: Tue, 25 Jun 2024 13:00:01 +0200 Subject: [PATCH 4/4] fix flaky test_privacy on mac --- test/setup_transfer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index e3f4a116d58..67e435e862a 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -659,7 +659,7 @@ void wait_for_port(int const port) } s.connect(tcp::endpoint(make_address("127.0.0.1") , std::uint16_t(port)), ec); - if (ec == boost::system::errc::connection_refused) + if (ec) { if (i == 100) {