Martin Ueding
Martin Ueding

Reputation: 8699

Combining makefile and setup.py

I usually write a makefile with an install target so that one can build and install with make && make install. This works for Shell and C projects. However, when I use Python, I usually write a setup.py to install the modules correctly.

In the makefile, I would like to call ./setup.py install, I am not sure how to get all the parameters form the makefile, like DESTDIR right. Debian uses some special magic, when I package something with only a setup.py in it. Having a makefile present uses makefile magic.

Or is it possible to call rst2man and gzip and install those files into $(DESTDIR)/usr/share/man from setup.py? Then I could put everything into the setup.py.

How do I combine the two?

Upvotes: 2

Views: 3096

Answers (1)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136208

By default, setup.py installs modules into sys.prefix (you can have different Pythons with different sys.prefix).

You can override that with --prefix argument to setup.py.

E.g.:

build :
    cd module && CPPFLAGS=${CPPFLAGS} python setup.py build --prefix=${PREFIX}

install :
    cd module && CPPFLAGS=${CPPFLAGS} python setup.py install --prefix=${PREFIX}

See How installation works for more details.

Upvotes: 1

Related Questions