[reportlab-users] RE: setup scripts

Dirk Datzert reportlab-users@reportlab.com
Mon, 23 Dec 2002 13:04:49 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C2AA83.DFBE8D00
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Andy,

I wrote a little function for searching the data_files via pattern  =
matching of the file extensions. It steps recursive thru to directories =
and puts all data-files per directory into a tuple useable by data_file =
in setup().

Regards,
Dirk


----- Original Message -----=20
From: "Andy Robinson" <andy@reportlab.com>
To: <reportlab-users@reportlab.com>
Sent: Monday, December 23, 2002 12:20 AM
Subject: RE: [reportlab-users] RE: setup scripts


> After some more work,   "python setup.py sdist" creates an=20
> archive OK, and "python setup.py install" does a correct=20
> install from it AFAICT - all test suite passed and all the=20
> readmes and examples I can find.  On win32 anyway.
>=20
> Testers take note:  please rename/remove your old
> reportlab before testing the install, and look carefully
> in the created one for things like=20
>   reportlab/license.txt
>   reportlab/test/pythonpowered.gif
>=20
> I also begin to comprehend the utter weirdness of distutils:
>  1. 'sdist' uses a neat manifest-builder manifest to just bundle=20
>     up everything, ignoring any data file declarations in the
>     setup script.
>    =20
>  2. 'install' uses the 'data' declarations in the setup script,
>      ignoring any manifest
>=20
>  3. bdist_wininst must do something else altogether as
>     it still isn't picking up the data files....
>=20
> Maintaining this by hand is going to suck.  At the very=20
> minimum we will need to check in a manifest and have a=20
> runtime test to verify all required files are actually=20
> there in all the distros.
>=20
> Victory never tasted so sour grumble grumble grumble.....
>=20
> - Andy
> _______________________________________________
> reportlab-users mailing list
> reportlab-users@reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>=20

------=_NextPart_000_0008_01C2AA83.DFBE8D00
Content-Type: application/octet-stream;
	name="setup.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="setup.py"

# a dangerously incomplete attempt at a reportlab setup script,
# do not trust it to do anything.  It builds the extensions
# though :-)

from distutils.core import setup, Extension

import os, glob, sys, string, distutils

# from Zope - App.Common.package_home

def package_home(globals_dict):
    __name__=3Dglobals_dict['__name__']
    m=3Dsys.modules[__name__]
    r=3Dos.path.split(m.__path__[0])[0]
    return r

pjoin =3D os.path.join
pwalk =3D os.path.walk
psplit =3D string.split

package_path =3D pjoin(package_home(distutils.__dict__), =
'site-packages', 'reportlab')

# treat this extensions as data_files:

pattern =3D ['gif','jpg','png','xml','yml','dtd','txt','a85']
data_files_found =3D []

def file_check ( arg, dirname, fnames ):
    data_files =3D []
    other_files =3D []

    for fname in fnames:
        ext =3D psplit(fname, '.')[-1]
        if ext in pattern:
            data_files.append (pjoin(dirname, fname))
        else:
            other_files.append(fname)

    # replace the remaining files names via slice
    fnames[:] =3D other_files

    # append an entry for all data_files in this dirname
    if len(data_files) > 0:
        data_files_found.append( (pjoin(package_path, dirname), =
data_files ) )


def search_data_files():
    pwalk('.', file_check, None)
    return data_files_found


# why oh why don't most setup scripts have a script handler?
# if you don't have one, you can't edit in Pythonwin
def run():
    LIBS =3D []
    setup(
            name=3D"Reportlab",
            version=3D"1.17",
            licence=3D"BSD license, Copyright (c) 2000-2003, ReportLab =
Inc.",
            description=3D"Reportlab PDF generation tools",
            long_description=3D"""The ReportLab PDF Generation tools.
An Open Source Python library for generating PDFs.

This installer created using distutils by John Precedo.
""",

            author=3D"The boys from SW19",
            author_email=3D"info@reportlab.com",
            url=3D"http://www.reportlab.com/",

            package_dir =3D {'reportlab': '.'},

            packages=3D[ # include anything with an __init__
                    'reportlab',
                    'reportlab.demos',
                    'reportlab.demos.colors',
                    'reportlab.demos.gadflypaper',
                    'reportlab.demos.odyssey',
                    'reportlab.demos.rlzope',
                    'reportlab.demos.stdfonts',
                    'reportlab.demos.tests',
                    'reportlab.docs',
                    'reportlab.docs.graphguide',
                    'reportlab.docs.reference',
                    'reportlab.docs.userguide',
                    'reportlab.graphics',
                    'reportlab.graphics.charts',
                    'reportlab.graphics.widgets',
                    'reportlab.lib',
                    'reportlab.pdfbase',
                    'reportlab.pdfgen',
                    'reportlab.platypus',
                    'reportlab.test',
                    'reportlab.tools',
                    'reportlab.tools.docco',
                    'reportlab.tools.py2pdf',
                    'reportlab.tools.pythonpoint',
                    'reportlab.tools.pythonpoint.demos',
                    'reportlab.tools.pythonpoint.styles',
                     ],
              data_files =3D [(package_path,
				['README',
				 'changes']),
			    (pjoin(package_path, 'lib'),
				['lib/hyphen.mashed',]),
			] + search_data_files(),

            ext_modules =3D   [Extension( '_rl_accel',
                                        ['lib/_rl_accel.c'],
                                        include_dirs=3D[],
                                        define_macros=3D[],
                                        library_dirs=3D[],
                                        libraries=3DLIBS, # libraries to =
link against
                                        ),
                             Extension( 'sgmlop',
                                        ['lib/sgmlop.c'],
                                        include_dirs=3D[],
                                        define_macros=3D[],
                                        library_dirs=3D[],
                                        libraries=3DLIBS, # libraries to =
link against
                                        ),
                             Extension( 'pyHnj',
                                        ['lib/pyHnjmodule.c',
                                         'lib/hyphen.c',
                                         'lib/hnjalloc.c'],
                                        include_dirs=3D[],
                                        define_macros=3D[],
                                        library_dirs=3D[],
                                        libraries=3DLIBS, # libraries to =
link against
                                        ),
                            ],

        )

if __name__=3D=3D'__main__':
    run()

------=_NextPart_000_0008_01C2AA83.DFBE8D00--