Make powertrain-build not overlap with pybuild in site-packages
Change-Id: I7b59f3f04f0f787d35db0b9389f295bf1ad24f56
This commit is contained in:
parent
8a3ed73e20
commit
2ece01e1d7
@ -1,6 +1,6 @@
|
||||
include pybuild/templates/*.html
|
||||
include powertrain_build/templates/*.html
|
||||
include test-requirements.txt
|
||||
include pybuild/matlab_scripts/CodeGen/*
|
||||
include pybuild/matlab_scripts/helperFunctions/*
|
||||
include pybuild/matlab_scripts/*
|
||||
include powertrain_build/matlab_scripts/CodeGen/*
|
||||
include powertrain_build/matlab_scripts/helperFunctions/*
|
||||
include powertrain_build/matlab_scripts/*
|
||||
include requirements.txt
|
||||
|
6
NOTICE
6
NOTICE
@ -11,7 +11,7 @@ exceptiongroup 1.2.2 : MIT License
|
||||
flake8 7.1.1 : MIT License
|
||||
gitdb 4.0.11 : BSD 3-clause "New" or "Revised" License
|
||||
GitPython 3.1.43 : BSD 3-clause "New" or "Revised" License
|
||||
idna 3.8 : BSD 3-clause "New" or "Revised" License
|
||||
idna 3.10 : BSD 3-clause "New" or "Revised" License
|
||||
mccabe 0.7.0 : Expat License
|
||||
NumPy 1.24.4 : BSD 3-clause "New" or "Revised" License
|
||||
Packaging 24.1 : (Apache License 2.0 AND BSD 3-clause "New" or "Revised" License)
|
||||
@ -49,8 +49,6 @@ GitPython 3.1.43 pypi:GitPython/3.1.43
|
||||
Copyright (C) 2008, 2009 Michael Trier and contributors, 2010-2015 Sebastian Thiel"
|
||||
Copyright (C) 2008, 2009 Michael Trier and contributorsAll rights reserved
|
||||
Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
|
||||
idna 3.8 pypi:idna/3.8
|
||||
Copyright (c) 2013-2024, Kim Davies and contributors.All rights reserved
|
||||
mccabe 0.7.0 pypi:mccabe/0.7.0
|
||||
Copyright © 2011-2013 Tarek Ziade <tarek@ziade.org>
|
||||
Copyright © 2013 Florent Xicluna <florent.xicluna@gmail.com>
|
||||
@ -5573,7 +5571,7 @@ third-party archives.
|
||||
---
|
||||
|
||||
BSD 3-clause "New" or "Revised" License
|
||||
(gitdb 4.0.11, GitPython 3.1.43, idna 3.8, NumPy 1.24.4, Packaging 24.1, SciPy 1.9.1, smmap 5.0.1, voluptuous 0.15.2)
|
||||
(gitdb 4.0.11, GitPython 3.1.43, idna 3.10, NumPy 1.24.4, Packaging 24.1, SciPy 1.9.1, smmap 5.0.1, voluptuous 0.15.2)
|
||||
|
||||
Copyright (c) <YEAR>, <OWNER>
|
||||
All rights reserved.
|
||||
|
20
README.md
20
README.md
@ -1,23 +1,23 @@
|
||||
# PyBuild
|
||||
# Powertrain-build
|
||||
|
||||
A Continuous Integration (CI) build system, testing all configurations where a TargetLink model is used.
|
||||
|
||||
## General Information about Pybuild
|
||||
## General Information about powertrain-build
|
||||
|
||||
- PyBuild is fast.
|
||||
- Powertrain-build is fast.
|
||||
- More parallelization of jobs in the CI system makes it faster.
|
||||
- Code generation is moved to the developer's PC.
|
||||
- Code generation is done once for all projects using pre-processor directives.
|
||||
- C code reviews are now possible in Gerrit.
|
||||
- PyBuild adds signal consistency checks.
|
||||
- Powertrain-build adds signal consistency checks.
|
||||
- Unit tests of the build system are introduced.
|
||||
- Its quality is assured.
|
||||
- PyBuild creates new variable classes with unique code decorations.
|
||||
- Powertrain-build creates new variable classes with unique code decorations.
|
||||
- Post-processing C code is not necessary.
|
||||
- ASIL-classed variables get declared at the source.
|
||||
- Memory can be optimized at compilation through short addressing different variable classes.
|
||||
- The same models can be used in more than two different suppliers, for instance, SPA2's Core System Platform (CSP).
|
||||
- PyBuild fixes incorrect handling of NVM variables.
|
||||
- Powertrain-build fixes incorrect handling of NVM variables.
|
||||
|
||||
## Project Structure
|
||||
|
||||
@ -25,18 +25,20 @@ A Continuous Integration (CI) build system, testing all configurations where a T
|
||||
|
||||
- `playbooks/`: Directory where we keep Ansible playbooks that are executed in the jobs we use in this project.
|
||||
|
||||
- `pybuild/`: Main directory of the project. All the application source code is kept here. It is divided into different Python modules:
|
||||
- `powertrain_build/`: Main directory of the project. All the application source code is kept here. It is divided into different Python modules:
|
||||
- `interface/`
|
||||
- `lib/`
|
||||
- `zone_controller/`
|
||||
|
||||
Also, we keep `static_code/` and `templates/` directories with useful `.c`, `.h`, and `.html` files.
|
||||
|
||||
- `tests/`: Directory where we keep the unit tests for our application source code. The tests are structured in a similar way to what we have inside the `pybuild/` directory. Tests for the `interface`, `lib`, and `zone_controller` modules are split into `tests/interface/`, `tests/lib/`, and `tests/zone_controller/`, respectively. Other tests are kept inside the `tests/pybuild/` directory.
|
||||
- `tests/`: Directory where we keep the unit tests for our application source code. The tests are structured in a similar way to what we have inside the `powertrain_build/` directory. Tests for the `interface`, `lib`, and `zone_controller` modules are split into `tests/interface/`, `tests/lib/`, and `tests/zone_controller/`, respectively. Other tests are kept inside the `tests/powertrain_build/` directory.
|
||||
|
||||
- `zuul.d/`: Directory where we keep our Zuul jobs.
|
||||
|
||||
## How to use Pybuild
|
||||
## How to use powertrain-build
|
||||
|
||||
See [powertrain-build introduction](./docs/powertrain_build_introduction.md)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Run the build command
|
||||
|
||||
`pybuild/build.py` is the starting point for generating all the files needed for building a complete SW using the supplier make environment. The script takes one positional argument, and that is a [project_config](project_config.md).
|
||||
`powertrain_build/build.py` is the starting point for generating all the files needed for building a complete SW using the supplier make environment. The script takes one positional argument, and that is a [project_config](project_config.md).
|
||||
|
||||
This script acts as a command line wrapper for [build](../../pybuild/build.py).
|
||||
This script acts as a command line wrapper for [build](../../powertrain_build/build.py).
|
||||
|
||||
```none
|
||||
usage: build.py [-h] [-cd] [-d] [-na] [-if] [-V] proj_config
|
||||
|
@ -31,7 +31,7 @@ actuation-arbitration-manager-simulink-logic/Projects/Init_PyBuild.m
|
||||
In git bash:
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --codegen --models Models/ICEAES/VcAesTx/VcAesTx.mdl
|
||||
py -3.6 -m powertrain_build.wrapper --codegen --models Models/ICEAES/VcAesTx/VcAesTx.mdl
|
||||
```
|
||||
|
||||
#### Set Matlab 2017 as Environmental Variable
|
||||
@ -61,15 +61,15 @@ See picture below for details.
|
||||
#### Code generate with Embedded Coder with Matlab2019b
|
||||
|
||||
```python
|
||||
py -3.6 -m pytools.pybuild_wrapper --codegen --matlab-bin "C:\MATLAB_2019_b\bin\matlab.exe" --models Models/STEER/VcSteer/VcSteer.mdl
|
||||
py -3.6 -m powertrain_build.wrapper --codegen --matlab-bin "C:\MATLAB_2019_b\bin\matlab.exe" --models Models/STEER/VcSteer/VcSteer.mdl
|
||||
```
|
||||
|
||||
### Update a TargeLink model to pybuild
|
||||
### Update a TargeLink model to powertrain_build
|
||||
|
||||
In git bash:
|
||||
|
||||
```python
|
||||
py -3.6 -m pytools.pybuild_wrapper --update --models Models/ICEAES/VcAesTx/VcAesTx.mdl
|
||||
py -3.6 -m powertrain_build.wrapper --update --models Models/ICEAES/VcAesTx/VcAesTx.mdl
|
||||
```
|
||||
|
||||
### Update and Code generate a model
|
||||
@ -77,7 +77,7 @@ py -3.6 -m pytools.pybuild_wrapper --update --models Models/ICEAES/VcAesTx/VcAes
|
||||
In git bash:
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --update --codegen --models Models/ICEAES/VcAesTx/VcAesTx.mdl
|
||||
py -3.6 -m powertrain_build.wrapper --update --codegen --models Models/ICEAES/VcAesTx/VcAesTx.mdl
|
||||
```
|
||||
|
||||
### Code generation and build
|
||||
@ -85,7 +85,7 @@ py -3.6 -m pytools.pybuild_wrapper --update --codegen --models Models/ICEAES/VcA
|
||||
To code generate and build a complete project *ABC_123*:
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --codegen --build ABC_123
|
||||
py -3.6 -m powertrain_build.wrapper --codegen --build ABC_123
|
||||
```
|
||||
|
||||
### Build a project
|
||||
@ -93,13 +93,13 @@ py -3.6 -m pytools.pybuild_wrapper --codegen --build ABC_123
|
||||
You can either use the wrapper:
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --build ABC_123
|
||||
py -3.6 -m powertrain_build.wrapper --build ABC_123
|
||||
```
|
||||
|
||||
### Detailed build options
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --help
|
||||
py -3.6 -m powertrain_build.wrapper --help
|
||||
```
|
||||
|
||||
The powertrain_build wrapper has many options, we'll explain them in detail here:
|
||||
@ -126,7 +126,7 @@ binary to use. Defaults to C:\MATLABR2017b_x64\bin\matlab.exe. If you have
|
||||
Matlab installed in the wrong place you can use:
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --codegen --models Models/ICEAES/VcAesTx/VcAesTx.mdl --matlab-bin="C:\Program Files\MATLAB\R2017b\bin\matlab.exe"
|
||||
py -3.6 -m powertrain_build.wrapper --codegen --models Models/ICEAES/VcAesTx/VcAesTx.mdl --matlab-bin="C:\Program Files\MATLAB\R2017b\bin\matlab.exe"
|
||||
```
|
||||
|
||||
NOTE: Building a project (--build) does not work if a model requires a
|
||||
|
@ -28,5 +28,5 @@ source ./powertrain_build_venv/bin/activate
|
||||
Once activated, you can execute it:
|
||||
|
||||
```shell
|
||||
PYTHONPATH=<path_to>/pt/pytools:<path_to>//pt/pybuild python -m pytools.pybuild_wrapper build-specific --project-config Projects/CSP/PvcDepDemo/ProjectCfg.json --core-dummy
|
||||
PYTHONPATH=<path_to>//powertrain-build python -m powertrain_build.wrapper build-specific --project-config Projects/CSP/PvcDepDemo/ProjectCfg.json --core-dummy
|
||||
```
|
||||
|
@ -10,7 +10,7 @@ Powertrain Build contains scripts for both signal consistency checks and signal
|
||||
If you type the following in git bash:
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --help
|
||||
py -3.6 -m powertrain_build.wrapper --help
|
||||
```
|
||||
|
||||
## Signal Interface report
|
||||
@ -18,7 +18,7 @@ py -3.6 -m pytools.pybuild_wrapper --help
|
||||
The signal Interface tool generates html reports. The following example shows how to generate the report:
|
||||
|
||||
```bash
|
||||
py -3.6 -m pytools.pybuild_wrapper --build ABC_123 --interface
|
||||
py -3.6 -m powertrain_build.wrapper --build ABC_123 --interface
|
||||
```
|
||||
|
||||
A project specific report will be available here: `Projects\ABC_123\output\Reports\SigIf.html`.
|
||||
|
@ -1,15 +1,15 @@
|
||||
# Copyright 2024 Volvo Car Corporation
|
||||
# Licensed under Apache 2.0.
|
||||
|
||||
"""Main package of the pybuild application."""
|
||||
"""Main package of the powertrain-build application."""
|
||||
from pbr.version import VersionInfo
|
||||
from pathlib import Path
|
||||
from pybuild.lib import logger, helper_functions
|
||||
from pybuild.environmentcheck import check_python_string
|
||||
from powertrain_build.lib import logger, helper_functions
|
||||
from powertrain_build.environmentcheck import check_python_string
|
||||
|
||||
LOGGER = logger.create_logger(__file__)
|
||||
__version__ = VersionInfo('pt-pybuild').release_string()
|
||||
LOGGER.info('Current pybuild version is %s', __version__)
|
||||
__version__ = VersionInfo('powertrain-build').release_string()
|
||||
LOGGER.info('Current powertrain-build version is %s', __version__)
|
||||
__config_version__ = '0.2.1'
|
||||
__required_python_lower__ = '3.6'
|
||||
__required_python_upper__ = '3.10'
|
||||
@ -21,13 +21,13 @@ requirement_path = Path(
|
||||
)
|
||||
if requirement_path.exists():
|
||||
with requirement_path.open("r") as requirement_file:
|
||||
expected_package = "pt-pybuild==" + __version__
|
||||
expected_package = "powertrain-build==" + __version__
|
||||
for line in requirement_file:
|
||||
if expected_package in line:
|
||||
LOGGER.info('PyBuild version matched requirements!')
|
||||
LOGGER.info('Powertrain-build version matched requirements!')
|
||||
break
|
||||
elif "pt-pybuild==" in line and expected_package not in line:
|
||||
LOGGER.warning('PyBuild version does not match requirements!')
|
||||
elif "powertrain-build==" in line and expected_package not in line:
|
||||
LOGGER.warning('Powertrain-build version does not match requirements!')
|
||||
break
|
||||
|
||||
else:
|
@ -9,8 +9,8 @@ import re
|
||||
import logging
|
||||
from string import Template
|
||||
from pprint import pformat
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from pybuild.types import a2l_type, a2l_range
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
from powertrain_build.types import a2l_type, a2l_range
|
||||
|
||||
LOG = logging.getLogger()
|
||||
|
@ -9,9 +9,9 @@ import os
|
||||
import re
|
||||
from string import Template
|
||||
|
||||
from pybuild.lib.helper_functions import deep_dict_update
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from pybuild.a2l_templates import A2lProjectTemplate, A2lSilverTemplate
|
||||
from powertrain_build.lib.helper_functions import deep_dict_update
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
from powertrain_build.a2l_templates import A2lProjectTemplate, A2lSilverTemplate
|
||||
|
||||
|
||||
class A2lMerge(ProblemLogger):
|
@ -4,7 +4,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Python module used for building a Vcc SPM SW release.
|
||||
|
||||
This is the entry point to pybuild which includes all other needed modules.
|
||||
This is the entry point to powertrain-build which includes all other needed modules.
|
||||
Loads configuration files and sequences the code generation steps.
|
||||
"""
|
||||
|
||||
@ -17,31 +17,31 @@ import time
|
||||
from os.path import join as pjoin
|
||||
from pathlib import Path
|
||||
|
||||
from pybuild import __config_version__, __version__, build_defs
|
||||
from pybuild.a2l_merge import A2lMerge
|
||||
from pybuild.build_proj_config import BuildProjConfig
|
||||
from pybuild.core import Core, HICore, ZCCore
|
||||
from pybuild.core_dummy import CoreDummy
|
||||
from pybuild.create_conversion_table import create_conversion_table
|
||||
from pybuild.dids import DIDs, HIDIDs, ZCDIDs
|
||||
from pybuild.dummy import DummyVar
|
||||
from pybuild.dummy_spm import DummySpm
|
||||
from pybuild.ext_dbg import ExtDbg
|
||||
from pybuild.ext_var import ExtVarCsv, ExtVarYaml
|
||||
from pybuild.feature_configs import FeatureConfigs
|
||||
from pybuild.lib.helper_functions import get_repo_root, merge_dicts
|
||||
from pybuild.memory_section import MemorySection
|
||||
from pybuild.nvm_def import NVMDef
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from pybuild.replace_compu_tab_ref import replace_tab_verb
|
||||
from pybuild.sched_funcs import SchedFuncs
|
||||
from pybuild.signal_if_html_rep import SigIfHtmlReport
|
||||
from pybuild.signal_incons_html_rep import SigConsHtmlReport
|
||||
from pybuild.signal_interfaces import CsvSignalInterfaces, YamlSignalInterfaces
|
||||
from pybuild.unit_configs import CodeGenerators, UnitConfigs
|
||||
from pybuild.user_defined_types import UserDefinedTypes
|
||||
from pybuild.zone_controller.calibration import ZoneControllerCalibration
|
||||
from pybuild.zone_controller.composition_yaml import CompositionYaml
|
||||
from powertrain_build import __config_version__, __version__, build_defs
|
||||
from powertrain_build.a2l_merge import A2lMerge
|
||||
from powertrain_build.build_proj_config import BuildProjConfig
|
||||
from powertrain_build.core import Core, HICore, ZCCore
|
||||
from powertrain_build.core_dummy import CoreDummy
|
||||
from powertrain_build.create_conversion_table import create_conversion_table
|
||||
from powertrain_build.dids import DIDs, HIDIDs, ZCDIDs
|
||||
from powertrain_build.dummy import DummyVar
|
||||
from powertrain_build.dummy_spm import DummySpm
|
||||
from powertrain_build.ext_dbg import ExtDbg
|
||||
from powertrain_build.ext_var import ExtVarCsv, ExtVarYaml
|
||||
from powertrain_build.feature_configs import FeatureConfigs
|
||||
from powertrain_build.lib.helper_functions import get_repo_root, merge_dicts
|
||||
from powertrain_build.memory_section import MemorySection
|
||||
from powertrain_build.nvm_def import NVMDef
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
from powertrain_build.replace_compu_tab_ref import replace_tab_verb
|
||||
from powertrain_build.sched_funcs import SchedFuncs
|
||||
from powertrain_build.signal_if_html_rep import SigIfHtmlReport
|
||||
from powertrain_build.signal_incons_html_rep import SigConsHtmlReport
|
||||
from powertrain_build.signal_interfaces import CsvSignalInterfaces, YamlSignalInterfaces
|
||||
from powertrain_build.unit_configs import CodeGenerators, UnitConfigs
|
||||
from powertrain_build.user_defined_types import UserDefinedTypes
|
||||
from powertrain_build.zone_controller.calibration import ZoneControllerCalibration
|
||||
from powertrain_build.zone_controller.composition_yaml import CompositionYaml
|
||||
|
||||
LOG = logging.getLogger()
|
||||
REPO_ROOT = get_repo_root()
|
||||
@ -631,7 +631,7 @@ def propagate_tag_name(build_cfg, tag_name, problem_logger):
|
||||
Args:
|
||||
build_cfg (BuildProjConfig): Build project class holding where files should be stored.
|
||||
tag_name (str): git tag name.
|
||||
problem_logger (object): logger for pybuild.
|
||||
problem_logger (object): logger for powertrain_build.
|
||||
"""
|
||||
LOG.info("******************************************************")
|
||||
LOG.info("Propagating tag name: %s", tag_name)
|
||||
@ -657,58 +657,58 @@ def propagate_tag_name(build_cfg, tag_name, problem_logger):
|
||||
|
||||
|
||||
def add_args(parser):
|
||||
"""Add command line arguments for pybuild.
|
||||
"""Add command line arguments for powertrain_build.
|
||||
|
||||
This is useful when pybuild should be run through a command line wrapper function.
|
||||
This is useful when powertrain-build should be run through a command line wrapper function.
|
||||
|
||||
Args:
|
||||
parser (argparse.ArgumentParser): Parser instance to add arguments to.
|
||||
"""
|
||||
pybuild_parser = parser.add_argument_group("pybuild arguments")
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser = parser.add_argument_group("powertrain-build arguments")
|
||||
powertrain_build_parser.add_argument(
|
||||
"--project-config", required=True, help="Project root configuration file"
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--generate-system-info", action="store_true", help="Generate AllSystemInfo.mat"
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--generate-custom-conv-tab",
|
||||
default=None,
|
||||
help="Path to conversion table file. Useful for TargetLink enums in A2L file.",
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--core-dummy",
|
||||
action="store_true",
|
||||
help="Generate core dummy code to enable integration with old supplier code",
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--debug", action="store_true", help="Activate the debug log"
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--no-abort", action="store_true", help="Do not abort due to errors"
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--no-nvm-a2l",
|
||||
action="store_true",
|
||||
help="Do not generate a2l file for NVM structs",
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--complete-a2l", action="store_true", help="Generate A2L with project info"
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--silver-a2l",
|
||||
action="store_true",
|
||||
help="Generate A2L file with Silver patching. Complete A2L argument takes precedence.",
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--interface", action="store_true", help="Generate interface report"
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--generate-rte-checkpoint-calls",
|
||||
action="store_true",
|
||||
help="Generate RTE function checkpoint calls",
|
||||
)
|
||||
pybuild_parser.add_argument(
|
||||
powertrain_build_parser.add_argument(
|
||||
"--version",
|
||||
action="version",
|
||||
version=f"%(prog)s {__version__}",
|
||||
@ -767,7 +767,7 @@ def build(
|
||||
|
||||
setup_logging(build_cfg.get_log_dst_dir(), problem_logger, debug, quiet)
|
||||
LOG.info("Starting build")
|
||||
LOG.info("pybuild version is: %s", __version__)
|
||||
LOG.info("powertrain_build version is: %s", __version__)
|
||||
LOG.info("Project/Model config file version is: %s", __config_version__)
|
||||
LOG.info("Read SPM code switches")
|
||||
start_time = time.time()
|
||||
@ -891,7 +891,7 @@ def build(
|
||||
|
||||
# Generate AllSystemInfo.mat for DocGen compatibility
|
||||
if generate_system_info:
|
||||
from pybuild.gen_allsysteminfo import GenAllSystemInfo
|
||||
from powertrain_build.gen_allsysteminfo import GenAllSystemInfo
|
||||
|
||||
gen_all_system_info = GenAllSystemInfo(signal_if, unit_cfg)
|
||||
gen_all_system_info.build()
|
||||
@ -922,7 +922,7 @@ def build(
|
||||
memory_section.generate_required_header_files()
|
||||
|
||||
# Propagate tag name for release builds
|
||||
# TAG_NAME is set in release -> release-compile-denso/release-ecmsildll -> pybuild.build
|
||||
# TAG_NAME is set in release -> release-compile-denso/release-ecmsildll -> powertrain_build.build
|
||||
tag_name = os.environ.get("TAG_NAME", "")
|
||||
if tag_name and ecu_supplier == "Denso":
|
||||
propagate_tag_name(build_cfg, tag_name, problem_logger)
|
@ -11,8 +11,8 @@ import shutil
|
||||
import pathlib
|
||||
from pprint import pformat
|
||||
|
||||
from pybuild.lib.helper_functions import deep_dict_update
|
||||
from pybuild.versioncheck import Version
|
||||
from powertrain_build.lib.helper_functions import deep_dict_update
|
||||
from powertrain_build.versioncheck import Version
|
||||
|
||||
|
||||
class BuildProjConfig:
|
@ -15,9 +15,9 @@ from pathlib import Path
|
||||
|
||||
import git
|
||||
|
||||
from pybuild.interface.application import Application, Model, get_active_signals
|
||||
from pybuild.interface.ems import CsvEMS
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.interface.application import Application, Model, get_active_signals
|
||||
from powertrain_build.interface.ems import CsvEMS
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger("Check interface")
|
||||
|
||||
@ -358,14 +358,14 @@ def parse_args():
|
||||
Mismatches in min, max or unit gives warnings
|
||||
|
||||
Examples:
|
||||
py -3.6 -m pybuild.check_interface models_in_projects <Projects> <Models/ModelGroup>\
|
||||
py -3.6 -m powertrain_build.check_interface models_in_projects <Projects> <Models/ModelGroup>\
|
||||
--projects <ProjectOne> <ProjectTwo>
|
||||
Checks models in Models/ModelGroup against ProjectOne and ProjectTwo in the folder Projects
|
||||
|
||||
py -3.6 -m pybuild.check_interface models <Models> --models <ModelOne> <ModelTwo>
|
||||
py -3.6 -m powertrain_build.check_interface models <Models> --models <ModelOne> <ModelTwo>
|
||||
Checks models ModelOne and ModelTwo against all other models in the folder Models
|
||||
|
||||
py -3.6 -m pybuild.check_interface projects <Projects> \
|
||||
py -3.6 -m powertrain_build.check_interface projects <Projects> \
|
||||
--projects ProjectOne ProjectTwo ProjectThree
|
||||
Checks the interfaces of ProjectOne, ProjectTwo and ProjectThree in the folder Projects
|
||||
""",
|
@ -12,7 +12,7 @@ import os
|
||||
import re
|
||||
from pprint import pformat
|
||||
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger('config')
|
||||
|
@ -12,9 +12,9 @@ import time
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
from ruamel.yaml import YAML
|
||||
from pybuild import build_defs
|
||||
from pybuild.xlrd_csv import WorkBook
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from powertrain_build import build_defs
|
||||
from powertrain_build.xlrd_csv import WorkBook
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
|
||||
|
||||
class Core(ProblemLogger):
|
@ -10,10 +10,10 @@ updated the core with all the needed core id definitions.
|
||||
|
||||
import os
|
||||
|
||||
from pybuild import build_defs
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from pybuild.types import get_ec_type
|
||||
from pybuild.unit_configs import CodeGenerators
|
||||
from powertrain_build import build_defs
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
from powertrain_build.types import get_ec_type
|
||||
from powertrain_build.unit_configs import CodeGenerators
|
||||
|
||||
|
||||
class CoreDummy(ProblemLogger):
|
@ -12,11 +12,11 @@ import csv
|
||||
import os
|
||||
from pathlib import Path
|
||||
from ruamel.yaml import YAML
|
||||
from pybuild import build_defs
|
||||
from pybuild.lib.helper_functions import deep_dict_update
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from pybuild.types import byte_size, get_ec_type, get_float32_types
|
||||
from pybuild.unit_configs import CodeGenerators
|
||||
from powertrain_build import build_defs
|
||||
from powertrain_build.lib.helper_functions import deep_dict_update
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
from powertrain_build.types import byte_size, get_ec_type, get_float32_types
|
||||
from powertrain_build.unit_configs import CodeGenerators
|
||||
|
||||
|
||||
def get_dids_in_prj(unit_cfgs):
|
@ -3,11 +3,11 @@
|
||||
|
||||
"""Module for generation of c- and a2l-file with dummy signal declarations."""
|
||||
|
||||
import pybuild.build_defs as bd
|
||||
import powertrain_build.build_defs as bd
|
||||
|
||||
from pybuild.types import byte_size_string, get_bitmask
|
||||
from pybuild.a2l import A2l
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from powertrain_build.types import byte_size_string, get_bitmask
|
||||
from powertrain_build.a2l import A2l
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
|
||||
|
||||
class DummyVar(ProblemLogger):
|
||||
@ -36,10 +36,11 @@ class DummyVar(ProblemLogger):
|
||||
Args:
|
||||
data_type (str): Data type.
|
||||
Returns:
|
||||
byte_size_string(pybuild.types.byte_size_string): Return result of pybuild.types.byte_size_string.
|
||||
byte_size_string(powertrain_build.types.byte_size_string): Return result of
|
||||
powertrain_build.types.byte_size_string.
|
||||
"""
|
||||
if data_type in self._enumerations:
|
||||
return byte_size_string(self._enumerations[data_type]['underlying_data_type'])
|
||||
return byte_size_string(self._enumerations[data_type]["underlying_data_type"])
|
||||
return byte_size_string(data_type)
|
||||
|
||||
def _restruct_input_data(self):
|
||||
@ -48,112 +49,109 @@ class DummyVar(ProblemLogger):
|
||||
This will be used for declaring the variables and generating the
|
||||
A2L-file
|
||||
"""
|
||||
ext_out = {var: data for ioclass, vardict in self._ext_dict.items()
|
||||
if ioclass.endswith('-Output') for var, data in vardict.items()}
|
||||
ext_out = {
|
||||
var: data
|
||||
for ioclass, vardict in self._ext_dict.items()
|
||||
if ioclass.endswith("-Output")
|
||||
for var, data in vardict.items()
|
||||
}
|
||||
ext_ = {}
|
||||
for var in self._res_dict['sigs']['ext']['missing']:
|
||||
self.debug('ext: %s', var)
|
||||
for var in self._res_dict["sigs"]["ext"]["missing"]:
|
||||
self.debug("ext: %s", var)
|
||||
if var in ext_out:
|
||||
data = ext_out[var]
|
||||
self.debug('ext_data: %s', data)
|
||||
self.debug("ext_data: %s", data)
|
||||
ext_[var] = data
|
||||
int_ = {}
|
||||
for unit in self._res_dict['sigs']['int']:
|
||||
for var in self._res_dict['sigs']['int'][unit]['missing']:
|
||||
if var not in ext_ and var in self._unit_vars['inports']:
|
||||
data = self._unit_vars['inports'][var][unit]
|
||||
for unit in self._res_dict["sigs"]["int"]:
|
||||
for var in self._res_dict["sigs"]["int"][unit]["missing"]:
|
||||
if var not in ext_ and var in self._unit_vars["inports"]:
|
||||
data = self._unit_vars["inports"][var][unit]
|
||||
int_[var] = data
|
||||
for var, data in int_.items():
|
||||
data_type_size = self._get_byte_size_string(data['type'])
|
||||
data_type_size = self._get_byte_size_string(data["type"])
|
||||
self._int_vars.setdefault(data_type_size, {})[var] = data
|
||||
for var, data in ext_.items():
|
||||
data_type_size = self._get_byte_size_string(data['type'])
|
||||
data_type_size = self._get_byte_size_string(data["type"])
|
||||
self._ext_vars.setdefault(data_type_size, {})[var] = data
|
||||
|
||||
def _a2l_dict(self):
|
||||
"""Return a dict defining all parameters for a2l-generation."""
|
||||
res = {
|
||||
'vars': {},
|
||||
'function': 'VcDummy'
|
||||
}
|
||||
res = {"vars": {}, "function": "VcDummy"}
|
||||
for inp in [self._ext_vars]:
|
||||
for sizes in inp.values():
|
||||
for var, data in sizes.items():
|
||||
if data['type'] in self._enumerations:
|
||||
data_type = self._enumerations[data['type']]['underlying_data_type']
|
||||
if data["type"] in self._enumerations:
|
||||
data_type = self._enumerations[data["type"]]["underlying_data_type"]
|
||||
else:
|
||||
data_type = data['type']
|
||||
data_type = data["type"]
|
||||
|
||||
resv = res['vars']
|
||||
resv.setdefault(var, {})['a2l_data'] = {
|
||||
'bitmask': get_bitmask(data_type),
|
||||
'description': data.get('description', ''),
|
||||
'lsb': '2^0',
|
||||
'max': data.get('max'),
|
||||
'min': data.get('min'),
|
||||
'offset': '0',
|
||||
'unit': data['unit'],
|
||||
'x_axis': None,
|
||||
'y_axis': None
|
||||
}
|
||||
resv[var]['array'] = []
|
||||
resv[var]['function'] = ['VcEc']
|
||||
resv[var]['var'] = {
|
||||
'cvc_type': 'CVC_DISP',
|
||||
'type': data_type,
|
||||
'var': var
|
||||
resv = res["vars"]
|
||||
resv.setdefault(var, {})["a2l_data"] = {
|
||||
"bitmask": get_bitmask(data_type),
|
||||
"description": data.get("description", ""),
|
||||
"lsb": "2^0",
|
||||
"max": data.get("max"),
|
||||
"min": data.get("min"),
|
||||
"offset": "0",
|
||||
"unit": data["unit"],
|
||||
"x_axis": None,
|
||||
"y_axis": None,
|
||||
}
|
||||
resv[var]["array"] = []
|
||||
resv[var]["function"] = ["VcEc"]
|
||||
resv[var]["var"] = {"cvc_type": "CVC_DISP", "type": data_type, "var": var}
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def _generate_var_defs(cls, fh_c, vars, enums, comment):
|
||||
"""Generate the variable definitions."""
|
||||
fh_c.write(f'\n{comment}\n\n')
|
||||
fh_c.write(f"\n{comment}\n\n")
|
||||
for varsize in sorted(vars.keys(), reverse=True):
|
||||
fh_c.write(f'/* Variables of size {varsize} bytes */\n\n')
|
||||
fh_c.write(f"/* Variables of size {varsize} bytes */\n\n")
|
||||
var_defs = vars[varsize]
|
||||
for var in sorted(var_defs.keys()):
|
||||
data = var_defs[var]
|
||||
if data['type'] in enums:
|
||||
if enums[data['type']]['default_value'] is not None:
|
||||
init_value = enums[data['type']]['default_value']
|
||||
if data["type"] in enums:
|
||||
if enums[data["type"]]["default_value"] is not None:
|
||||
init_value = enums[data["type"]]["default_value"]
|
||||
else:
|
||||
cls.warning('Initializing enumeration %s to "zero".', data['type'])
|
||||
init_value = [k for k, v in enums[data['type']]['members'].items() if v == 0][0]
|
||||
cls.warning('Initializing enumeration %s to "zero".', data["type"])
|
||||
init_value = [k for k, v in enums[data["type"]]["members"].items() if v == 0][0]
|
||||
fh_c.write(f"{data['type']} {var} = {init_value};\n")
|
||||
else:
|
||||
fh_c.write(f"{data['type']} {var} = {0};\n")
|
||||
fh_c.write('\n')
|
||||
fh_c.write("\n")
|
||||
|
||||
@classmethod
|
||||
def _generate_var_initialization(cls, fh_c, vars, comment):
|
||||
"""Generate the variable initializations."""
|
||||
fh_c.write(f'\n{comment}\n\n')
|
||||
fh_c.write('\nvoid RESTART_VcDummy(void)\n{\n')
|
||||
fh_c.write(f"\n{comment}\n\n")
|
||||
fh_c.write("\nvoid RESTART_VcDummy(void)\n{\n")
|
||||
for varsize in sorted(vars.keys(), reverse=True):
|
||||
var_defs = vars[varsize]
|
||||
for var in sorted(var_defs.keys()):
|
||||
fh_c.write(f" {var} = {0};\n")
|
||||
fh_c.write('}\n')
|
||||
fh_c.write("}\n")
|
||||
|
||||
def _generate_c_file(self, filename):
|
||||
"""Generate the c-file defining all missing input variables."""
|
||||
general_includes = ''
|
||||
general_includes = ""
|
||||
general_includes += self._unit_cfg.base_types_headers
|
||||
for common_header_file in self._common_header_files:
|
||||
general_includes += f'#include "{common_header_file}"\n'
|
||||
general_includes += '\n'
|
||||
general_includes += "\n"
|
||||
|
||||
with open(filename, 'w', encoding="utf-8") as fh_c:
|
||||
with open(filename, "w", encoding="utf-8") as fh_c:
|
||||
fh_c.write(general_includes)
|
||||
fh_c.write(f'#include "{bd.CVC_DISP_START}"\n\n')
|
||||
self._generate_var_defs(fh_c, self._ext_vars, self._enumerations, '/** Missing external signals **/')
|
||||
self._generate_var_defs(fh_c, self._ext_vars, self._enumerations, "/** Missing external signals **/")
|
||||
fh_c.write(f'\n#include "{bd.CVC_DISP_END}"\n')
|
||||
self.info('Generated %s', filename)
|
||||
self.info("Generated %s", filename)
|
||||
|
||||
def generate_file(self, filename):
|
||||
"""Generate the files for defining all missing input variables."""
|
||||
self._restruct_input_data()
|
||||
self._generate_c_file(filename + '.c')
|
||||
self._generate_c_file(filename + ".c")
|
||||
a2l_dict = self._a2l_dict()
|
||||
A2l(a2l_dict, self._prj_cfg).gen_a2l(filename + '.a2l')
|
||||
A2l(a2l_dict, self._prj_cfg).gen_a2l(filename + ".a2l")
|
@ -7,17 +7,17 @@ import os
|
||||
from operator import itemgetter
|
||||
import math
|
||||
|
||||
import pybuild.build_defs as bd
|
||||
from pybuild import signal
|
||||
from pybuild.a2l import A2l
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from pybuild.types import byte_size, get_bitmask
|
||||
import powertrain_build.build_defs as bd
|
||||
from powertrain_build import signal
|
||||
from powertrain_build.a2l import A2l
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
from powertrain_build.types import byte_size, get_bitmask
|
||||
|
||||
|
||||
class DummySpm(ProblemLogger):
|
||||
"""Generate c-files which defines missing outport variables in the model out-port interface.
|
||||
|
||||
The models declare all in-ports as 'external' and pybuild will then
|
||||
The models declare all in-ports as 'external' and powertrain-build will then
|
||||
generate any missing outports in the correct #if/#endif guards here.
|
||||
One c-file per outport origin model should be generated.
|
||||
|
||||
@ -69,7 +69,7 @@ class DummySpm(ProblemLogger):
|
||||
Args:
|
||||
data_type (str): Data type.
|
||||
Returns:
|
||||
byte_size(pybuild.types.byte_size): Return result of pybuild.types.byte_size.
|
||||
byte_size(powertrain_build.types.byte_size): Return result of powertrain_build.types.byte_size.
|
||||
"""
|
||||
if data_type in self._enumerations:
|
||||
return byte_size(self._enumerations[data_type]['underlying_data_type'])
|
@ -13,7 +13,7 @@ def check_python_string(python_lower, python_upper=None):
|
||||
python_lower (str): Required lower bound for Python version.
|
||||
python_upper (str): Optional upper bound for Python version.
|
||||
Raises:
|
||||
RuntimeError: If current Python executable is not compatible with pybuild.
|
||||
RuntimeError: If current Python executable is not compatible with powertrain_build.
|
||||
|
||||
"""
|
||||
versions = [_split_version(python_lower)]
|
||||
@ -29,7 +29,7 @@ def check_python_tuple(python_lower, python_upper=None):
|
||||
python_lower (2-tuple): Required lower bound for Python version.
|
||||
python_upper (2-tuple): Optional upper bound for Python version.
|
||||
Raises:
|
||||
RuntimeError: If current Python executable is not compatible with pybuild.
|
||||
RuntimeError: If current Python executable is not compatible with powertrain_build.
|
||||
|
||||
"""
|
||||
cur_version = sys.version_info[:2]
|
@ -11,10 +11,10 @@ TODO: Check if all IO parameters in SPMEMSInterfaceRequirements.xlsx defined as
|
||||
import os
|
||||
import re
|
||||
|
||||
from pybuild import build_defs
|
||||
from pybuild.types import byte_size_string, get_bitmask, a2l_range
|
||||
from pybuild.a2l import A2l
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from powertrain_build import build_defs
|
||||
from powertrain_build.types import byte_size_string, get_bitmask, a2l_range
|
||||
from powertrain_build.a2l import A2l
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
|
||||
|
||||
class ExtDbg(ProblemLogger):
|
@ -4,10 +4,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Module containing classes for VCC - Supplier signal interface."""
|
||||
|
||||
from pybuild import build_defs
|
||||
from pybuild.types import byte_size_string, get_bitmask
|
||||
from pybuild.a2l import A2l
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from powertrain_build import build_defs
|
||||
from powertrain_build.types import byte_size_string, get_bitmask
|
||||
from powertrain_build.a2l import A2l
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
|
||||
|
||||
class ExtVarBase(ProblemLogger):
|
||||
@ -24,9 +24,16 @@ class ExtVarBase(ProblemLogger):
|
||||
INPORT_INDEX = 0
|
||||
OUTPORT_INDEX = 1
|
||||
|
||||
__data_type_size = {'Float32': '4', 'UInt32': '4', 'Int32': '4',
|
||||
'UInt16': '2', 'Int16': '2',
|
||||
'UInt8': '1', 'Int8': '1', 'Bool': '1'}
|
||||
__data_type_size = {
|
||||
"Float32": "4",
|
||||
"UInt32": "4",
|
||||
"Int32": "4",
|
||||
"UInt16": "2",
|
||||
"Int16": "2",
|
||||
"UInt8": "1",
|
||||
"Int8": "1",
|
||||
"Bool": "1",
|
||||
}
|
||||
|
||||
def __init__(self, variable_dict, prj_cfg, unit_cfg, user_defined_types, integrity_level=build_defs.ASIL_QM):
|
||||
"""Constructor.
|
||||
@ -52,10 +59,10 @@ class ExtVarBase(ProblemLogger):
|
||||
Args:
|
||||
integrity_level (str): integrity level of the unit from 'A' to 'D' or 'QM'
|
||||
"""
|
||||
self._disp_start = integrity_level['CVC']['DISP']['START']
|
||||
self._disp_end = integrity_level['CVC']['DISP']['END']
|
||||
self._decl_start = integrity_level['PREDECL']['DISP']['START']
|
||||
self._decl_end = integrity_level['PREDECL']['DISP']['END']
|
||||
self._disp_start = integrity_level["CVC"]["DISP"]["START"]
|
||||
self._disp_end = integrity_level["CVC"]["DISP"]["END"]
|
||||
self._decl_start = integrity_level["PREDECL"]["DISP"]["START"]
|
||||
self._decl_end = integrity_level["PREDECL"]["DISP"]["END"]
|
||||
|
||||
def _get_byte_size_string(self, data_type):
|
||||
"""Get byte size of a data type as string.
|
||||
@ -64,10 +71,11 @@ class ExtVarBase(ProblemLogger):
|
||||
Args:
|
||||
data_type (str): Data type.
|
||||
Returns:
|
||||
byte_size_string(pybuild.types.byte_size_string): Return result of pybuild.types.byte_size_string.
|
||||
byte_size_string(powertrain_build.types.byte_size_string): Return result of
|
||||
powertrain_build.types.byte_size_string.
|
||||
"""
|
||||
if data_type in self._enumerations:
|
||||
return byte_size_string(self._enumerations[data_type]['underlying_data_type'])
|
||||
return byte_size_string(self._enumerations[data_type]["underlying_data_type"])
|
||||
return byte_size_string(data_type)
|
||||
|
||||
def _get_bitmask(self, data_type):
|
||||
@ -77,10 +85,10 @@ class ExtVarBase(ProblemLogger):
|
||||
Args:
|
||||
data_type (str): Data type.
|
||||
Returns:
|
||||
get_bitmask(pybuild.types.get_bitmask): Return result of pybuild.types.get_bitmask.
|
||||
get_bitmask(powertrain_build.types.get_bitmask): Return result of powertrain_build.types.get_bitmask.
|
||||
"""
|
||||
if data_type in self._enumerations:
|
||||
return get_bitmask(self._enumerations[data_type]['underlying_data_type'])
|
||||
return get_bitmask(self._enumerations[data_type]["underlying_data_type"])
|
||||
return get_bitmask(data_type)
|
||||
|
||||
def _restruct_input_data(self):
|
||||
@ -105,34 +113,27 @@ class ExtVarBase(ProblemLogger):
|
||||
|
||||
def _a2l_dict(self):
|
||||
"""Return a dict defining all parameters for a2l-generation."""
|
||||
res = {
|
||||
'vars': {},
|
||||
'function': 'VcExtVar'
|
||||
}
|
||||
res = {"vars": {}, "function": "VcExtVar"}
|
||||
for inp in self.EXTERNAL_INPORT_TYPES:
|
||||
if inp in self._var_dict:
|
||||
for var, data in self._var_dict[inp].items():
|
||||
if data[self.TYPE_NAME] in self._enumerations:
|
||||
data_type = self._enumerations[data[self.TYPE_NAME]]['underlying_data_type']
|
||||
data_type = self._enumerations[data[self.TYPE_NAME]]["underlying_data_type"]
|
||||
else:
|
||||
data_type = data[self.TYPE_NAME]
|
||||
|
||||
resv = res['vars']
|
||||
resv.setdefault(var, {})['a2l_data'] = self.get_a2l_format(data)
|
||||
resv[var]['array'] = []
|
||||
resv[var]['function'] = ['VcEc']
|
||||
resv[var]['var'] = {
|
||||
'cvc_type': 'CVC_DISP',
|
||||
'type': data_type,
|
||||
'var': var
|
||||
}
|
||||
resv = res["vars"]
|
||||
resv.setdefault(var, {})["a2l_data"] = self.get_a2l_format(data)
|
||||
resv[var]["array"] = []
|
||||
resv[var]["function"] = ["VcEc"]
|
||||
resv[var]["var"] = {"cvc_type": "CVC_DISP", "type": data_type, "var": var}
|
||||
return res
|
||||
|
||||
def _generate_c_file(self, path):
|
||||
"""Generate the c-file defining all the supplier input signals."""
|
||||
header = path.with_suffix('.h').name
|
||||
header = path.with_suffix(".h").name
|
||||
var_set = set()
|
||||
with path.open('w') as fh_c:
|
||||
with path.open("w") as fh_c:
|
||||
fh_c.write(f'#include "{header}"\n')
|
||||
fh_c.write(f'#include "{self._disp_start}"\n\n')
|
||||
for data_type_s, ext_vars in self._ext_vars[self.INPORT_INDEX].items():
|
||||
@ -142,27 +143,27 @@ class ExtVarBase(ProblemLogger):
|
||||
if var not in var_set:
|
||||
fh_c.write(f"CVC_DISP {data[self.TYPE_NAME]} {var} = {data['init']};\n")
|
||||
var_set.add(var)
|
||||
fh_c.write('\n')
|
||||
fh_c.write("\n")
|
||||
fh_c.write(f'\n#include "{self._disp_end}"\n')
|
||||
self.info('Generated %s', path.name)
|
||||
self.info("Generated %s", path.name)
|
||||
|
||||
def _generate_h_file(self, path):
|
||||
"""Generate header file externally declaring interface signals."""
|
||||
filename = path.stem
|
||||
guard = f"{filename.upper()}_H"
|
||||
var_set = set()
|
||||
with path.open('w') as fh_c:
|
||||
fh_c.write(f'#ifndef {guard}\n')
|
||||
fh_c.write(f'#define {guard}\n')
|
||||
fh_c.write('#define CVC_DISP\n')
|
||||
with path.open("w") as fh_c:
|
||||
fh_c.write(f"#ifndef {guard}\n")
|
||||
fh_c.write(f"#define {guard}\n")
|
||||
fh_c.write("#define CVC_DISP\n")
|
||||
fh_c.write(self._unit_cfg.base_types_headers)
|
||||
|
||||
for common_header_file in self._common_header_files:
|
||||
fh_c.write(f'#include "{common_header_file}"\n')
|
||||
fh_c.write('\n')
|
||||
fh_c.write("\n")
|
||||
|
||||
fh_c.write(f'#include "{self._decl_start}"\n')
|
||||
fh_c.write('/* VCC Inports */\n')
|
||||
fh_c.write("/* VCC Inports */\n")
|
||||
for data_type_s, ext_vars in self._ext_vars[self.INPORT_INDEX].items():
|
||||
fh_c.write(f"/* Variables of size {data_type_s} bytes */\n\n")
|
||||
for var in sorted(ext_vars.keys()):
|
||||
@ -170,9 +171,9 @@ class ExtVarBase(ProblemLogger):
|
||||
data = ext_vars[var]
|
||||
fh_c.write(f"extern CVC_DISP {data[self.TYPE_NAME]} {var};\n")
|
||||
var_set.add(var)
|
||||
fh_c.write('\n')
|
||||
fh_c.write("\n")
|
||||
|
||||
fh_c.write('/* VCC Outports */\n')
|
||||
fh_c.write("/* VCC Outports */\n")
|
||||
for data_type_s, ext_vars in self._ext_vars[self.OUTPORT_INDEX].items():
|
||||
fh_c.write(f"/* Variables of size {data_type_s} bytes */\n\n")
|
||||
for var in sorted(ext_vars.keys()):
|
||||
@ -180,22 +181,22 @@ class ExtVarBase(ProblemLogger):
|
||||
data = ext_vars[var]
|
||||
fh_c.write(f"extern CVC_DISP {data[self.TYPE_NAME]} {var};\n")
|
||||
var_set.add(var)
|
||||
fh_c.write('\n')
|
||||
fh_c.write("\n")
|
||||
fh_c.write(f'#include "{self._decl_end}"\n')
|
||||
fh_c.write('#endif\n')
|
||||
self.info('Generated %s', path.name)
|
||||
fh_c.write("#endif\n")
|
||||
self.info("Generated %s", path.name)
|
||||
|
||||
def generate_files(self, path):
|
||||
"""Generate the c- and a2l-file for defining all the supplier input variables."""
|
||||
self._restruct_input_data()
|
||||
if not self._ext_vars[0] and not self._ext_vars[1]:
|
||||
self.info(f'Skipping {path.name} as there were no corresponding vars.')
|
||||
self.info(f"Skipping {path.name} as there were no corresponding vars.")
|
||||
return
|
||||
self._generate_c_file(path.with_suffix('.c'))
|
||||
self._generate_h_file(path.with_suffix('.h'))
|
||||
self._generate_c_file(path.with_suffix(".c"))
|
||||
self._generate_h_file(path.with_suffix(".h"))
|
||||
a2l_dict = self._a2l_dict()
|
||||
a2l = A2l(a2l_dict, self._prj_cfg)
|
||||
a2l.gen_a2l(path.with_suffix('.a2l'))
|
||||
a2l.gen_a2l(path.with_suffix(".a2l"))
|
||||
|
||||
|
||||
class ExtVarCsv(ExtVarBase):
|
||||
@ -228,9 +229,10 @@ class ExtVarCsv(ExtVarBase):
|
||||
'xxx-Output': ...
|
||||
}
|
||||
"""
|
||||
EXTERNAL_INPORT_TYPES = ['EMS-Input', 'CAN-Input', 'Private CAN-Input', 'LIN-Input']
|
||||
EXTERNAL_OUTPORT_TYPES = ['EMS-Output', 'CAN-Output', 'Private CAN-Output', 'LIN-Output']
|
||||
TYPE_NAME = 'type'
|
||||
|
||||
EXTERNAL_INPORT_TYPES = ["EMS-Input", "CAN-Input", "Private CAN-Input", "LIN-Input"]
|
||||
EXTERNAL_OUTPORT_TYPES = ["EMS-Output", "CAN-Output", "Private CAN-Output", "LIN-Output"]
|
||||
TYPE_NAME = "type"
|
||||
|
||||
def get_a2l_format(self, data):
|
||||
"""Get a2l format.
|
||||
@ -241,15 +243,15 @@ class ExtVarCsv(ExtVarBase):
|
||||
dict: A2l format dictionary.
|
||||
"""
|
||||
return {
|
||||
'bitmask': self._get_bitmask(data[self.TYPE_NAME]),
|
||||
'description': data['description'],
|
||||
'lsb': '2^0',
|
||||
'max': data['max'],
|
||||
'min': data['min'],
|
||||
'offset': '0',
|
||||
'unit': data['unit'],
|
||||
'x_axis': None,
|
||||
'y_axis': None
|
||||
"bitmask": self._get_bitmask(data[self.TYPE_NAME]),
|
||||
"description": data["description"],
|
||||
"lsb": "2^0",
|
||||
"max": data["max"],
|
||||
"min": data["min"],
|
||||
"offset": "0",
|
||||
"unit": data["unit"],
|
||||
"x_axis": None,
|
||||
"y_axis": None,
|
||||
}
|
||||
|
||||
|
||||
@ -271,9 +273,10 @@ class ExtVarYaml(ExtVarBase):
|
||||
'status': {},
|
||||
}
|
||||
"""
|
||||
EXTERNAL_INPORT_TYPES = ['input', 'status']
|
||||
EXTERNAL_OUTPORT_TYPES = ['output']
|
||||
TYPE_NAME = 'variable_type'
|
||||
|
||||
EXTERNAL_INPORT_TYPES = ["input", "status"]
|
||||
EXTERNAL_OUTPORT_TYPES = ["output"]
|
||||
TYPE_NAME = "variable_type"
|
||||
|
||||
def get_a2l_format(self, data):
|
||||
"""Get a2l format.
|
||||
@ -284,13 +287,13 @@ class ExtVarYaml(ExtVarBase):
|
||||
dict: A2l format dictionary.
|
||||
"""
|
||||
return {
|
||||
'bitmask': self._get_bitmask(data[self.TYPE_NAME]),
|
||||
'description': data['description'],
|
||||
'lsb': '2^0',
|
||||
'max': data['range']['max'],
|
||||
'min': data['range']['min'],
|
||||
'offset': '0',
|
||||
'unit': data['unit'],
|
||||
'x_axis': None,
|
||||
'y_axis': None
|
||||
"bitmask": self._get_bitmask(data[self.TYPE_NAME]),
|
||||
"description": data["description"],
|
||||
"lsb": "2^0",
|
||||
"max": data["range"]["max"],
|
||||
"min": data["range"]["min"],
|
||||
"offset": "0",
|
||||
"unit": data["unit"],
|
||||
"x_axis": None,
|
||||
"y_axis": None,
|
||||
}
|
@ -10,9 +10,9 @@ import os
|
||||
import re
|
||||
from pprint import pformat
|
||||
|
||||
from pybuild.lib.helper_functions import deep_dict_update
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from pybuild.xlrd_csv import WorkBook
|
||||
from powertrain_build.lib.helper_functions import deep_dict_update
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
from powertrain_build.xlrd_csv import WorkBook
|
||||
|
||||
|
||||
class FeatureConfigs(ProblemLogger):
|
@ -7,10 +7,10 @@ import os
|
||||
from copy import deepcopy
|
||||
from numpy import array
|
||||
from scipy.io import savemat
|
||||
from pybuild.signal_interfaces import SignalInterfaces
|
||||
from pybuild.unit_configs import UnitConfigs
|
||||
from pybuild.lib.helper_functions import merge_dicts
|
||||
from pybuild.problem_logger import ProblemLogger
|
||||
from powertrain_build.signal_interfaces import SignalInterfaces
|
||||
from powertrain_build.unit_configs import UnitConfigs
|
||||
from powertrain_build.lib.helper_functions import merge_dicts
|
||||
from powertrain_build.problem_logger import ProblemLogger
|
||||
|
||||
|
||||
def _get_signals_by_type(signal_conf, signal_type):
|
@ -8,10 +8,10 @@ import json
|
||||
import sys
|
||||
from xml.etree import ElementTree
|
||||
from pathlib import Path
|
||||
from pybuild.feature_configs import FeatureConfigs
|
||||
from pybuild.unit_configs import UnitConfigs
|
||||
from pybuild.signal_interfaces import CsvSignalInterfaces
|
||||
from pybuild.lib import helper_functions, logger
|
||||
from powertrain_build.feature_configs import FeatureConfigs
|
||||
from powertrain_build.unit_configs import UnitConfigs
|
||||
from powertrain_build.signal_interfaces import CsvSignalInterfaces
|
||||
from powertrain_build.lib import helper_functions, logger
|
||||
|
||||
LOGGER = logger.create_logger(__file__)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2024 Volvo Car Corporation
|
||||
# Licensed under Apache 2.0.
|
||||
|
||||
"""pybuild.zone_controller."""
|
||||
"""powertrain_build.interface."""
|
@ -7,12 +7,12 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
|
||||
from pybuild.interface.base import BaseApplication, Signal, MultipleProducersError, Domain, Interface
|
||||
from pybuild.lib import logger
|
||||
from pybuild.build_proj_config import BuildProjConfig
|
||||
from pybuild.feature_configs import FeatureConfigs
|
||||
from pybuild.unit_configs import UnitConfigs
|
||||
from pybuild.user_defined_types import UserDefinedTypes
|
||||
from powertrain_build.interface.base import BaseApplication, Signal, MultipleProducersError, Domain, Interface
|
||||
from powertrain_build.lib import logger
|
||||
from powertrain_build.build_proj_config import BuildProjConfig
|
||||
from powertrain_build.feature_configs import FeatureConfigs
|
||||
from powertrain_build.unit_configs import UnitConfigs
|
||||
from powertrain_build.user_defined_types import UserDefinedTypes
|
||||
|
||||
|
||||
LOGGER = logger.create_logger("application")
|
||||
@ -202,7 +202,7 @@ class Application(BaseApplication):
|
||||
self._methods.append(method)
|
||||
|
||||
def get_signal_properties(self, signal):
|
||||
""" Get properties for the signal from pybuild definition.
|
||||
""" Get properties for the signal from powertrain_build definition.
|
||||
|
||||
Args:
|
||||
signal (Signal): Signal object
|
||||
@ -217,10 +217,10 @@ class Application(BaseApplication):
|
||||
return {}
|
||||
|
||||
def get_rasters(self):
|
||||
""" Get rasters parsed from pybuild.
|
||||
""" Get rasters parsed from powertrain_build.
|
||||
|
||||
Returns:
|
||||
rasters (list): rasters parsed from pybuild
|
||||
rasters (list): rasters parsed from powertrain_build
|
||||
"""
|
||||
if self._signals is None:
|
||||
self._get_signals()
|
||||
@ -282,7 +282,7 @@ class Raster(BaseApplication):
|
||||
"""Construct a new Raster object.
|
||||
|
||||
Args:
|
||||
app (pybuild.interface.application.Application): Pybuild project raster is part of
|
||||
app (powertrain_build.interface.application.Application): Pybuild project raster is part of
|
||||
"""
|
||||
self.app = app
|
||||
self.name = str()
|
||||
@ -292,7 +292,7 @@ class Raster(BaseApplication):
|
||||
self.models = set()
|
||||
|
||||
def parse_definition(self, definition):
|
||||
""" Parse the definition from pybuild.
|
||||
""" Parse the definition from powertrain_build.
|
||||
|
||||
Args:
|
||||
definition (tuple):
|
||||
@ -330,7 +330,7 @@ class Raster(BaseApplication):
|
||||
self._outsignals.add(signal.name)
|
||||
|
||||
def get_signal_properties(self, signal):
|
||||
""" Get properties for the signal from pybuild definition.
|
||||
""" Get properties for the signal from powertrain_build definition.
|
||||
|
||||
Args:
|
||||
signal (Signal): Signal object
|
||||
@ -354,7 +354,7 @@ class Model(BaseApplication):
|
||||
self._signal_specs = None
|
||||
|
||||
def get_signal_properties(self, signal):
|
||||
""" Get properties for the signal from pybuild definition.
|
||||
""" Get properties for the signal from powertrain_build definition.
|
||||
|
||||
Args:
|
||||
signal (Signal): Signal object
|
||||
@ -410,7 +410,7 @@ class Model(BaseApplication):
|
||||
return json.load(fhndl)
|
||||
|
||||
def parse_definition(self, definition):
|
||||
""" Parse the definition from pybuild.
|
||||
""" Parse the definition from powertrain_build.
|
||||
|
||||
Args:
|
||||
definition (tuple):
|
||||
@ -428,7 +428,7 @@ class Method(BaseApplication):
|
||||
"""Construct a new Method object.
|
||||
|
||||
Args:
|
||||
app (pybuild.interface.application.Application): Pybuild project raster is part of.
|
||||
app (powertrain_build.interface.application.Application): Pybuild project raster is part of.
|
||||
unit (str): Model that the method is defined in.
|
||||
"""
|
||||
self.app = app
|
||||
@ -444,7 +444,7 @@ class Method(BaseApplication):
|
||||
self._properties = {}
|
||||
|
||||
def parse_definition(self, definition):
|
||||
""" Parse the definition from pybuild.
|
||||
""" Parse the definition from powertrain_build.
|
||||
|
||||
Args:
|
||||
definition (tuple):
|
@ -5,7 +5,7 @@
|
||||
"""Python module used for abstracting an application that should be interfacing others."""
|
||||
from abc import abstractmethod
|
||||
from ruamel.yaml import YAML
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger('base')
|
||||
|
@ -6,8 +6,8 @@
|
||||
import enum
|
||||
from ruamel.yaml import YAML
|
||||
from abc import abstractmethod
|
||||
from pybuild.interface.base import BaseApplication, Signal
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.interface.base import BaseApplication, Signal
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger("service")
|
||||
|
@ -4,8 +4,8 @@
|
||||
"""Python module used for reading device proxy arxml:s"""
|
||||
from ruamel.yaml import YAML
|
||||
import enum
|
||||
from pybuild.interface.base import BaseApplication, Signal
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.interface.base import BaseApplication, Signal
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger("device_proxy")
|
||||
|
@ -4,10 +4,10 @@
|
||||
"""Module for extraction Energy Management System"""
|
||||
import os
|
||||
|
||||
from pybuild.interface.base import BaseApplication, Signal
|
||||
from pybuild.lib import logger
|
||||
from pybuild.signal_interfaces import CsvSignalInterfaces
|
||||
from pybuild.build_proj_config import BuildProjConfig
|
||||
from powertrain_build.interface.base import BaseApplication, Signal
|
||||
from powertrain_build.lib import logger
|
||||
from powertrain_build.signal_interfaces import CsvSignalInterfaces
|
||||
from powertrain_build.build_proj_config import BuildProjConfig
|
||||
|
||||
LOGGER = logger.create_logger(__file__)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright 2024 Volvo Car Corporation
|
||||
# Licensed under Apache 2.0.
|
||||
|
||||
"""Module to export information of global variables from pybuild projects."""
|
||||
"""Module to export information of global variables from powertrain_build projects."""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
@ -10,9 +10,9 @@ from typing import Dict, Tuple
|
||||
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
from pybuild.build_proj_config import BuildProjConfig
|
||||
from pybuild.feature_configs import FeatureConfigs
|
||||
from pybuild.unit_configs import UnitConfigs
|
||||
from powertrain_build.build_proj_config import BuildProjConfig
|
||||
from powertrain_build.feature_configs import FeatureConfigs
|
||||
from powertrain_build.unit_configs import UnitConfigs
|
||||
|
||||
|
||||
def get_global_variables(project_config_path: str) -> Dict:
|
||||
@ -53,7 +53,7 @@ def _get_variable_type(variable_info: Dict) -> str:
|
||||
|
||||
|
||||
def _get_project_data(project_config_path: str) -> Tuple[str, Dict]:
|
||||
"""Gets data for a pybuild project.
|
||||
"""Gets data for a powertrain-build project.
|
||||
|
||||
Args:
|
||||
project_config_path (str): Path to ProjectCfg.json file.
|
@ -5,13 +5,13 @@
|
||||
"""Python module used for calculating interfaces for CSP"""
|
||||
from pathlib import Path
|
||||
from os import path
|
||||
from pybuild.interface.hal import HALA
|
||||
from pybuild.interface.device_proxy import DPAL
|
||||
from pybuild.interface.service import ServiceFramework
|
||||
from pybuild.interface import simulink
|
||||
from pybuild.lib import logger
|
||||
from pybuild.interface import generation_utils
|
||||
from pybuild.lib.helper_functions import deep_json_update
|
||||
from powertrain_build.interface.hal import HALA
|
||||
from powertrain_build.interface.device_proxy import DPAL
|
||||
from powertrain_build.interface.service import ServiceFramework
|
||||
from powertrain_build.interface import simulink
|
||||
from powertrain_build.lib import logger
|
||||
from powertrain_build.interface import generation_utils
|
||||
from powertrain_build.lib.helper_functions import deep_json_update
|
||||
|
||||
LOGGER = logger.create_logger("CSP adapters")
|
||||
|
@ -4,9 +4,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Python module used for calculating interfaces for CSP HI"""
|
||||
from pathlib import Path
|
||||
from pybuild.interface import generation_utils
|
||||
from pybuild.interface.device_proxy import DPAL
|
||||
from pybuild.lib.helper_functions import recursive_default_dict, to_normal_dict
|
||||
from powertrain_build.interface import generation_utils
|
||||
from powertrain_build.interface.device_proxy import DPAL
|
||||
from powertrain_build.lib.helper_functions import recursive_default_dict, to_normal_dict
|
||||
|
||||
OP_READ = 'read'
|
||||
OP_WRITE = 'write'
|
@ -4,9 +4,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Python module used for calculating interfaces for CSP"""
|
||||
from pathlib import Path
|
||||
from pybuild.interface.service import get_service
|
||||
from pybuild.lib import logger
|
||||
from pybuild.interface import generation_utils
|
||||
from powertrain_build.interface.service import get_service
|
||||
from powertrain_build.lib import logger
|
||||
from powertrain_build.interface import generation_utils
|
||||
|
||||
LOGGER = logger.create_logger("CSP service")
|
||||
|
@ -4,11 +4,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Python module used for calculating interfaces for CSP"""
|
||||
from pathlib import Path
|
||||
from pybuild.interface.hal import HALA, get_hal_list
|
||||
from pybuild.interface.device_proxy import DPAL
|
||||
from pybuild.interface.service import ServiceFramework, get_service_list
|
||||
from pybuild.lib import logger
|
||||
from pybuild.interface import generation_utils
|
||||
from powertrain_build.interface.hal import HALA, get_hal_list
|
||||
from powertrain_build.interface.device_proxy import DPAL
|
||||
from powertrain_build.interface.service import ServiceFramework, get_service_list
|
||||
from powertrain_build.lib import logger
|
||||
from powertrain_build.interface import generation_utils
|
||||
|
||||
LOGGER = logger.create_logger("CSP wrappers")
|
||||
|
@ -6,9 +6,9 @@
|
||||
import argparse
|
||||
from ruamel.yaml import YAML
|
||||
from pathlib import Path
|
||||
from pybuild.interface.application import Application, get_internal_domain
|
||||
from pybuild.interface.base import filter_signals
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.interface.application import Application, get_internal_domain
|
||||
from powertrain_build.interface.base import filter_signals
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger("CSP interface generation utils")
|
||||
|
||||
@ -43,7 +43,7 @@ def process_app(config):
|
||||
Args:
|
||||
config (pathlib.Path): Path to the ProjectCfg.json
|
||||
Returns:
|
||||
app (Application): pybuild project
|
||||
app (Application): powertrain-build project
|
||||
"""
|
||||
app = Application()
|
||||
app.parse_definition(config)
|
@ -5,8 +5,8 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
from ruamel.yaml import YAML
|
||||
from pybuild.interface.csp_api import CspApi
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.interface.csp_api import CspApi
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger('base')
|
||||
|
@ -8,8 +8,8 @@ import logging
|
||||
from pathlib import Path
|
||||
from voluptuous import All, MultipleInvalid, Optional, Required, Schema
|
||||
from ruamel.yaml import YAML
|
||||
from pybuild.interface.application import Application
|
||||
from pybuild.interface.base import BaseApplication
|
||||
from powertrain_build.interface.application import Application
|
||||
from powertrain_build.interface.base import BaseApplication
|
||||
|
||||
|
||||
class ModelYmlVerification(BaseApplication):
|
||||
@ -310,7 +310,7 @@ def get_app(project_config):
|
||||
Args:
|
||||
config (pathlib.Path): Path to the ProjectCfg.json.
|
||||
Returns:
|
||||
app (Application): pybuild project.
|
||||
app (Application): powertrain-build project.
|
||||
"""
|
||||
app = Application()
|
||||
app.parse_definition(project_config)
|
@ -6,10 +6,10 @@
|
||||
|
||||
import re
|
||||
|
||||
from pybuild.interface.base import filter_signals
|
||||
from pybuild.interface.csp_api import CspApi
|
||||
from pybuild.interface.application import get_internal_domain
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.interface.base import filter_signals
|
||||
from powertrain_build.interface.csp_api import CspApi
|
||||
from powertrain_build.interface.application import get_internal_domain
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger("service")
|
||||
|
@ -4,7 +4,7 @@
|
||||
"""Module to handle the Simulink interface."""
|
||||
|
||||
|
||||
from pybuild.lib import logger
|
||||
from powertrain_build.lib import logger
|
||||
|
||||
LOGGER = logger.create_logger("simulink")
|
||||
|
@ -7,8 +7,8 @@
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from ruamel.yaml import YAML
|
||||
from pybuild.interface.application import Application
|
||||
from pybuild.interface.base import BaseApplication
|
||||
from powertrain_build.interface.application import Application
|
||||
from powertrain_build.interface.base import BaseApplication
|
||||
|
||||
|
||||
class BadYamlFormat(Exception):
|
||||
@ -148,7 +148,7 @@ def get_app(config):
|
||||
Args:
|
||||
config (pathlib.Path): Path to the ProjectCfg.json.
|
||||
Returns:
|
||||
app (Application): pybuild project.
|
||||
app (Application): powertrain_build project.
|
||||
"""
|
||||
app = Application()
|
||||
app.parse_definition(config)
|
@ -3,8 +3,8 @@
|
||||
|
||||
"""Python module used for handling zone controller specifications"""
|
||||
from ruamel.yaml import YAML
|
||||
from pybuild.lib import logger
|
||||
from pybuild.interface.base import BaseApplication
|
||||
from powertrain_build.lib import logger
|
||||
from powertrain_build.interface.base import BaseApplication
|
||||
|
||||
LOGGER = logger.create_logger("base")
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2024 Volvo Car Corporation
|
||||
# Licensed under Apache 2.0.
|
||||
|
||||
"""pybuild.lib."""
|
||||
"""powertrain_build.lib."""
|
@ -4,7 +4,7 @@
|
||||
function updateCodeSwConfig(RootFolder, model_path)
|
||||
% updateCodeSwConfig(RootFolder, model_path)
|
||||
%
|
||||
% Executes 'py -3.6 -m pybuild.config models' for the model.
|
||||
% Executes 'py -3.6 -m powertrain_build.config models' for the model.
|
||||
% This script reads the .json, .c and .h-files and looks for configs for
|
||||
% the variables that already have a config in the json.
|
||||
%
|
||||
@ -13,26 +13,19 @@ function updateCodeSwConfig(RootFolder, model_path)
|
||||
% model_path: Path to the model to regenerate config for.
|
||||
old_pythonpath = getenv('PYTHONPATH');
|
||||
|
||||
if ~isempty(getenv('PYBUILD_ACTIVATE'))
|
||||
% Repo using venv in Zuul/Jenkins.
|
||||
% Installs pytools python package and dependencies, see Script/PyTools/setup_pytools.*.
|
||||
[~, out]=system(['CALL %PYBUILD_ACTIVATE% & python -m pybuild.config models "' model_path '"']);
|
||||
elseif ~isempty(getenv('VENV_FOLDER'))
|
||||
% Legacy, repo using venv in Zuul/Jenkins.
|
||||
% Repo using pytools folder but it's dependencies in a venv.
|
||||
[~, out]=system(['CALL %VENV_FOLDER%\Scripts\activate.bat & python -m pybuild.config models "' model_path '"']);
|
||||
if ~isempty(getenv('PYTOOLS_ACTIVATE'))
|
||||
[~, out]=system(['CALL %PYTOOLS_ACTIVATE% & python -m powertrain_build.config models "' model_path '"']);
|
||||
elseif ~isempty(getenv('CALLING_PYTHON'))
|
||||
% Local run using calling python version
|
||||
fprintf('\nUsing calling python: %s\n', getenv('CALLING_PYTHON'));
|
||||
setenv('PYTHONPATH', RootFolder)
|
||||
[~, out]=system(['%CALLING_PYTHON% -m pybuild.config models "' model_path '"']);
|
||||
[~, out]=system(['%CALLING_PYTHON% -m powertrain_build.config models "' model_path '"']);
|
||||
else
|
||||
% Local run
|
||||
fprintf('\nUsing python version 3.6\n');
|
||||
setenv('PYTHONPATH', RootFolder)
|
||||
[~, out]=system(['py -3.6 -m pybuild.config models "' model_path '"']);
|
||||
[~, out]=system(['py -3.6 -m powertrain_build.config models "' model_path '"']);
|
||||
end
|
||||
|
||||
disp(out)
|
||||
setenv('PYTHONPATH', old_pythonpath)
|
||||
end
|
@ -23,7 +23,7 @@ dsdd_manage_project('SetProjectFile', dd_file(1).name);
|
||||
|
||||
tl_pref('set', 'projectfileautosave', 'off');
|
||||
% Init Pybuild
|
||||
disp('Initializing pybuild')
|
||||
disp('Initializing powertrain-build')
|
||||
Models = Init_Models('Models');
|
||||
Projects = Init_Projects('Projects', Models);
|
||||
QuantityUnitList = Read_Units();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user