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

Search-paths default differs from pkg-config #10

Open
dmacks opened this issue Jun 3, 2014 · 6 comments
Open

Search-paths default differs from pkg-config #10

dmacks opened this issue Jun 3, 2014 · 6 comments

Comments

@dmacks
Copy link

dmacks commented Jun 3, 2014

The use of "all paths in ${prefix}/lib[64]/pkgconfig/ and ${prefix}/share/pkgconfig/, where ${prefix} is a system prefix (typically this will be /usr/)." as the default search paths is different from pkg-config. As the README notes, pkg-config hardcodes a search-path list at its compile-time, which means the vendor or sysadmin can define any arbitrary list and pkg-config will always use it by default. But pykg-config does not appear to have a way to permanently alter the default. I can use env vars to override it at runtime, but that means all my users have to be doing it (and risking breaking it by strict env-cleanup via sudo, or other site policies). It would be useful if setup.py took a --with-pc-path flag (like pkg-config's ./configure) to force hardcoding a specific default.

@gbiggs gbiggs closed this as completed in a4a6117 Jun 8, 2014
@dmacks
Copy link
Author

dmacks commented Jun 10, 2014

Maybe I didn't explain the algorithm clearly. --with-pc-flag sets the default, not the mandatory only. PKG_CONFIG_LIBDIR still replaces it at runtime and PKG_CONFIG_PATH still prepends to take precedence. That's because pkg-config itself doesnt' do "Else append prefix/lib/pkgconfig, prefix/share/pkgconfig". So This setting would just replace that narrow piece of the logic rather than mandating exclusively this search list.

@gbiggs gbiggs reopened this Jun 11, 2014
@gbiggs gbiggs closed this as completed in bf0ac01 Jun 11, 2014
@gbiggs
Copy link
Owner

gbiggs commented Jun 11, 2014

Sorry for the misunderstanding. I've fixed the ordering and checked that it matches what pkg-config does.

@dmacks
Copy link
Author

dmacks commented Dec 25, 2014

Looks fine now. README.txt needs to be updated to match (the "Package paths" section still describes the transiently-implemented way).

@dmacks
Copy link
Author

dmacks commented Dec 25, 2014

Actually no, it doesn't work. 'setup.py build_py --with-pc-path=[path]' correctly stashes [path] in install_config.py, but 'setup.py install' nukes that setting (installs install_config.py containing "pc_path = None"). Looks like 'setup.py install' doesn't accept --with-pc-path ("error: option --with-pc-path not recognized") and even trying it combined ('setup.py build_py --with-pc-path=[path] install') still gives me "None" (consistent with the 'install' implementation neither allowing --with-pc-path being passed to it nor respecting the setting from the preceding build_py).

@dmacks
Copy link
Author

dmacks commented Dec 25, 2014

(sorry for the stream-of-consciousness/debugging session here!)

I can use --skip-build in the 'setup.py install' to avoid breaking the formerly-correct install_config.py, but then install itself fails because setup.py build_py only builds the pure-python modules, not the pykgconfig script itself (that only happens if I explicitly 'setup.py build_scripts'). 'setup.py build' handles all the build_* internally and is the standard way I've seen setup.py used, but that mode doesn't support --with-pc-paths (only build_py being called explicitly).

@gbiggs gbiggs reopened this Jan 26, 2015
@gbiggs
Copy link
Owner

gbiggs commented Jan 26, 2015

Overwriting the value of with_pc_path with None when executing 'setup.py install' is a consequence of the way distutils works. The 'install' command executes all its dependency commands again. This includes executing 'build_py' (indirectly via executing the 'build' command), which is why the with_pc_path option becomes None.

If I run the following command, then install_config.py correctly includes the value I specified for with_pc_path:

python setup.py build_py --with-pc-path='/opt/X11/lib/pkgconfig:usr/lib/pkgconfig' install

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