Skip to content

Commit

Permalink
Add async-timeout local dependency for zeroconf
Browse files Browse the repository at this point in the history
  • Loading branch information
fieldOfView committed Nov 15, 2022
1 parent f93225d commit 78280f7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "ifaddr"]
path = ifaddr
url = https://github.com/pydron/ifaddr
[submodule "async-timeout"]
path = async-timeout
url = https://github.com/aio-libs/async-timeout
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ install(DIRECTORY ifaddr
DESTINATION lib/cura/plugins/OctoPrintPlugin/ifaddr
)

install(DIRECTORY async-timeout
DESTINATION lib/cura/plugins/OctoPrintPlugin/async-timeout
)

install(DIRECTORY i18n
DESTINATION lib/cura/plugins/OctoPrintPlugin/i18n
)
5 changes: 3 additions & 2 deletions OctoPrintOutputDevicePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
else:
try:
# import the included version of python-zeroconf
# expand search path so local copies of zeroconf and ifaddr can be imported
# expand search path so local copies of zeroconf, ifaddr and async-timeout can be imported
import sys
import importlib.util

Expand All @@ -55,6 +55,7 @@

plugin_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(plugin_path, "ifaddr"))
sys.path.insert(0, os.path.join(plugin_path, "async-timeout"))

zeroconf_spec = importlib.util.spec_from_file_location(
"zeroconf",
Expand All @@ -80,7 +81,7 @@
sys.path = original_path

Logger.log("d", "Using included Zeroconf module version %s" % zeroconf_version)
except (FileNotFoundError, ImportError) as exception:
except (FileNotFoundError, ModuleNotFoundError, ImportError) as exception:
# fall back to the system-installed version, or what comes with Cura
Logger.logException("e", "Failed to load included version of Zeroconf module")

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ older versions of Cura because that version has bugs.
### [ifaddr](https://github.com/pydron/ifaddr) as maintained by pydron.
ifaddr is licensed under the MIT license.

The module is included in the OctoPrintPlugin because it is a dependency of
python-zeroconf and it is not included with older versions of Cura
### [async-timeout](https://github.com/aio-libs/async-timeout) as maintained by aio-libs
async-timeout is licensed under the Apache License, Version 2.0.

ifaddr and async-timeout are included in the OctoPrintPlugin because it is a dependency
of python-zeroconf and they are not included with older versions of Cura.
1 change: 1 addition & 0 deletions async-timeout
Submodule async-timeout added at 5128f7

0 comments on commit 78280f7

Please sign in to comment.