Closed ginty closed 4 years ago
@ginty Did you settle on a default templates dir?
@ginty The file handler does not return a file variable.
elif command == "compile":
for file in _origen.file_handler():
breakpoint()
pathlib.Path(file)
# Invoke compiler here
pass
The breakpoint does not get triggered when I run this command:
origen c ../python/templates/dut_info.txt.mako
It does work, did you compile Rust after checking out?
@ginty Did you settle on a default templates dir?
I think it should be <app>/templates
, so example/example/templates
in this case.
It does work, did you compile Rust after checking out?
Yes I built both the origen and pyapi using cargo
BTW I merged this branch with my stub-out compiler branch and then did the compile. Can you see if it works for you using the 'compiler_v1' branch?
Just tried it and it works fine, maybe the CLI has not been re-compiled?
I think the README could be made clearer on this, but these are the steps to compile Rust:
To compile the Python lib:
cd rust/pyapi
cargo build
To compile the CLI (not needed often, but it is here):
cd rust/origen
cargo build --workspace --bins
If it still doesn't work, then is it something to do with the breakpoint() method?
I've never used that so not sure what it should do, but I'm just testing it with print(file)
and I can see the file args as I would expect.
Just tried it and it works fine, maybe the CLI has not been re-compiled? I think the README could be made clearer on this, but these are the steps to compile Rust: To compile the Python lib: cd rust/pyapi cargo build
To compile the CLI (not needed often, but it is here): cd rust/origen cargo build --workspace --bins
If it still doesn't work, then is it something to do with the breakpoint() method? I've never used that so not sure what it should do, but I'm just testing it with print(file) and I can see the file args as I would expect.
Re-did the compilation and no luck. Using print(file)
did not work either. Will try using your branch.
@ginty I checked out the compile_cmd
branch and ran the c
command with this debug code:
elif command == "compile":
print("found compiler hook-up")
for file in _origen.file_handler():
print(file)
# Invoke compiler here
pass
The command outputs the following to the terminal:
found compiler hook-up
Can you try the same thing?
I just tried it a few mins ago, it definitely works. I still think you are not running the updated CLI, check which 'origen' you are pointing to and verify the date/time on it.
I just tried it a few mins ago, it definitely works. I still think you are not running the updated CLI, check which 'origen' you are pointing to and verify the data/time on it.
yep I am an idiot
Cool, glad you got it resolved. I think it does show that we need to have the CLI passing in a version number to Python and then the Python side can verify against some minimum CLI version.
$ origen c ../python/templates/dut_info.txt.mako
Origen: INFO (00:00:00.206): Compiling mako template /mnt/c/o2/compiler/python/templates/dut_info.txt.mako
Origen: INFO (00:00:00.210): Compiler output created at /mnt/c/o2/compiler/python/templates/dut_info.txt
$ ls -alrt /mnt/c/o2/compiler/python/templates/dut_info.txt
-rwxrwxrwx 1 me me
33 Feb 6 10:18 /mnt/c/o2/compiler/python/templates/dut_info.txt
Adds initial handling of the CLI command FILE argument.
@info-rchitect, here's the point for you to hook in the template compiler - https://github.com/Origen-SDK/o2/blob/compile_cmd/python/origen/boot.py#L114
Eventually the Rust side of this will be enhanced to expand directory and list file references, and maybe even handle some basic ifdef-style logic within list files. Nothing is expected to change on the Python side.
Invoke from the CLI as you would expect:
origen c path/to/template.txt