Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize CANToolz modules #9

Closed
5 tasks done
DePierre opened this issue Aug 27, 2017 · 1 comment
Closed
5 tasks done

Reorganize CANToolz modules #9

DePierre opened this issue Aug 27, 2017 · 1 comment

Comments

@DePierre
Copy link
Contributor

DePierre commented Aug 27, 2017

CANToolz has a lot of awesome modules but they are all under the same directory modules, which makes it sometimes hard when you try to find a specific one.

In addition, some modules are named using a different norm than others and should IMO be renamed. For instance, I would suggest stripping the mod_ prefix of some of the modules, since it seems redundant.

I would suggest reorganizing the modules with something like:

modules/  <-- base modules will be found at the base directory (e.g. `mod_stats.py`)
    vircar/  <-- modules related to emulating virtual car
    io/  <-- modules supporting specific I/O hardware
    vendor/  <-- modules specific to physical car (i.e. `renault_twingo_pcm.py`)

By default, CANToolz would recursively look for the module the user wants to use. If more than one module with the provided name is found, then CANToolz would throw an error and ask for a more specific file. In case a name clash occurs, CANToolz will load the first module it found.

For instance:

# Loading modules/vendor/my_module.py
# If there is only one module named `my_module` under `modules/`, then everything's fine
# Otherwise, CANToolz would raise an exception when loading the configuration
load_modules = {
    'my_module': {}  
}

# Loading modules/vendor/my_module.py
# Need to be specific since modules/io/my_module.py exists as well
load_modules = {
    'vendor/my_module': {}  
}
  • Rename modules to have a consistent naming convention
  • Update references (e.g. Wiki)
  • Categorize and reorganize existing modules following the structure described above
  • Improve CANToolz module loading to recursively search modules under modules/
  • Keep retro-compatibility with older configurations files
DePierre added a commit that referenced this issue Aug 28, 2017
#9).

- Backward compatibility with older configurations
- Keep supporting loading modules from `load_modules` dict
- Show warning log message when doing so to specify that it has been
deprecated
DePierre added a commit that referenced this issue Aug 28, 2017
+ Remove mod_fuzz1 in favor of gen_fuzz module
+ Rename mod_stat to analyze
+ Rename mod_firewall to firewall
+ Rename gen_fuzz to fuzz
+ Rename gen_ping to ping
+ Rename gen_replay to replay
+ Rename can_controls to can_control
@DePierre
Copy link
Contributor Author

The references to old modules in the Wiki have been updated. I believe that now, modules are more consistently named and organized.

Additional changes might be done in the future but it should be good enough for now to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant