waf: use local pymavlink

use pymavlink from modules, not from install. This allows building
without pymavlink installs, and ensures we use the current version
This commit is contained in:
Andrew Tridgell 2018-11-19 08:08:31 +11:00
parent 4f9c492f78
commit 4b1857b3aa

View File

@ -8,7 +8,7 @@ The **mavgen.py** program is a code generator which creates mavlink header files
from waflib import Logs, Task, Utils, Node from waflib import Logs, Task, Utils, Node
from waflib.TaskGen import feature, before_method, extension from waflib.TaskGen import feature, before_method, extension
import os import os, sys
import os.path import os.path
from xml.etree import ElementTree as et from xml.etree import ElementTree as et
@ -51,6 +51,7 @@ class mavgen(Task.Task):
return nodes, names return nodes, names
def run(self): def run(self):
sys.path.insert(0,self.env.get_flat('MAVLINK_DIR'))
from pymavlink.generator import mavgen from pymavlink.generator import mavgen
class mavgen_options: class mavgen_options:
language = 'C' language = 'C'
@ -98,6 +99,4 @@ def configure(cfg):
cfg.check_python_version(minver=(2,7,0)) cfg.check_python_version(minver=(2,7,0))
env = cfg.env env = cfg.env
env.MAVLINK_DIR = cfg.srcnode.make_node('modules/mavlink/').abspath() env.MAVLINK_DIR = cfg.srcnode.make_node('modules/mavlink/').abspath()
env.MAVGEN = env.MAVLINK_DIR + '/pymavlink/tools/mavgen.py'