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:
Ray Kinsella
2022-07-12 15:32:23 +01:00
parent ca0897fa65
commit 9f2ef0e56a
26 changed files with 146 additions and 72 deletions

View File

@ -1,9 +1,16 @@
import os, sys
ROOT_DIR = os.path.dirname(__file__)
# fix the module load path
sys.path.insert(0, ROOT_DIR)
# fix the yaml search path
os.chdir(ROOT_DIR)
#!/usr/bin/env python
#
# Copyright (c) 2022 Ray Kinsella
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# -*- coding: utf-8 -*-
""" __init__.py added to suppress pylint error """