-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .main import loadExtension | ||
|
||
__all__ = ["loadExtension"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import logging | ||
import os | ||
from os.path import abspath, dirname, join | ||
|
||
logger = logging.getLogger("xrp.extension") | ||
|
||
|
||
def loadExtension(): | ||
try: | ||
import hal | ||
except ImportError as e: | ||
# really, should never happen... | ||
raise ImportError("you must install robotpy-hal!") from e | ||
|
||
from ..version import version | ||
|
||
logger.info("WPILib XRP client %s", version) | ||
|
||
root = join(abspath(dirname(__file__)), "lib") | ||
ext = join(root, os.listdir(root)[0]) | ||
retval = hal.loadOneExtension(ext) | ||
if retval != 0: | ||
logger.warn("loading extension may have failed (error=%d)", retval) |