Building a binary package of matplotlib for OS-X

Hi Bob,

Sorry for the delay getting back on this. I am starting to look at
setuptools and have read over (quickly)
http://peak.telecommunity.com/DevCenter/PythonEggs

A couple of questions:

  * Are you recommending using the full PythonEggs suite, or just the
    parts in the default setuptools that comes with python2.4 ? I
    notice for example, that pkg_resources is not available in Python
    2.4.1 setuptools. This is not a huge problem, since it is fairly
    easy to install/upgrade. Just wondering.

  * It is not clear to me what the "right" way is to
    distribute/install data files (eg fonts). You suggest above that
    the data_files directive is not the right way and that the data
    files should be placed in the package. I naively tried
    package_data with
    
     from setuptools import setup
     
     setup(name="matplotlib",
        ...snip...
        package_data = {
          'matplotlib.fonts' : glob.glob('fonts/afm/*.afm'),
         },
        package_dir = {'': 'lib'},
        )

    where fonts/afm in the relative path has a bunch of *.afm fonts,
    but no files were added to site-packages/matplotlib/fonts/ when I
    did a 'sudo python setup.py install'. I read over the py2app
    setup at http://svn.red-bean.com/bob/py2app/trunk/setup.py but
    still was unsure how to proceed. The PythonEgg resource
    documentation spends a fair amount of space on how to "access"
    resources, but I missed how to specify them for the distribution
    (PythonEggs - The PEAK Developers' Center)

    So that is a long-winded way of asking "how should data files be
    placed in the package for distribution?"

Thanks,
JDH

···

On Jun 17, 2005, at 4:09 PM, John Hunter wrote:

    >>>>>>>
    >>
    >>> Using data_files in this manner at all is usually the wrong
    >>> thing to do anyway. Python packages should really put the
    >>> files they need into the package, not some semi-random
    >>> location on the filesystem.
    >>>
    >>
    > I tend to trust Bob in these matters. What is the logic for
    > putting all that stuff outside of the package directory?
    >> I was just following the lead of the distutils documentation
    >> circa 2003 which is when this section of setup.py written.
    >> Since distutils had a slot for data_files, I put my data files
    >> there, which seems reasonable even in hindsight. I'm not
    >> opposed to putting them somewhere else, especially if someone
    >> explains the why and how. I do try and preserve compatibility
    >> with older python versions, so 2.4 only solutions are not a
    >> good choice at the moment.

    > Python 2.4 distutils has the functionality built-in,
    > otherwise you can get it from setuptools (in the Python CVS
    > sandbox, or from
    > <PythonEggs&gt;\ - The PEAK Developers' Center). There
    > have been various other hacks throughout the years to do it,
    > but setuptools is the standard now.

    > py2app uses setuptools when building itself, and it is
    > certainly Python 2.3 compatible.