Open jkppr opened 2 years ago
I have the same issue. Any idea how to solve this issue?
@studiawan you can try one of the following workarounds that worked for me to get l2tscaffolder running:
~/.local/lib/python3.9/site-packages/l2tscaffolder/.style.ts.yapf
Hi @jkppr, I have successfully installed l2tscaffolder from source. However, we do not need to add the missing .yapf file as it has been already provided in the repository.
Thanks!
@Onager can you PTAL, I assume the file is missing from MANIFEST.in
Describe the bug
When running
l2t_scaffolder.py
to create the setup for a new timesketch analyzer the tool crashes because it cannot find the.style.ts.yap
style file. It looks like installing l2tscaffolder viapip3 install l2tscaffolder
does not place the.style.ts.yap
file in the expected place~/.local/lib/python3.9/site-packages/l2tscaffolder/.style.ts.yapf
. After copying the file there manually from github, it works without issues.To Reproduce
Steps to reproduce the behavior:
pip3 install l2tscaffolder
l2t_scaffolder.py
[1] timesketch
, provide.
as path, select[1] sketch_analyzer
Available definitions: [0] plaso [1] timesketch [2] turbinia Definition choice: 1 timesketch chosen.
Path to the project root: . Path [.] set as the project path.
Name of the module to be generated. This can be something like "foobar sqlite" or "event analytics".
This will be used for class name generation and file name prefixes. Module Name: screenshot_test About to create a new feature branch to store newly generated code. Switching to feature branch screenshot_test
Available scaffolders for timesketch: [0] index_analyzer [1] sketch_analyzer Scaffolder choice: 1 Ready to generate files? [Y/n]: Traceback (most recent call last): File "~/.local/bin/l2t_scaffolder.py", line 26, in
StartCLI() # pylint: disable=no-value-for-parameter
File "~/.local/lib/python3.9/site-packages/click/core.py", line 1130, in call
return self.main(args, kwargs)
File "~/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "~/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, ctx.params)
File "~/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(args, **kwargs)
File "~/.local/bin/l2t_scaffolder.py", line 22, in StartCLI
cli.Start(definition)
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/frontend/frontend.py", line 375, in Start
for file_path in scaffolder_engine.GenerateFiles():
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/lib/engine.py", line 74, in GenerateFiles
for file_path, content in self._scaffolder.GenerateFiles():
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/scaffolders/timesketch.py", line 103, in GenerateFiles
plugin_content = self._GeneratePlugin()
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/scaffolders/timesketch.py", line 54, in _GeneratePlugin
return self._mapping_helper.RenderTemplate(
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/lib/mapping_helper.py", line 124, in RenderTemplate
formatted = self.formatter.Format(template)[0]
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/lib/code_formatter.py", line 28, in Format
return yapf_api.FormatCode(code, style_config=self.yapf_path)
File "~/.local/lib/python3.9/site-packages/yapf/yapflib/yapf_api.py", line 124, in FormatCode
style.SetGlobalStyle(style.CreateStyleFromConfig(style_config))
File "~/.local/lib/python3.9/site-packages/yapf/yapflib/style.py", line 498, in CreateStyleFromConfig
config = _CreateConfigParserFromConfigFile(style_config)
File "~/.local/lib/python3.9/site-packages/yapf/yapflib/style.py", line 527, in _CreateConfigParserFromConfigFile
raise StyleConfigError(
yapf.yapflib.style.StyleConfigError: "~/.local/lib/python3.9/site-packages/l2tscaffolder/.style.ts.yapf" is not a valid style or file path
[...] Ready to generate files? [Y/n]: File: ./timesketch/lib/analyzers/screenshot_test_2.py written to disk. File: ./timesketch/lib/analyzers/screenshot_test_2_test.py written to disk. File: ./timesketch/lib/analyzers/init.py written to disk.
$ pip3 list | grep l2tscaffolder l2tscaffolder 20200511