Skip to content

Commit

Permalink
Add the newest version
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyTitu committed Mar 12, 2024
1 parent ca6759b commit dbc5577
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
17 changes: 10 additions & 7 deletions sdk/onepassword/core.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion sdk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
],
)

0 comments on commit dbc5577

Please sign in to comment.