Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated default dll import path to be '.' #1296

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion doc/basics/identity_tutorial_integration/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from asyncio import run
from base64 import b64encode
from time import sleep

from ipv8.configuration import get_default_configuration
from ipv8.REST.rest_manager import RESTManager
Expand All @@ -21,7 +22,15 @@ async def start_community() -> None:
ipv8 = IPv8(configuration)
await ipv8.start()
rest_manager = RESTManager(ipv8)
await rest_manager.start(14410 + peer_id)

# We REALLY want this particular port, keep trying
keep_trying = True
while keep_trying:
try:
await rest_manager.start(14410 + peer_id)
keep_trying = False
except OSError:
sleep(1.0) # noqa: ASYNC101

# Print the peer for reference
print("Starting peer", b64encode(ipv8.keys["anonymous id"].mid))
Expand Down
11 changes: 10 additions & 1 deletion doc/deprecated/attestation_tutorial_integration/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from base64 import b64encode
from binascii import unhexlify
from sys import argv
from time import sleep

from ipv8.attestation.identity.community import IdentityCommunity
from ipv8.attestation.wallet.community import AttestationCommunity
Expand Down Expand Up @@ -109,7 +110,15 @@ async def start_communities() -> None:
})
await ipv8.start()
rest_manager = RESTManager(ipv8)
await rest_manager.start(14410 + i)

# We REALLY want this particular port, keep trying
keep_trying = True
while keep_trying:
try:
await rest_manager.start(14410 + i)
keep_trying = False
except OSError:
sleep(1.0) # noqa: ASYNC101

# Print the peer for reference
print("Starting peer", b64encode(ipv8.keys["anonymous id"].mid))
Expand Down
8 changes: 4 additions & 4 deletions run_all_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ def install_libsodium() -> None:
# Ensure a libsodium.zip
if not pathlib.Path("libsodium.zip").exists():
import json
import urllib.request as request
from urllib import request
response = request.urlopen("https://api.github.com/repos/jedisct1/libsodium/releases")
release = json.loads(response.read())[0]
response.close()
asset = [asset for asset in release['assets'] if asset['name'].endswith("-msvc.zip")][0]
pathlib.Path("libsodium.zip").write_bytes(request.urlopen(asset['browser_download_url']).read())
asset = next(asset for asset in release['assets'] if asset['name'].endswith("-msvc.zip"))
pathlib.Path("libsodium.zip").write_bytes(request.urlopen(asset['browser_download_url']).read()) # noqa: S310

# Unpack just the libsodium.dll
if not pathlib.Path("libsodium.dll").exists():
Expand All @@ -285,7 +285,7 @@ def windows_missing_libsodium() -> bool:
return False

# Try to find it in the local directory. This is where we'll download it anyway.
os.add_dll_directory(os.path.dirname(__file__) or os.path.abspath('.'))
os.add_dll_directory(os.path.abspath('.'))
try:
import libnacl # noqa: F401
return False
Expand Down