Beispiel #1
0
def setup_extra_options():
    is_interesting_package = re.compile(r'.+[/\\](libxpdf).*').match

    def build_packages(directories):
        packages = {}
        for dir_path in directories:
            if is_interesting_package(dir_path):
                package_name = is_interesting_package(dir_path).group(1)
                package_files = []
                dir_path = os.path.realpath(dir_path)
                for root, _, files in os.walk(dir_path):
                    package_files = [root, files]

                packages[package_name] = package_files
        return packages

    # Copy Global Extra Options
    extra_opts = dict(extra_options)

    # Build ext modules
    ext_modules = setupinfo.ext_modules(STATIC_INCLUDE_DIRS,
                                        STATIC_LIBRARY_DIRS, STATIC_CFLAGS,
                                        STATIC_BINARIES)
    extra_opts['ext_modules'] = ext_modules

    packages = extra_opts.get('packages', list())
    package_dir = extra_opts.get('package_dir', dict())
    package_data = extra_opts.get('package_data', dict())

    include_dirs = []  # keep them in order
    for extension in ext_modules:
        for inc_dir in extension.include_dirs:
            if inc_dir not in include_dirs:
                include_dirs.append(inc_dir)

    header_packages = build_packages(include_dirs)
    for package_path, (root_path, filenames) in header_packages.items():
        if package_path:
            package = 'pyxpdf.includes.' + package_path
            packages.append(package)
        else:
            package = 'pyxpdf.includes'
        package_data[package] = filenames
        package_dir[package] = root_path

    return extra_opts
Beispiel #2
0
def setup_extra_options():
    is_interesting_package = re.compile('^(libxml|libxslt|libexslt)$').match
    def extract_files(directories, pattern='*'):
        def get_files(root, dir_path, files):
            return [ (root, dir_path, filename)
                     for filename in fnmatch.filter(files, pattern) ]

        file_list = []
        for dir_path in directories:
            dir_path = os.path.realpath(dir_path)
            for root, dirs, files in os.walk(dir_path):
                rel_dir = root[len(dir_path)+1:]
                if is_interesting_package(rel_dir):
                    file_list.extend(get_files(root, rel_dir, files))
        return file_list

    def build_packages(files):
        packages = {}
        seen = set()
        for root_path, rel_path, filename in files:
            if filename in seen:
                # libxml2/libxslt header filenames are unique
                continue
            seen.add(filename)
            package_path = '.'.join(rel_path.split(os.sep))
            if package_path in packages:
                root, package_files = packages[package_path]
                if root != root_path:
                    print("conflicting directories found for include package '%s': %s and %s"
                          % (package_path, root_path, root))
                    continue
            else:
                package_files = []
                packages[package_path] = (root_path, package_files)
            package_files.append(filename)

        return packages

    # Copy Global Extra Options
    extra_opts = dict(extra_options)

    # Build ext modules
    ext_modules = setupinfo.ext_modules(
                    STATIC_INCLUDE_DIRS, STATIC_LIBRARY_DIRS,
                    STATIC_CFLAGS, STATIC_BINARIES)
    extra_opts['ext_modules'] = ext_modules

    packages = extra_opts.get('packages', list())
    package_dir = extra_opts.get('package_dir', dict())
    package_data = extra_opts.get('package_data', dict())

    # Add lxml.include with (lxml, libxslt headers...)
    #   python setup.py build --static --static-deps install
    #   python setup.py bdist_wininst --static
    if setupinfo.OPTION_STATIC:
        include_dirs = [] # keep them in order
        for extension in ext_modules:
            for inc_dir in extension.include_dirs:
                if inc_dir not in include_dirs:
                    include_dirs.append(inc_dir)

        header_packages = build_packages(extract_files(include_dirs))

        for package_path, (root_path, filenames) in header_packages.items():
            if package_path:
                package = 'lxml.includes.' + package_path
                packages.append(package)
            else:
                package = 'lxml.includes'
            package_data[package] = filenames
            package_dir[package] = root_path

    return extra_opts
Beispiel #3
0
    'Intended Audience :: Developers',
    'Intended Audience :: Information Technology',
    'License :: OSI Approved :: BSD License',
    'Programming Language :: Cython',
    'Programming Language :: Python :: 2',
    'Programming Language :: Python :: 2.3',
    'Programming Language :: Python :: 2.4',
    'Programming Language :: Python :: 2.5',
    'Programming Language :: Python :: 2.6',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.0',
    'Programming Language :: C',
    'Operating System :: OS Independent',
    'Topic :: Text Processing :: Markup :: HTML',
    'Topic :: Text Processing :: Markup :: XML',
    'Topic :: Software Development :: Libraries :: Python Modules'
    ],

    package_dir = {'': 'src'},
    packages = ['lxml', 'lxml.html'],
    ext_modules = setupinfo.ext_modules(
        STATIC_INCLUDE_DIRS, STATIC_LIBRARY_DIRS,
        STATIC_CFLAGS, STATIC_BINARIES),
    **extra_options
)

if OPTION_RUN_TESTS:
    print("Running tests.")
    import test
    sys.exit( test.main(sys.argv[:1]) )
Beispiel #4
0
""" + branch_link) % {
        "branch_version": versioninfo.branch_version()
    }) + versioninfo.changes()),
    classifiers=[
        versioninfo.dev_status(), 'Intended Audience :: Developers',
        'Intended Audience :: Information Technology',
        'License :: OSI Approved :: BSD License',
        'Programming Language :: Cython',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.3',
        'Programming Language :: Python :: 2.4',
        'Programming Language :: Python :: 2.5',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.0', 'Programming Language :: C',
        'Operating System :: OS Independent',
        'Topic :: Text Processing :: Markup :: HTML',
        'Topic :: Text Processing :: Markup :: XML',
        'Topic :: Software Development :: Libraries :: Python Modules'
    ],
    package_dir={'': 'src'},
    packages=['lxml', 'lxml.html'],
    ext_modules=setupinfo.ext_modules(STATIC_INCLUDE_DIRS, STATIC_LIBRARY_DIRS,
                                      STATIC_CFLAGS, STATIC_BINARIES),
    **extra_options)

if OPTION_RUN_TESTS:
    print("Running tests.")
    import test
    sys.exit(test.main(sys.argv[:1]))