Re: [PATCH] perf tools: Add support to install perf python extension

Jiri Olsa
2011-07-21T19:42:15Z

On Thu, Jul 21, 2011 at 04:04:07PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jul 21, 2011 at 08:47:15PM +0200, Jiri Olsa escreveu:
> > On Thu, Jul 21, 2011 at 02:11:48PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Thu, Jul 21, 2011 at 06:45:26PM +0200, Jiri Olsa escreveu:
> > > > Changing the distutils to use their own default 'build'
> > > > directory.
> > > >
> > > > Such setup makes the install command simple, because using
> > > > --build-lib and --build-temp does not seem to comply with
> > > > the way the distutils' install commands expect it.
> > > >
> > > > Also keeping the python/perf.so file, so it could be used
> > > > for testing as of until now.
> > >
> > > Yeah, I gave up when I couldn't get:
> > >
> > > $ make O=/tmp/build-dir-for-perf/ -C tools/perf/ install
> > >
> > > to work, does it now? Checking...
> >
> > nope, I added install-python_ext since it installs to the
> > python system lib area, and it could break standard install
>
> But where is that it picks the binaries built? The problem I was
> experiencing was that it wasn't obeying O=, just using the source dir

I haven't checked the 'O=' that much.. will do :)

> as the build dir, effectively building it again, in a different place.

I dont have that much experince with python, but here's what I found:
(might be missing something..)

build_ext command
- build_ext will by default create a 'build' directory and
put all the stuff in - temp and final dirs/binary
- you can overload this with build-lib/build-temp options

install command
- install does not have option to specify the build-lib directory
(but it has the --root option that we need)
- so running just install assumes you have used default 'build'
directory and if it does not exist it starts rebuild
- there's another command install_lib, which let's you specify
the build-lib.. BUT it wont let you specify the --root option ;)

There's possibility to use setup.cfg file and generate/put options
for each command, so at the end we could choose what directory to use.

Also there might be a way to overload distutils class and put our
specific options to this new class..

As I checked some of python extension packages, some of them
do not use distutils at all.. can't imagine why ;)

jirka

>
> > I think there's a way to install python modules under $HOME,
> > maybe we could do that if no DESTDIR is specified..
> > I can add it later ;)
>
> Right, but this is not what I was talking about :-)
>
> - Arnaldo