Python site-packages tricks (was: Re: rpms/scons/devel scons.spec,1.3,1.4)
Dag Wieers
dag at wieers.com
Thu Jan 27 19:10:28 UTC 2005
On Thu, 27 Jan 2005, Ville Skyttä wrote:
> On Wed, 2005-01-26 at 19:44 +0100, Dag Wieers wrote:
> > On Wed, 26 Jan 2005, Ville Skyttä wrote:
>
> > > Anyway the idea is to find out the dirs where Python's distutils will
> > > install stuff into by asking Python and using those in %files instead of
> > > inventing/hardcoding the dirs oneself.
> >
> > We're using the following macros for that:
> >
> > %define python_sitearch %(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()')
> > %define python_sitelib %(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1)')
> >
> > Is this what you are using too ?
>
> Almost. Your version above has the argument to get_python_lib reversed;
> with no arguments it returns the arch-independent path ("sitelib"), and
> with 1 the arch-dependent path ("sitearch"). Additionally, your version
> uses "python" instead of "%{__python}" which takes away a bit of the
> flexibility.
>
> Here's what's in fedora-rpmdevtools' spectemplate-python.spec:
>
> %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
> %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Yes, I was using %{python_dir} for both, but using different names like
perl makes much more sense.
-- dag wieers, dag at wieers.com, http://dag.wieers.com/ --
[all I want is a warm bed and a kind word and unlimited power]
More information about the fedora-extras-commits
mailing list