22import sysconfig
33from setuptools import setup , find_packages
44from sysconfig import get_platform
5+
6+ import setuptools
57from version import SDK_VERSION
68import platform
79import os
@@ -20,25 +22,13 @@ def finalize_options(self):
2022except ImportError :
2123 bdist_wheel = None
2224
23- def get_data_files ():
24- # Specify the destination directory for platform-specific shared libraries
25- shared_libs = get_shared_library_data_to_include ()
26- data_files = []
27-
28- # Use sysconfig to get the correct platform-specific site-packages directory
29- platlib_path = sysconfig .get_paths ()["platlib" ]
30-
31- for file_path in shared_libs :
32- if file_path :
33- # Add the library file to data_files list with correct platlib path
34- data_files .append ((platlib_path , [file_path ]))
35-
36- return data_files
37-
25+ class BinaryDistribution (setuptools .Distribution ):
26+ def has_ext_modules (self ):
27+ return True
3828
3929def get_shared_library_data_to_include ():
4030 # Return the correct uniffi C shared library extension for the given platform
41- include_path = "src/onepassword/ lib"
31+ include_path = "lib"
4232 machine_type = os .getenv ("PYTHON_MACHINE_PLATFORM" ) or platform .machine ().lower ()
4333 if machine_type in ["x86_64" , "amd64" ]:
4434 include_path = os .path .join (include_path , "x86_64" )
@@ -72,6 +62,7 @@ def get_shared_library_data_to_include():
7262 packages = find_packages (
7363 where = "src" ,
7464 ),
65+ distclass = BinaryDistribution ,
7566 license = "MIT" ,
7667 license_files = "LICENSE" ,
7768 package_dir = {"" : "src" },
@@ -89,7 +80,7 @@ def get_shared_library_data_to_include():
8980 "License :: OSI Approved :: MIT License" ,
9081 ],
9182 cmdclass = {"bdist_wheel" : bdist_wheel },
92- data_files = get_data_files () ,
83+ package_data = { "" : get_shared_library_data_to_include ()} ,
9384 install_requires = [
9485 "pydantic>=2.5" , # Minimum Pydantic version to run the Python SDK
9586 ],
0 commit comments