From c58005564b4755ed8db82288e07c1dedf8634088 Mon Sep 17 00:00:00 2001 From: ddraganov Date: Tue, 6 Feb 2024 14:55:27 +0200 Subject: [PATCH] Custom recursive addition of type annotations to package_data This fixes the package_data population for setuptools<62.3.0 --- setup.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9a5e08a0..82f8ce99 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,18 @@ def read(fname): with open('test-requirements.txt') as f: required_for_tests = f.read().splitlines() + +def getTypeAnnotationsPackageData(): + allFiles = [] + for root, dirs, files in os.walk(os.path.join(os.path.dirname(__file__), 'pyVmomi')): + for file in files: + if file.endswith('.pyi'): + fileRelPath = os.path.relpath(str(os.path.join(root, file))) + allFiles.append(fileRelPath.split(os.path.sep, 1)[1]) + allFiles.append('py.typed') + return allFiles + + setup( name='pyvmomi', version=version_info_str, @@ -39,7 +51,7 @@ def read(fname): author='VMware, Inc.', author_email='jhu@vmware.com', packages=['pyVmomi', 'pyVim'], - package_data={"pyVmomi": ["py.typed", "*.pyi", "**/*.pyi"]}, + package_data={"pyVmomi": getTypeAnnotationsPackageData()}, install_requires=required, license='License :: OSI Approved :: Apache Software License', classifiers=[