build: fix python load paths
Fixed python load paths so that vppcfg will work installed as python library and standalone from the source directory, fixing load pathes for resources such as yaml files along the way. Added a make target for pylint called 'make check-style', fixed a number of minor pylint issues along the way. Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
This commit is contained in:
@@ -15,12 +15,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""vppcfg is a utility to configure a running VPP Dataplane using YAML
|
||||
config files. See http://github.com/pimvanpelt/vppcfg/README.md for details. """
|
||||
# pylint: disable=duplicate-code
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import yaml
|
||||
from config import Validator
|
||||
from vpp.reconciler import Reconciler
|
||||
from vpp.dumper import Dumper
|
||||
|
||||
# Ensure the paths are correct when we execute from the source tree
|
||||
try:
|
||||
from vppcfg.config import Validator
|
||||
except ModuleNotFoundError:
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
from vppcfg.config import Validator
|
||||
from vppcfg.vpp.reconciler import Reconciler
|
||||
from vppcfg.vpp.dumper import Dumper
|
||||
|
||||
try:
|
||||
import argparse
|
||||
|
||||
Reference in New Issue
Block a user