GithubHelp home page GithubHelp logo

marcpage / pylavi Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 3.0 638 KB

Python LabVIEW resource file parser

License: The Unlicense

Python 99.84% Makefile 0.16%
extractor fileformat labview reverse-engineering python python-3 code-quality continuous-integration testing

pylavi's People

Contributors

marcpage avatar rtzoeller avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pylavi's Issues

Document research process

Is your feature request related to a problem? Please describe.
How can you use tools in pylavi to reverse engineer parts of the resource formats?

Describe the solution you'd like
Add a contributing and have a section on how to save VIs before and after a change and diff them using lv_assemble -d

Describe alternatives you've considered
Implement a differ. This might be confused for a G-Code differ, which this would not be valuable for.

Additional context
None

Add path length check

Is your feature request related to a problem? Please describe.
On Windows if the path to a VI is too long it can potentially cause problems. It would be nice to have a check that warns of this condition.

Describe the solution you'd like
Add a check in validate.py where you can pass in maximum length of the relative path.

Describe alternatives you've considered
None.

Additional context
None.

Validate linker paths are not absolute

Is your feature request related to a problem? Please describe.
Finding out you have a VI that links to another VI via absolute path (C:\Documents...) can causes searches to happen during builds, slowing down the builds.

Describe the solution you'd like
Add a check to vi_validate for linker paths that are absolute (but not to things like ).

Describe alternatives you've considered
None

Additional context
None

Add support for files in LLBs

Is your feature request related to a problem? Please describe.
There are still a handful of VIs that are in LLBs and a few corner cases where LLBs come in handy. This tool completely ignores VIs in LLBs.

Describe the solution you'd like
Document how LLBs work and then add support for VIs in LLBs.

Describe alternatives you've considered
None

Additional context
None

Support four digit version year in comparisons

In the lab view version comparisons, it seems to use two digit version year. it would be nice if four digit years were allowed.

For coercing labview versions to two digits, I typically check if the major version value is greater than 2000, then subtract 2000. (Eg, 2024 —> 24, 23 —> 23)

Disassemble (lv_assemble -d) should have more readable data for known types

Is your feature request related to a problem? Please describe.
Having binary output for disassembled file for known types is annoying.

Describe the solution you'd like
Lookup the TypeCCCC class in resource_types namespace and construct it from the binary data and call to_dict() to create the data to display in the output.

Describe alternatives you've considered
Maybe a lookup table. Maybe be configurable by the user.

Additional context
None

Add check for breakpoints

Is your feature request related to a problem? Please describe.
It is very annoying to forget and leave breakpoints in your code, ship it, and then customers hit the breakpoint in the field.

Describe the solution you'd like
Update validate.py to check for breakpoints

Describe alternatives you've considered
Check for debugging. I think leaving VIs debuggable is valuable.

Additional context
None

Add type for interpreting 'vers' resource

Create the file pylavi/resource_types.py and add a class for interpreting 'vers' resource using the documentation from #1

This class should look similar to a Structure. It should also have comparison (__lt__, __eq__) operators.

It should use the version interpreting code from #2 and the byte-length-prefixed data type from #4

Disassemble (lv_assemble -d) should be Yaml

Is your feature request related to a problem? Please describe.
JSON is finicky and easy to get wrong. The (dis)assemble format should be yaml which is much more forgiving and allows for comments.

Describe the solution you'd like
Change the text format to yaml

Describe alternatives you've considered
None

Additional context
None

Update README.md for vi_validate

Is your feature request related to a problem? Please describe.
No one knows about vi_validate on the front page

Describe the solution you'd like
Add section on validating VIs in README.md

Describe alternatives you've considered
None

Additional context
None

VIT files always show as containing source even though source has been separated

I'm not sure if this is a LabVIEW bug (e.g. if the source code is really still present for VIT files) or if pylavi is treating them incorrectly and falsely determining that source code is present.

In my case, I was not able to get the --no-code test to pass for my .vit files, so I had to use a --skip *.vit option to skip them.

Here's an example run that failed on VITs: https://github.com/vipm-io/OpenG-Variant-Data-Library/actions/runs/7907953103/job/21586124086

Validate window's position is within a range

Is your feature request related to a problem? Please describe.
It is frustrating when someone with multiple 4k monitors edits a VI and then I try to open it on my laptop.

Describe the solution you'd like
vi_validate should have a check for VIs saved with windows outside of a given range.

Describe alternatives you've considered
None

Additional context
None

Add clear indicators check

Is your feature request related to a problem? Please describe.
It might be helpful to validate that clearing controls on run is either enabled or disabled to create consistent behavior.

Describe the solution you'd like
Update validate.py to check for debugging turned on/of.

Describe alternatives you've considered
LabVIEW could do this, but it would take a long time.

Additional context
None.

--skip parameter for vi_validate (validate.py) does nothing

Describe the bug
--skip parameter is not used in the code. It should skip files/directories that match.

To Reproduce
Steps to reproduce the behavior:

  1. vi_validate -skip tests
  2. It still validates the tests directory

Expected behavior
It should skip all --skip arguments in the file search

Screenshots
None
Desktop (please complete the following information):

  • OS: macOS
  • Version: Ventura 13.2.1

Additional context
None

Create vi_validate executable

Is your feature request related to a problem? Please describe.
This is the crowning feature of the milestone.

Describe the solution you'd like
A new validate.py is added that takes command line parameters for paths to search and comparisons to perform.
A new setup.py command vi_validate is added that calls pylavi.vi_validate.main()

Validation arguments anded together:

  • --lt - must be saved in a version before this version
  • --gt - must be saved in a version after this version
  • --eq - must be saved in exactly this version
  • --no-release - must not be release version
  • --no-beta - must not be beta version
  • --no-alpha - must not be alpha version
  • --no-development - must not be development version

Search arguments:

  • --path - search this path (may be VI or directory)
  • --skip - do not search in this path (may be VI or directory)
  • --extension - allowed extension (by default all known extensions are used)

Describe alternatives you've considered
A config file can be added later for more fine-grained control over the process.

Additional context
Scan the current directory for

Validate run on open

Is your feature request related to a problem? Please describe.
There are some VIs which should be run-on-open and there are others that should not be. It would be great if we could verify what state the VI run on open is.

Describe the solution you'd like
Add to vi_validate to check the run on open state of the VI

Describe alternatives you've considered
None

Additional context
None

Disassemble (lv_assemble -d) should store external png files for ICON, icl4, and icl8

Is your feature request related to a problem? Please describe.
Disassembled icons in text form just are not that usable.

Describe the solution you'd like
If the output is a file, then create .png files like testing.vi -> testing.yaml, testing_ICON#30.png.
The text source would have the name of the file.
When assembling, it would pull in the .png and convert it back to the binary type.

Describe alternatives you've considered
Draw the icons in ascii art in the text file.

Additional context
None

Add debugging check

Is your feature request related to a problem? Please describe.
Disabling debugging can potentially speed up execution. Checking to ensure the VIs have debugging turned off would be helpful.

Describe the solution you'd like
Update validate.py to check that debugging is enabled or disabled.

Describe alternatives you've considered
LabVIEW process could set this field, but very slow to even launch LabVIEW

Additional context
None

Show all failures (don't stop after first failure)

Is your feature request related to a problem? Please describe.
I am running pylavi for the first time on a codebase and I'd like to know all the failures. Right now, it appears to exit immediately after the first failure. I can also imagine that when a user pushes code, they will have to fix all the failures and only noticing them one at a time (fixing, committing, pushing, and waiting for CI to inform about the next failure) will be quite time consuming.

Describe the solution you'd like
It would be nice to have an option to test all the VIs in the project (to completion even if a failure occurs) and output a list of all the failures at the end.

Describe alternatives you've considered
N/A

Additional context
Thanks for the great tool!

lv_assemble should support conditional assembly (preprocessor?)

Is your feature request related to a problem? Please describe.
If I were to create .mnu files from text files, it would be handy to be able to share common code and have some way of making parts conditional based on flags passed in when assembling.

Describe the solution you'd like
Have yaml comments with conditional statements. These would include or exclude based on the conditional.

Describe alternatives you've considered
Use a C-preprocessor.

Additional context
None

Add auto error handling check

Is your feature request related to a problem? Please describe.
Having an auto-error dialog pop up in the middle of your app demo is not good. If you miss wiring up all error terminals, this could be an issue.

Describe the solution you'd like
Add a check to validate.py to check that auto-error-handling is turned on or off.

Describe alternatives you've considered
Could be done in LabVIEW process, but we can check thousands of VIs before LabVIEW launches.

Additional context
None

Version checking should support wildcards

In order to require labview version to be 2020 it requires two comparisons to be used together:
-gt 20 -lt 21

I was assuming that -eq 20 or -eq 20.* might work, but that didn’t do the trick. The output complained that it wasn’t exactly 20.0.0f2 (or similar).

Is there a trick to requiring a major version and ignoring minor, fix, and patch?

Add password check

Is your feature request related to a problem? Please describe.
Shipping VIs that should have been password protected is an IP security issue. Having a quick check to ensure IP is protected would be valuable.

Describe the solution you'd like
Change validate.py to be able to validate VIs have a password, don't have a password, or have a specific password (maybe).

Describe alternatives you've considered
Passwords can be added VI LabVIEW process run, but we can check thousands of VIs for passwords before LabVIEW even launches.

Additional context
None

Pass a configuration file to vi_validate

Is your feature request related to a problem? Please describe.
Specifying all the validation arguments on the command line is tedious.

Describe the solution you'd like
Have yaml (less finicky for human edits) file that describes sets of files. Each set will can specify arguments like --path, --skip, and all other arguments other than the config file.

Describe alternatives you've considered
Specify a config file name. As it searches in --path if it finds files with that name it will use the settings from that file for that level in the hierarchy and down (overriding all command line arguments except path and skip).

Additional context
None

lv_assemble should build a valid resource file

Is your feature request related to a problem? Please describe.
You can disassemble a LabVIEW resource file but you cannot reassemble it.

Describe the solution you'd like
Update pylavi.file to be able to save. It does not have to be an exact replica, but should contain all resources with names and id's. All resources should be exact replicas. The resource should be usable by LabVIEW.

Describe alternatives you've considered
Store all the ordering and padding so if minimal changes are made the exact file can be rebuilt.

Additional context
None.

Validate suspend when called

Is your feature request related to a problem? Please describe.
The suspend when called flags is hidden and annoying in production.

Describe the solution you'd like
Add a check to vi_validate that will check the suspend when called flag.

Describe alternatives you've considered
None

Additional context
None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.