Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/pkg-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,18 @@ def compute_default_path
paths << pkgconfig_path.to_s if pkgconfig_path.exist?
end
end
conda_prefixes = []
conda_prefixes << ENV["CONDA_PREFIX"] if ENV["CONDA_PREFIX"]
if ENV["CONDA_EXE"]
conda_base = File.dirname(File.dirname(ENV["CONDA_EXE"]))
conda_prefixes << conda_base
end
conda_prefixes.uniq.each do |prefix|
lib_pkgconfig = File.join(prefix, "lib", "pkgconfig")
share_pkgconfig = File.join(prefix, "share", "pkgconfig")
paths << lib_pkgconfig if File.directory?(lib_pkgconfig)
paths << share_pkgconfig if File.directory?(share_pkgconfig)
end
Comment on lines +366 to +377

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we do it here

conda_prefix = ENV["CONDA_PREFIX"]
if conda_prefix
default_paths << File.join(conda_prefix, "lib", "pkgconfig")
default_paths << File.join(conda_prefix, "share", "pkgconfig")
end
?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Oh, yep. Let me test that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hrm. I think my approach here is wrong. I previously thought default_paths was nil but it's not,

(ruby:remote) native_pkg_config
#<Pathname:/opt/homebrew/bin/pkgconf>
(ruby:remote) default_paths
["/opt/homebrew/lib/pkgconfig",
 "/opt/homebrew/share/pkgconfig",
 "/usr/local/lib/pkgconfig",
 "/usr/lib/pkgconfig",
 "/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/26"]

I thought this PR was fixing my issue but, now that I test again, it's not.

Maybe this PR can be closed.

paths.concat(default_paths)
[
with_config("pkg-config-path") || ENV["PKG_CONFIG_PATH"],
Expand Down