Skip to content

Conversation

@henderkes
Copy link
Collaborator

What does this PR do?

  • splits getPath() into its own method
  • make use of the ::isInstalled() method instead of manually checking paths

/**
* Get the PATH required to use this package.
*/
abstract public static function getPath(): ?string;
Copy link
Owner

@crazywhalecc crazywhalecc Sep 9, 2025

Choose a reason for hiding this comment

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

I think here can return a default value PKG_ROOT_PATH . '/bin', rather than making an abstract function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PKG_ROOT_PATH . '/bin' doesn't exist. PKG_ROOT_PATH . '/$name/bin' is not guaranteed to exist. Both go and zig use non-standard locations for the binaries.

Copy link
Owner

Choose a reason for hiding this comment

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

If we only look at these two special packages, we don't seem to need to add this abstract method - these two getPath calls are both certain classes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, but I would expect more packages to need to add a path to the PATH. We already have the abstract getEnvironment method because of the same assumption, so I believe it should be made here too. In case we don't need one, the method can return null, but it's a hint to us to think about whether the package needs a path, so I make it abstract.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@crazywhalecc if this is a blocker for you, I'm okay to change it to a function that returns null by default. We should look into merging this PR, though, because at the moment spc craft doesn't work until this is merged.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah I just on business trip and have almost no time to deal with other things. Will check it soon.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm open to changes in this PR, but I might also remove or modify it in 3.0. I don't think it's a big deal since we haven't finalized vendor mode yet.

@henderkes henderkes added the bug Something isn't working label Sep 16, 2025
/**
* Get the PATH required to use this package.
*/
abstract public static function getPath(): ?string;
Copy link
Owner

Choose a reason for hiding this comment

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

I'm open to changes in this PR, but I might also remove or modify it in 3.0. I don't think it's a big deal since we haven't finalized vendor mode yet.

@henderkes henderkes merged commit 79ab649 into main Sep 18, 2025
10 checks passed
@henderkes henderkes deleted the fix-zig branch September 18, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants