proposal: move py library code into lib subdir

Many new users have been bitten by trying to run matplotlib from the
matplotlib src dir, only to get an inscrutable error about not being
able to find some extension code, as described in this FAQ
http://matplotlib.sourceforge.net/faq.html#WRONGDIR.

Recently, I've added pytz and dateutil for improved timezone and date
ticking to the src distro. I want to conditionally install these
packages with matplotlib, only if the user hasn't installed them
already. So in setup.py, I do for example

try: import dateutil
except ImportError:
    packages.append('dateutil')

But I was bitten by the same bug. Because dateutil was in the
matplotlib root dir, it was imported successfully and not installed.

My proposal is to move all the python library code into a lib subdir,
which currently would look like

  lib\matplotlib
  lib\pytz
  lib\dateutil

and use package_dir = {'': 'lib'} in setup.py, which would fix both
problems.

Of course, I'll have to submit an admin request to sourceforge just to
get the old dirs purged. Sure would be nice if CVS supported basic
rename and delete operations on directories.

Comments, suggestions, objections...

JDH

John Hunter wrote:

Many new users have been bitten by trying to run matplotlib from the
matplotlib src dir, only to get an inscrutable error about not being
able to find some extension code, as described in this FAQ
http://matplotlib.sourceforge.net/faq.html#WRONGDIR.

Recently, I've added pytz and dateutil for improved timezone and date
ticking to the src distro. I want to conditionally install these
packages with matplotlib, only if the user hasn't installed them
already. So in setup.py, I do for example

try: import dateutil
except ImportError:
   packages.append('dateutil')

But I was bitten by the same bug. Because dateutil was in the
matplotlib root dir, it was imported successfully and not installed.

My proposal is to move all the python library code into a lib subdir,
which currently would look like

lib\matplotlib
lib\pytz
lib\dateutil

and use package_dir = {'': 'lib'} in setup.py, which would fix both
problems.

Of course, I'll have to submit an admin request to sourceforge just to
get the old dirs purged. Sure would be nice if CVS supported basic
rename and delete operations on directories.

Comments, suggestions, objections...

Should I assume that the installed packages would have the same structure, i.e. lib/python2.3/site-packages/matplotlib/ ? If yes, then I see no problem with this proposal.

-- Paul

···

--
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218