Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Making use of the path passed with -p when compiling a Pd file. #8

Closed
wants to merge 0 commits into from

Conversation

giuliomoro
Copy link

Closes #6 #6.
Note that this is still outstanding when using max2hv.

@@ -43,6 +43,7 @@ def compile(clazz, pd_path, hv_dir, search_paths=None, verbose=False, export_arg
tick = time.time()

parser = PdParser() # create parser state
parser.add_search_paths(search_paths)
Copy link
Contributor

@mhroth mhroth Sep 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By adding search paths before the root path can be established (in parser.graph_from_file()) I believe that you'll run into problems later establishing the root path of the whole patch system. The user-paths will take precedence over the path of the root patch. You'll end up looking at the paths in the wrong order.

The reasons that the --p feature was not implemented is because we never needed it. Use Pd's [declare -path] object instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hate to disagree here with you @mhroth but I actually think you'd want the opposite of what you're suggesting.

Currently the user's local directory and other declared paths are searched first.

See here: https://github.com/enzienaudio/hvcc/blob/master/interpreters/pd2hv/PdParser.py#L315

and here: https://github.com/enzienaudio/hvcc/blob/master/interpreters/pd2hv/PdParser.py#L122

Otherwise you wouldn't ever be able to override internal functionality. For example to replace the [osc~] implementation with a custom version.

I think precedence should be local directory > defined search paths > pdlib > hvlib > other internals.

Though it may be true that -p doesn't work, and [declare -path] is indeed a solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that you'll run into problems later establishing the root path of the whole patch system. The user-paths will take precedence over the path of the root patch. You'll end up looking at the paths in the wrong order.

Also I don't think this is true as the local directory is always searched first: https://github.com/enzienaudio/hvcc/blob/master/interpreters/pd2hv/PdParser.py#L131

Copy link
Contributor

@diplojocus diplojocus Sep 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it is true that appending to __search_paths before calling __graph_from_file will lead to funky behaviour, all your [declare -path] defines will be wrong!

If you want to implement this correctly I think it would be better to create a new member called something like __cmdline_search_paths and append to it any paths passed with -p.

Then in the find_abstraction_path function search the local dir, then patch declared paths (__search_paths) and then the cmd line paths. https://github.com/enzienaudio/hvcc/blob/master/interpreters/pd2hv/PdParser.py#L139

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-p path not working
3 participants