Using distutils to install somethign into wx.lib

Hi all,

I'm trying to figure out how to write a setup.py to install a new version of wx.lib.floatcanvas

I tried this in the past, and couldn't figure it out, and just wrote my own small install script. However, since then, I figured out how to install a sub-package with distutils, so I thought I'd give it go. the trick is this:

site-packages is the default root of all packages. However, if you set:

package_dir = {"wx.lib": ""}

then it matches the "wx.lib" to "" in your structure, so that you can put your stuff in wx.lib.

However, wx.lib is not in site-packages/wx/lib. It's in something like:

site-packages/wx-2.6-gtk2-unicode/wx/lib

That's fine, I simply queries what file wx had when you did an "import wx", to find the default dir. You could also run wxversion first if you wanted to.

However, then we have a problem. Now your package looks like:

wx-2.6-gtk2-unicode.wx.lib.floatcanvas

which would be fine, except when you pass this into distutils, it creates a directory structure like this:

creating build/lib/wx-2/6-gtk2-unicode/wx/lib/floatcanvas

It's replaced the "." in "2.6" with a "/", as that's what a dot means in a package hierarchy. AARRGG!

anyone have any ideas?

I'm so close!

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Hi Chris,

Hi all,

I'm trying to figure out how to write a setup.py to install a new version of wx.lib.floatcanvas

I tried this in the past, and couldn't figure it out, and just wrote my own small install script. However, since then, I figured out how to install a sub-package with distutils, so I thought I'd give it go. the trick is this:

site-packages is the default root of all packages. However, if you set:

package_dir = {"wx.lib": ""}

then it matches the "wx.lib" to "" in your structure, so that you can put your stuff in wx.lib.

However, wx.lib is not in site-packages/wx/lib. It's in something like:

site-packages/wx-2.6-gtk2-unicode/wx/lib

That's fine, I simply queries what file wx had when you did an "import wx", to find the default dir. You could also run wxversion first if you wanted to.

However, then we have a problem. Now your package looks like:

wx-2.6-gtk2-unicode.wx.lib.floatcanvas

which would be fine, except when you pass this into distutils, it creates a directory structure like this:

creating build/lib/wx-2/6-gtk2-unicode/wx/lib/floatcanvas

It's replaced the "." in "2.6" with a "/", as that's what a dot means in a package hierarchy. AARRGG!

anyone have any ideas?

Other than sending Robin a patch, or overriding the default distutils install targets with your own handlers to do whatever you want? (Which isn't really documented well, although it does work.)

However, from how you've described the process, your floatcanvas update will be overridden by future wxPython updates (at least on some ports), and will also need to be re-installed when a user upgrades to 2.7. While I can see that this is the most 'seamless' way to get existing code working, asking users to change the import line to get the new version is probably smoother and less confusing than requiring your users to continually re-install your module each time they update their wxPython.

Of course, this is precisely the sort of thing wxaddons was designed for... :slight_smile:

Regards,

Kevin

···

On Aug 16, 2006, at 5:48 PM, Christopher Barker wrote:

I'm so close!

-Chris

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Kevin Ollivier wrote:

Other than sending Robin a patch,

A patch to what? if you mean a patch to FloatCanvas, I do try to do that before each wxPython release, but I'm updating FloatCanvas far more frequently these days.

or overriding the default distutils install targets with your own handlers to do whatever you want? (Which isn't really documented well, although it does work.)

I'm not sure I want to go into quite that deep hacking....

It makes me wonder how wxPython's setup.py puts things it the right place -- maybe I need to go look at it, and see what it does does.

However, from how you've described the process, your floatcanvas update will be overridden by future wxPython updates (at least on some ports),

Yes.

and will also need to be re-installed when a user upgrades to 2.7.

Yes again, but that's OK, I expect changes anyway., and I hope that when 2.7 comes out, it will have the latest FloatCanvas anyway. It's kind of like expecting to have to install new Python packages when you install a new Python version.

While I can see that this is the most 'seamless' way to get existing code working, asking users to change the import line to get the new version is probably smoother and less confusing than requiring your users to continually re-install your module each time they update their wxPython.

That is a good point. I also am not considering that users may be using FloatCanvas for more than one project, and not want to update both ( I have not been god at keeping the API identical as I add stuff). Of course, then I have to deal with versioning, if I really want to do this.

Of course, this is precisely the sort of thing wxaddons was designed for... :slight_smile:

Yes, what's the story with that? is it ready to use? I'd like to get FloatCanvas into a public SVN (or CVS) anyway.

In truth, I think most people probably just use the floatcanvas package locally, rather than installing it, anyway. I mostly want to install it as I want to test it with the Demo, etc.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Hi Chris,

[snip]

Of course, this is precisely the sort of thing wxaddons was designed for... :slight_smile:

Yes, what's the story with that? is it ready to use? I'd like to get FloatCanvas into a public SVN (or CVS) anyway.

Yes, it's ready for use. 2.6.3.3 has all the wxPython mods needed to make the system work, and the CVS is setup and already being used by me, at least. :slight_smile:

I've also setup a components/floatcanvas directory which you should now have write access to. :slight_smile: Access instructions are here:

I think what you do is just checkout CVS with your SF username and password, just like you would for any other project you have developer access to. You'll only be able to commit to floatcanvas, though, of course. :slight_smile: Let me know if you run into any glitches - I think things will go smoothly, but you're the first non-admin user, so please write as soon as you run into any troubles so that we can iron things out. :slight_smile:

BTW, before you ask, we can't use SVN because SF won't let us use the features needed to allow non-admin users write access. ;-/

There are still, of course, things to work on; right now file releases can't be automatically pushed to SF.net, etc. I need to write some scripts to automate these things. I also need to get back to designing the web site... :slight_smile: In short, mostly what we need are some polish and the front end stuff. But the more it gets used, the quicker we'll work these things out. <wink, wink, nudge, nudge to

:wink:

Thanks,

Kevin

···

On Aug 17, 2006, at 9:15 AM, Christopher Barker wrote:

In truth, I think most people probably just use the floatcanvas package locally, rather than installing it, anyway. I mostly want to install it as I want to test it with the Demo, etc.

-Chris

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org