[Twisted-Python] distutils and twisted
Hi, What's the prefered way to use distutils to package a twisted plugin. The key question being, how do you install the plugins.tml file ? Is there any distutils extensions available ? -- Alexandre
Alexandre Fayolle wrote:
What's the prefered way to use distutils to package a twisted plugin. The key question being, how do you install the plugins.tml file ? Is there any distutils extensions available ?
At last, a question I can answer! (I'm a Twisted application developer, not a Twisted guru ... :^) Put your plugins.tml into the top dir of your application, e.g.: myapp/__init__.py /plugins.tml <--- /myapptap.py /myappmodule1/... /myappmodule2/... ... and make sure that myapp is in your PYTHONPATH. Then if your plugins.tml looks something like this: ------------------------------------------------- register("Myapp Tap Builder", "myapp.myapptap", description="""My Application""", type="tap", tapname="myapp") ------------------------------------------------- ... then mktap will create a myapp.tap file in the dir where you run it. For your setup.py, something like this should work (note data_files ... :^): ------------------------------------------------- from distutils.core import setup setup (name = "My Application", version = "0.0", description = "Blah blah", author = "Moi", author_email = "moi@world", maintainer = "admin", maintainer_email = 'admin@here', url = "http://spam.world/eggs", licence = "MIT", long_description = """\ My application does NOT suck!""", packages = ['myapp', 'myapp.myappmodule1', 'myapp.myappmodule2' ], data_files = [('lib/python2.2/site-packages/myapp', ['myapp/plugins.tml']) ] ) ------------------------------------------------- HTH, -- Steve.
On Wed, 06 Nov 2002 10:21:47 -0500 Steve Waterbury <waterbug@beeblebrox.gsfc.nasa.gov> wrote:
data_files = [('lib/python2.2/site-packages/myapp', ['myapp/plugins.tml']) ]
Twisted's setup.py uses a different, more cross-platform/python-version hack to make sure plugins.tml is installed, with the unfortunate side-effect that you can't install normal data files. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python, Twisted, Zope and Java consulting ***> http://VoteNoWar.org -- vote/donate/volunteer <***
On Wed, Nov 06, 2002 at 10:39:42AM -0500, Itamar Shtull-Trauring wrote:
On Wed, 06 Nov 2002 10:21:47 -0500 Steve Waterbury <waterbug@beeblebrox.gsfc.nasa.gov> wrote:
data_files = [('lib/python2.2/site-packages/myapp', ['myapp/plugins.tml']) ]
Twisted's setup.py uses a different, more cross-platform/python-version hack to make sure plugins.tml is installed, with the unfortunate side-effect that you can't install normal data files.
This is indeed unfortunate, since I need to install datafiles too... -- Alexandre
Alexandre Fayolle wrote:
On Wed, Nov 06, 2002 at 10:39:42AM -0500, Itamar Shtull-Trauring wrote:
On Wed, 06 Nov 2002 10:21:47 -0500 Steve Waterbury <waterbug@beeblebrox.gsfc.nasa.gov> wrote:
data_files = [('lib/python2.2/site-packages/myapp', ['myapp/plugins.tml']) ]
Twisted's setup.py uses a different, more cross-platform/python-version hack to make sure plugins.tml is installed, with the unfortunate side-effect that you can't install normal data files.
This is indeed unfortunate, since I need to install datafiles too...
... but you don't need to install your Twisted app at the same time as Twisted ... in fact, we prefer not to. Time to learn distutils. ;^) -- Steve.
On Wed, Nov 06, 2002 at 12:08:22PM -0500, Steve Waterbury wrote:
Alexandre Fayolle wrote:
This is indeed unfortunate, since I need to install datafiles too...
... but you don't need to install your Twisted app at the same time as Twisted ... in fact, we prefer not to. Time to learn distutils. ;^)
I was thinking of cutnpasting the trick you were using to my setup.py, not installing everything at the same time. IMNSHO, having a module twisted.python.distutils with a custom setup aware of tml files would be a nice thing to have for module developers (and I'm a bit surprised that no such beast exists). I'll hack something, and submit it to the mailing list if I'm happy enough with it. -- Alexandre
On Wed, 2002-11-06 at 10:22, Alexandre Fayolle wrote:
IMNSHO, having a module twisted.python.distutils with a custom setup aware of tml files would be a nice thing to have for module developers (and I'm a bit surprised that no such beast exists). I'll hack something, and submit it to the mailing list if I'm happy enough with it.
Hooray! You have reached the same conclusion as I did [http://twistedmatrix.com/pipermail/twisted-python/2002-October/001814.html a month ago], only you are willing to go where I did not and write code. I look forward to seeing what you come up with. Thanks, - Kevin -- The moon is waxing crescent, 11.4% illuminated, 3.2 days old.
On Wed, Nov 06, 2002 at 07:22:21PM +0100, Alexandre Fayolle wrote:
IMNSHO, having a module twisted.python.distutils with a custom setup aware of tml files would be a nice thing to have for module developers (and I'm a bit surprised that no such beast exists). I'll hack something, and submit it to the mailing list if I'm happy enough with it.
Well, here's an attempt. The documentation is in the module docstring. Feel free to add it to the twisted distribution if you think it's ok. If you need more features, please ask. If you find bugs, please tell me. -- Alexandre
En réponse à Steve Waterbury <waterbug@beeblebrox.gsfc.nasa.gov>:
For your setup.py, something like this should work (note data_files ... :^):
Nope. It won't work with different versions of python, but this can easily be worked around. What's more a problem is that it won't work on non-unix platforms, and it won't work with the --home option passed to the install command of setup.py, which is what I use to test packages locally (using python setup.py install --home=$HOME will install packages in $HOME/lib/python). I'm using a similar hack right now for testing, and I'll put up a distutils extension once I get a few other issues with my plugin sorted out. Alexandre Fayolle -- http://alexandre.fayolle.free.fr http://www.logilab.org Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France).
participants (4)
-
Alexandre Fayolle -
Itamar Shtull-Trauring -
Kevin Turner -
Steve Waterbury