3

Can anyone give me an example of how to use python's msilib standard library module to create a msi file from a custom python module?

For example, let's say I have a custom module called cool.py with the following code

class Cool(object):
    def print_cool(self):
        print "cool"

and I want to create an msi file using msilib that will install cool.py in python's site-packages directory.

How can I do that?

2 Answers 2

5

You need to write a distutils setup script for your module, then you can do

python setup.py bdist_msi

and an msi-installer will be created for your module.

See also http://docs.python.org/distutils/apiref.html#module-distutils.command.bdist_msi

0

I think there is a misunderstanding: think of MS CAB Files as archives like .zip-Files. Now it is possible to put anything in such an archive, like your cool.py. But i think you mentioned that python source, since you want it executed, otherwise just use an archiver like zip, no need to use mslib.

If i am right then you first need to convert your script into an executable using something like py2exe or pyinstaller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.