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

refactor: Use proper module strucutre #155

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

maringuu
Copy link
Collaborator

@maringuu maringuu commented Sep 12, 2024

Follow up for FACT: fkie-cad/FACT_core#1268

Unrelated follow up issues:

  • The code does not complain when it cannot load the config file
  • The code does not complain when the docker image exits with an error

@maringuu maringuu marked this pull request as ready for review September 12, 2024 13:04
@maringuu maringuu force-pushed the module-structure branch 4 times, most recently from 197d629 to 535b0f4 Compare September 19, 2024 08:32
maringuu added a commit to maringuu/FACT_core that referenced this pull request Sep 19, 2024
This is required as of [fkie-cad#155](fkie-cad/fact_extractor#155).

This technically breaks installations of FACT that have the old image on the
system.
This problem is not solvable at the moment as we do not have versioning for
the extractor container.
Let's follow what we did, when we introduced the extraction service: Nothing.
This allows us to properly import the extractor via
`import fact_extract` rather than importing all submodules
individually.
Also this is most definitely more correct.
Not telling the user which modules failed is arguably worse
than just erroring out with the ImportError
As the python interpreter only adds the parent directory of the
executed script as module search path and we depend on `fact_extractor`
the file must be placed next to the `fact_extractor` module.
Despite us using ADD, the gitignore does not seem to be honored
Previously we had three different startup scripts:
- The docker entrypoint (fact_extractor/docker_extract.py)
- The python module entrypoint (fact_extractor/fact_extract.py)
- The docker wrapper (extract.py)
This commit removes the docker entrypoint and moves the module entrypoint
to __main__.py while changing as little code as possible.
@maringuu maringuu changed the title WIP: refactor: Use proper module strucutre refactor: Use proper module strucutre Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant