From 0799041eebcfdf2676951a41dafdd8cf72f395b8 Mon Sep 17 00:00:00 2001 From: Quinten Stokkink Date: Thu, 27 Jun 2024 14:20:18 +0200 Subject: [PATCH] Moved type stubs into libtorrent directory --- Makefile | 72 +++++++++---------- .../libtorrent/__init__.pyi | 0 .../{install_data => }/libtorrent/py.typed | 0 bindings/python/mypy-tox.ini | 1 - bindings/python/setup.py | 12 +--- 5 files changed, 37 insertions(+), 48 deletions(-) rename bindings/python/{install_data => }/libtorrent/__init__.pyi (100%) rename bindings/python/{install_data => }/libtorrent/py.typed (100%) diff --git a/Makefile b/Makefile index 6c949af55aa..c2c76ec4520 100644 --- a/Makefile +++ b/Makefile @@ -198,42 +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 \ - 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 \ + CMakeLists.txt \ + Jamfile \ + client.py \ + make_torrent.py \ + setup.py \ + setup.py.cmake.in \ + simple_client.py \ + libtorrent/__init__.pyi \ + 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/install_data/libtorrent/__init__.pyi b/bindings/python/libtorrent/__init__.pyi similarity index 100% rename from bindings/python/install_data/libtorrent/__init__.pyi rename to bindings/python/libtorrent/__init__.pyi diff --git a/bindings/python/install_data/libtorrent/py.typed b/bindings/python/libtorrent/py.typed similarity index 100% rename from bindings/python/install_data/libtorrent/py.typed rename to bindings/python/libtorrent/py.typed diff --git a/bindings/python/mypy-tox.ini b/bindings/python/mypy-tox.ini index 888502f7013..21901418ee1 100644 --- a/bindings/python/mypy-tox.ini +++ b/bindings/python/mypy-tox.ini @@ -1,6 +1,5 @@ [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 b7b834cd586..f8468974b65 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -8,7 +8,6 @@ import pathlib import re import shlex -import shutil import subprocess import sys import sysconfig @@ -503,15 +502,6 @@ 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", @@ -526,5 +516,5 @@ def find_all_files(path: str) -> Iterator[str]: }, distclass=B2Distribution, packages=["libtorrent"], - package_data={"libtorrent": list(find_all_files("install_data"))}, + package_data={"libtorrent": list(find_all_files("libtorrent"))}, )