Multiple wxPython versions

I've tried to stay out of this conversation, because there
is a infinite number of choices....

But, is the "standard" python method not being used?

See below...

Or a message that gives even more information. If the
developer knows it
to work with more than one version, the imports could be
nested inside
try blocks, so that the ones known to work would be tried in turn.

i.e.

try:
  from wxPythonVersions.251 import wx
except ImportError:
  try:
     wxPythonVersions.24 import wx
  except ImportError:
    raise ImportError("This program requires
wxPython version 2.4 or 2.5
to run, please make sure it is properly installed)

By the way, we should probably use "25" rather than "251" under the
assumption that all the 2.5.* versions will be API

Yes, usable, but convulted....

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
__version__ = '0.77' # Human Readable Version number
version_info = (0,7,7) # Easier format version data for comparisons
                        # i.e. if version_info > (1,2,5)

···

#
                        # if __version__ > '1.00' is a little more
contrived.
                        
__author__ = 'Benjamin A. Schollnick'
__date__ = '2002-01-02' # yyyy-mm-dd
__email__ = 'Benjamin.Schollnick@usa.xerox.com'

copyright = """
                        COPYRIGHT
                        ---------....."""

import wx

if wx.__version_info__ < (2,5):
  raise "Version Error, need a version of wx that is at least
v2.5.x.

If we wanted to we could do the same thing that you did, but code wise...

    - Benjamin

Schollnick, Benjamin wrote:

I've tried to stay out of this conversation, because there
is a infinite number of choices....

But, is the "standard" python method not being used?

because there is no "standard" way to do what we are talking about. You can check if the installed version of wxPython is what your code needs, but there is now no way to have more than one version installed AT THE SAME TIME. That's what's being discussed..how to have more than one version installed at once. Connected to this is how to choose between them, if more than one version does exist.

As a note, however, version info is different between 2.4 and 2.5, which makes this a bit more of a pain, but the goal at this point is to get it right in the future.

-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,

Schollnick, Benjamin wrote:

if wx.__version_info__ < (2,5):
raise "Version Error, need a version of wx that is at
least v2.5.x.

This is easy to do, but not sufficient, that's the problem. You may
have a program that works with 2.4 but does _not_ work with 2.5 (e.g.
because of small API incompatibilies -- there are some, aren't
there?). This program cannot check if the version is < 2.5 and refuse
to run otherwise because at the time it was written, there was no 2.5
release _and_ the author had no idea that the app will not work with
future 2.5 release.

Even if the app did check the version and refused to run on anything
different from 2.4, it would still not help: you can have app Foo
that requires wxPython 2.4 and app Bar that requires 2.5 installed at
the same time, in which case there's no way you could make both of
them work with single wxPython version/installation. This problem is
nonexistent if you ship wxPython runtime with your app, but almost
nobody does that on Unix.

Being able to install multiple versions side by side (just as it is
possible with C++ version of wx) would fix this. Without it, the only
way to ensure that wxPython apps will work is rigorous maintaining of
API compatibility.

Regards,
Vaclav

···

--
PGP key: 0x465264C9, available from http://pgp.mit.edu/