How to trigger post-build using setuptools/distutils
Asked Answered
M

3

6

I am building an application using py2app/setuptools, so once it creates application bundle I want to take some action on dist folder e.g. create a installer/upload it.

Is there a way? I have found some post-install solution but no post-build

Alternatively I can call 'python setup.py py2app' from my own script and do that, but it would be better if it can be done in setup.py

Macropterous answered 14/9, 2009 at 13:57 Comment(0)
S
4

I responded to a similar question yesterday about subclassing distutils.core.Command.

The core of it is that by doing this you are able to precisely control the behavior of each stage of the preparation process, and are able to create your own commands that can do pretty much anything you can think of.

Please have a look at that response as I think it will help you out.

Stonewall answered 12/11, 2009 at 3:59 Comment(0)
A
0

There are probably ways to do this using setuptools or distutils, but they're likely to be pretty hackish. I'd strongly recommend using one of the following tools if you want to do something like this:

Paver is probably the easiest to move to as you will probably be able to use all of your existing setup.py file.

Assumpsit answered 14/9, 2009 at 14:2 Comment(0)
H
0

Can you please clarify what you're trying to do?

take some action on dist folder e.g. create a installer/upload it.

When you say create a installer, do you mean build a distribution for the package? And when you say upload, do you mean upload to pypi? or somewhere else?

I have found some post-install solution but no post-build

Are these py2app hooks/callbacks?

python setup.py py2app

This is not the convention for how distutils is used. It's usually python setup.py install.

Answer:

py2app target is a dist folder, which I want to package using my installation script and upload to my website

Edit:

So, you created a package that uses distutils with setup.py.

When you run setup.py it creates distributions for this file and places then them in /dist folder.

Now you want to upload the built file to your website.

To do this, you need a different tool. Something like fabric.

You can use fabric to create a script that would execute the build command and then upload the built files to your server.

Helvetia answered 24/9, 2009 at 15:59 Comment(1)
py2app target is a dist folder, which I want to package using my installation script and upload to my websiteMacropterous

© 2022 - 2024 — McMap. All rights reserved.