[CentOS] Python search path

Alice Wonder alice at domblogger.net
Sat Mar 4 17:55:41 UTC 2017


I want to create RPM spec file that lets the user build the RPM with an 
alternate prefix - e.g.

rpmbuild -D '_prefix /opt/whatever' -bb package.spec

That results in in the python files being placed in

/opt/whatever/lib/pythonN/site-packages and
/opt/whatever/%{_lib}/pythonN/site-packages

Those directories are outside of the default python search path.

I could leave it up to the user to add them, but its nice when 
installing a package just works (hence why we can put files in 
/etc/ld.so.conf.d for example) without the user needing to fuss too much.

When the user builds with a different prefix, there likely will be 
several different packages that put python stuff in that prefix, so a 
meta package they require that adds to the search path is what I am 
thinking, that both adds to the python when installed and removes it 
from the python search path when removed.

On 03/04/2017 09:31 AM, Andrew Holway wrote:
> So you want to build something independent of the system python? Is
> virtualenv and / or anaconda interesting here?
>
> On 4 March 2017 at 17:36, Alice Wonder <alice at domblogger.net> wrote:
>
>> Hello,
>>
>> Working on a project to create clean spec files for libbitcoin for CentOS
>> 7 (and eventually I want them to work in Fedora 25+ too)
>>
>> These spec files must work with the user defines an alternate %{_prefix}
>> before building them.
>>
>> This means that python components would be installed in /opt/libbitcoin
>> (or whatever) instead of in /usr so %{python2_sitelib} and
>> %{python2_sitearch} no longer would apply.
>>
>> sys.path.append looks like the way to tell python about a new path to look
>> for stuff, but I'm guessing there are guidelines somewhere for how that is
>> suppose to properly done from within spec files.
>>
>> Unfortunately I can't find them, and search engines are getting harder and
>> harder to use to find technical related information, always changing my
>> query and showing me completely unrelated results.
>>
>> Anyway I didn't see anything in the Fedora packaging guidelines for
>> python, that seems to be targeting a prefix of /usr
>>
>> Thanks for any links or suggestions.
>> _______________________________________________
>> CentOS mailing list
>> CentOS at centos.org
>> https://lists.centos.org/mailman/listinfo/centos
>>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>




More information about the CentOS mailing list