mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
When dsdlc is running from source, it does not require pyuavcan anymore
This commit is contained in:
parent
91642adfe5
commit
c3de88b89f
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "dsdl"]
|
||||
path = dsdl
|
||||
url = https://github.com/UAVCAN/dsdl
|
||||
[submodule "libuavcan/dsdl_compiler/pyuavcan"]
|
||||
path = libuavcan/dsdl_compiler/pyuavcan
|
||||
url = https://github.com/UAVCAN/pyuavcan
|
||||
|
||||
@ -9,6 +9,17 @@
|
||||
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||
import os, sys, logging, argparse
|
||||
|
||||
# This trickery allows to use the compiler even if pyuavcan is not installed in the system.
|
||||
# This is extremely important, as it makes the compiler (and therefore libuavcan in general)
|
||||
# totally dependency-free, except for the Python interpreter itself.
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
LOCAL_PYUAVCAN_DIR = os.path.join(SCRIPT_DIR, 'pyuavcan')
|
||||
RUNNING_FROM_SRC_DIR = os.path.isdir(LOCAL_PYUAVCAN_DIR)
|
||||
if RUNNING_FROM_SRC_DIR:
|
||||
print('Running from the source directory')
|
||||
sys.path.insert(0, SCRIPT_DIR)
|
||||
sys.path.insert(0, LOCAL_PYUAVCAN_DIR)
|
||||
|
||||
def configure_logging(verbosity):
|
||||
fmt = '%(message)s'
|
||||
level = { 0: logging.WARNING, 1: logging.INFO, 2: logging.DEBUG }.get(verbosity or 0, logging.DEBUG)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user