From dbc5577bcdb6be3d42e8533e41e355bd38346003 Mon Sep 17 00:00:00 2001 From: AndyTitu Date: Tue, 12 Mar 2024 18:33:25 +0100 Subject: [PATCH] Add the newest version --- .github/workflows/validate.yml | 2 +- .../__init__.py | 0 .../libop_uniffi_core.dylib | Bin .../op_uniffi_core.py | 0 sdk/onepassword/core.py | 17 ++++++++++------- sdk/setup.py | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) rename op_uniffi_core_mac_arm64/{sdk-core-mac-arm64 => sdk_core_mac_arm64}/__init__.py (100%) rename op_uniffi_core_mac_arm64/{sdk-core-mac-arm64 => sdk_core_mac_arm64}/libop_uniffi_core.dylib (100%) rename op_uniffi_core_mac_arm64/{sdk-core-mac-arm64 => sdk_core_mac_arm64}/op_uniffi_core.py (100%) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0955e44..818ed32 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -27,7 +27,7 @@ jobs: run: | pip install pytest && pip install pytest-asyncio && - python -m pytest sdk/onepassword/*.py + python3 -m pytest sdk/onepassword/*.py - name: Lint with Ruff run: | diff --git a/op_uniffi_core_mac_arm64/sdk-core-mac-arm64/__init__.py b/op_uniffi_core_mac_arm64/sdk_core_mac_arm64/__init__.py similarity index 100% rename from op_uniffi_core_mac_arm64/sdk-core-mac-arm64/__init__.py rename to op_uniffi_core_mac_arm64/sdk_core_mac_arm64/__init__.py diff --git a/op_uniffi_core_mac_arm64/sdk-core-mac-arm64/libop_uniffi_core.dylib b/op_uniffi_core_mac_arm64/sdk_core_mac_arm64/libop_uniffi_core.dylib similarity index 100% rename from op_uniffi_core_mac_arm64/sdk-core-mac-arm64/libop_uniffi_core.dylib rename to op_uniffi_core_mac_arm64/sdk_core_mac_arm64/libop_uniffi_core.dylib diff --git a/op_uniffi_core_mac_arm64/sdk-core-mac-arm64/op_uniffi_core.py b/op_uniffi_core_mac_arm64/sdk_core_mac_arm64/op_uniffi_core.py similarity index 100% rename from op_uniffi_core_mac_arm64/sdk-core-mac-arm64/op_uniffi_core.py rename to op_uniffi_core_mac_arm64/sdk_core_mac_arm64/op_uniffi_core.py diff --git a/sdk/onepassword/core.py b/sdk/onepassword/core.py index a3ee071..b12080a 100644 --- a/sdk/onepassword/core.py +++ b/sdk/onepassword/core.py @@ -1,8 +1,7 @@ import json import importlib.util - -def try_import_core(platform_specific_package): +def import_core(platform_specific_package): if (spec := importlib.util.find_spec(platform_specific_package)) is not None: module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) @@ -14,12 +13,16 @@ def try_import_core(platform_specific_package): "sdk_core_mac_arm64.op_uniffi_core" ] -core = None +core = None + for dep in potential_dependencies: - core = try_import_core(dep) - # Stop at the first succesful import - if core is not None: - break + try: + core = import_core(dep) + if core is not None: + break + except ModuleNotFoundError: + continue + # InitClient creates a client instance in the current core module and returns its unique ID. diff --git a/sdk/setup.py b/sdk/setup.py index 0c7b99d..1ba1c8f 100644 --- a/sdk/setup.py +++ b/sdk/setup.py @@ -9,6 +9,6 @@ url='https://github.com/1Password/onepassword-sdk-python', install_requires=[ "sdk_core_mac_arm64; platform_system=='Darwin' and platform_machine=='arm64'", - "sdk_core_linux_x86_64; platform_system=='Linux' and platform_machine=='x86_64'", + "sdk_core_linux_amd64; platform_system=='Linux' and platform_machine=='x86_64'", ], ) \ No newline at end of file