building arbitrary files with distutils?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wilbert Berendsen

    building arbitrary files with distutils?

    Hi all,

    I want to convert a python project from Makefiles to distutils. Currently the
    makefiles perform some tasks like building a PNG icon from a SVN file etc.

    How can I add such commands (including timestamp checking) to a setup.py file,
    so that it runs when I call 'python setup.py build' ? I can write python
    functions to perform those command, and I found timestamp checking functions
    in distutils.dep_u til, but just can't find the way to connect such commands
    to the build step....

    w best regards,
    Wilbert Berendsen

    --

    "You must be the change you wish to see in the world."
    -- Mahatma Gandi
  • =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

    #2
    Re: building arbitrary files with distutils?

    How can I add such commands (including timestamp checking) to a setup.py file,
    so that it runs when I call 'python setup.py build' ? I can write python
    functions to perform those command, and I found timestamp checking functions
    in distutils.dep_u til, but just can't find the way to connect such commands
    to the build step....
    Take a look at the build_ext command. It considers all Extension objects
    (in build_extension s), and for each one, it does dependency checking
    (in build_extension ). It uses the newer_group machinery.

    More generally, in the run method of your command, just don't do
    anything (except perhaps logging) if you find your outputs are
    up-to-date.

    Multi-level dependencies aren't quite supported with that approach;
    you can either make multiple commands that one has to run in sequence
    (or use subcommands), or you put it all in a single run method which
    sequentially first tries to generate the intermediate outputs
    (doing nothing if they are up-to-date), and then the final outputs
    (doing nothing when they are newer than the intermediate ones).

    HTH,
    Martin

    Comment

    Working...