Skip to content

Commit 16a9cb4

Browse files
committed
update setup.py to build in correct folder
1 parent 9742677 commit 16a9cb4

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

setup.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
import sysconfig
23
from setuptools import setup, find_packages
34
from sysconfig import get_platform
45
from version import SDK_VERSION
@@ -19,10 +20,25 @@ def finalize_options(self):
1920
except ImportError:
2021
bdist_wheel = None
2122

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+
2238

2339
def get_shared_library_data_to_include():
2440
# Return the correct uniffi C shared library extension for the given platform
25-
include_path = "lib"
41+
include_path = "src/onepassword/lib"
2642
machine_type = os.getenv("PYTHON_MACHINE_PLATFORM") or platform.machine().lower()
2743
if machine_type in ["x86_64", "amd64"]:
2844
include_path = os.path.join(include_path, "x86_64")
@@ -73,7 +89,7 @@ def get_shared_library_data_to_include():
7389
"License :: OSI Approved :: MIT License",
7490
],
7591
cmdclass={"bdist_wheel": bdist_wheel},
76-
package_data={"": get_shared_library_data_to_include()},
92+
data_files=get_data_files(),
7793
install_requires=[
7894
"pydantic>=2.5", # Minimum Pydantic version to run the Python SDK
7995
],

0 commit comments

Comments
 (0)