views:

314

answers:

3

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

A: 

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.

Jason Baker
A: 

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.

tarasm
py2app target is a dist folder, which I want to package using my installation script and upload to my website
Anurag Uniyal
I updated my answer.
tarasm
+1  A: 

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.

jathanism