mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-06-08 07:45:00 +08:00
install libusb from pip (#2351)
* install libusb from pip Use libusb-package to bundle libusb as a Python dependency instead of requiring it as a system package. This simplifies setup on all platforms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix agnos --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ classifiers = [
|
|||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libusb1",
|
"libusb1",
|
||||||
|
"libusb-package",
|
||||||
"opendbc @ git+https://github.com/commaai/opendbc.git@master#egg=opendbc",
|
"opendbc @ git+https://github.com/commaai/opendbc.git@master#egg=opendbc",
|
||||||
|
|
||||||
# runtime dependency on comma four
|
# runtime dependency on comma four
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import usb1
|
|||||||
import struct
|
import struct
|
||||||
import hashlib
|
import hashlib
|
||||||
import binascii
|
import binascii
|
||||||
|
import ctypes
|
||||||
from functools import wraps, partial
|
from functools import wraps, partial
|
||||||
from itertools import accumulate
|
from itertools import accumulate
|
||||||
|
|
||||||
@@ -18,6 +19,14 @@ from .spi import PandaSpiHandle, PandaSpiException, PandaProtocolMismatch
|
|||||||
from .usb import PandaUsbHandle
|
from .usb import PandaUsbHandle
|
||||||
from .utils import logger
|
from .utils import logger
|
||||||
|
|
||||||
|
# load libusb from pip package
|
||||||
|
try:
|
||||||
|
import libusb_package
|
||||||
|
usb1._libusb1.loadLibrary(ctypes.CDLL(str(libusb_package.get_library_path())))
|
||||||
|
except ImportError:
|
||||||
|
# TODO: remove this on next AGNOS update
|
||||||
|
pass
|
||||||
|
|
||||||
__version__ = '0.0.10'
|
__version__ = '0.0.10'
|
||||||
|
|
||||||
CANPACKET_HEAD_SIZE = 0x6
|
CANPACKET_HEAD_SIZE = 0x6
|
||||||
|
|||||||
1
setup.sh
1
setup.sh
@@ -18,7 +18,6 @@ elif [[ $PLATFORM == "Linux" ]]; then
|
|||||||
|
|
||||||
sudo apt-get install -y --no-install-recommends \
|
sudo apt-get install -y --no-install-recommends \
|
||||||
curl ca-certificates gcc git \
|
curl ca-certificates gcc git \
|
||||||
libusb-1.0-0 \
|
|
||||||
python3-dev
|
python3-dev
|
||||||
else
|
else
|
||||||
echo "WARNING: unsupported platform. skipping apt/brew install."
|
echo "WARNING: unsupported platform. skipping apt/brew install."
|
||||||
|
|||||||
Reference in New Issue
Block a user