-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I've finished the initial work on tap2ntsvc. This script does the tedious work of creating an installer around your Twisted service. A quick howto:
1. Create a tap or tac file for your application, using the method you normally use. **Test with twistd to make sure that you can start the app from the command line, _before_ you wrap a service around it.**
2. Acquire and install the prerequisites of tap2ntsvc. It depends on software outside of Twisted, specifically: win32all @ http://starship.python.net/crew/mhammond/win32/Downloads.html Innoconda @ http://twistedmatrix.com/~moonfallen/innoconda.html
3. Run tap2ntsvc from the command line. (*This is not yet integrated with the "Twisted Command Prompt" available on MSWindows with the official Twisted installer, but it will be when the script becomes an official part of Twisted.) Use --help to get the command line options. To start with, all you need to provide is the name of your tap or tac file. | python .../Twisted/sandbox/moonfallen/tap2ntsvc myapp.tac This will build an installable package using Innoconda.
4. Install the package. It will be in myappsvc/myapp-...-setup.exe.
5. Start the service; it will fail, but you'll find out what modules you need to add. | net start myapp **It's ok if this doesn't work.**
6. Check the Application event log to find out what modules failed to import; you will be re-running py2exe after you add the missing modules.
7. Either: (a) re-run tap2ntsvc with the -i option or (b) add your modules to myappsvc/setup.cfg on the "includes=" line. If you choose to do the latter, read myappsvc/README.txt to find out how to recompile just the parts you need.
8. Redo steps 3 through 7 until you no longer get ImportErrors in the Application log.
9. Some applications need data files. If you need data files in your application, consult myappsvc/README.txt and edit myappsvc/myapp.fms. myapp.fms uses a special command language to make adding data files as intuitive as possible. You can put files in c:\Program Files\myapp or any subdirectory thereof, so make sure your application code can find data files there.
When you're done, you should be able to 'net start myapp' successfully. ~ When you want to rebuild it in the future, just keep these files in your version control: ~ myappsvc/do_inno_script.py ~ do_inno.py ~ setup.cfg ~ setup.py ~ myapp.fms
Caveats, bugs, TODO: - - you must be able to start your application in py2exe. Things most likely to not work are finding important data files based on the value of __file__ in some module. - - if you install the same service multiple times without uninstalling it in between installs, then start it, then uninstall it, it will crash on uninstall. Just be sure to uninstall it in between installs while you're experimenting. - - I want to make the module finder more foolproof, saving several of the steps above. This is a non-trivial problem, however. - - Really, it needs a frontend. And I hate Tk. Can I put a Gtk app into ~ Twisted proper? :-)
The future: I want to move tap2ntsvc out of sandbox and into main Twisted. I want people to read this email over and try it before I do so, in case there are important concerns I need to address. We need to give some thought to what to do about the 2 significant dependencies. Should this block tap2ntsvc from being in Twisted proper? Is there a policy for this sort of thing?