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

Config property repo_path evaluated inconsistently #8

Open
claui opened this issue Oct 12, 2024 · 3 comments
Open

Config property repo_path evaluated inconsistently #8

claui opened this issue Oct 12, 2024 · 3 comments

Comments

@claui
Copy link
Contributor

claui commented Oct 12, 2024

When I try to run the hello_gtk example on its own, I get:

# From Hancho’s root directory
$ python hancho.py -f hello_gtk.hancho -C examples/hello_gtk
Loading module /build/hancho/src/hancho-0.2.0/examples/hello_gtk/hello_gtk.hancho
Loading module /build/hancho/src/hancho-0.2.0/examples/hello_gtk/rules.hancho
Traceback (most recent call last):
  File "/build/hancho/src/hancho-0.2.0/hancho.py", line 1530, in <module>
    sys.exit(app.main())
             ^^^^^^^^^^
  File "/build/hancho/src/hancho-0.2.0/hancho.py", line 1238, in main
    self.load_hanchos()
  File "/build/hancho/src/hancho-0.2.0/hancho.py", line 1318, in load_hanchos
    self.load_module(
  File "/build/hancho/src/hancho-0.2.0/hancho.py", line 1470, in load_module
    types.FunctionType(code, module.__dict__)()
  File "hello_gtk.hancho", line 3, in <module>
  File "/build/hancho/src/hancho-0.2.0/hancho.py", line 395, in load
    return load_file(file_name, as_repo=False, args=args, kwargs=kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/hancho/src/hancho-0.2.0/hancho.py", line 392, in load_file
    return app.load_module(repo_path, repo_name, file_path, file_name, mod_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/hancho/src/hancho-0.2.0/hancho.py", line 1439, in load_module
    with open(file_pathname, encoding="utf-8") as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/build/hancho/src/hancho-0.2.0/examples/hello_gtk/rules.hancho'

The hello_gtk example clearly tries to get rules.hancho from the project root, but repo_path seems to be ./examples/hello_gtk, so the load command fails.

Surprisingly, the debug output actually says that repo_path is the project root:

$ python hancho.py -f hello_gtk.hancho -C examples/hello_gtk -d
[…]
global_config = {
  […]
  repo_path = "/build/hancho/src/hancho-0.2.0",
  repo_name = "",
  base_path = "/build/hancho/src/hancho-0.2.0",
  […]
  root_target = "",
  root_name = "hello_gtk.hancho",
  root_path = "/build/hancho/src/hancho-0.2.0/examples/hello_gtk",
}
[…]
FileNotFoundError: [Errno 2] No such file or directory: '/build/hancho/src/hancho-0.2.0/examples/hello_gtk/rules.hancho'
  1. Shouldn’t the debug output be consistent to the value to which Hancho actually evaluates the property?

  2. What would be a correct command line to run the hello_gtk example directly?
    I’ve tried several combinations but none worked.

@claui
Copy link
Contributor Author

claui commented Oct 12, 2024

Hancho even allows me to control repo_path by passing --repo_path=…, which clearly affects the global config (according to the debug output). But Hancho still resolves {repo_path}/rules.hancho to examples/hello_gtk/rules.hancho.

@aappleby
Copy link
Owner

You caught me in the middle of merging v0.2 into main and adding some tweaks from other forks I'd made. I'm going through the examples and stuff now trying to fix everything, just give me a day or so. :D

@claui
Copy link
Contributor Author

claui commented Oct 12, 2024

Thanks @aappleby for clarifying!

I had noticed the v0.2.0 release so I assumed it was meant to be stable.

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

No branches or pull requests

2 participants