def setUp(self, package = HOOKUTILS_TEST_FILES):
     # Fun Python behavior: __import__('mod.submod') returns mod,
     # where as __import__('mod.submod', fromlist = [a non-empty list])
     # returns mod.submod. See the docs on `__import__
     # <http://docs.python.org/library/functions.html#__import__>`_.
     self.mod_list = collect_submodules(__import__(package,
                                                   fromlist = ['']))
Exemple #2
0
def hook(mod):
    # If PyZMQ provides its own copy of libzmq, add it to the
    # extension-modules TOC so zmq/__init__.py can load it at runtime.
    # For predictable behavior, the libzmq search here must be identical
    # to the search in zmq/__init__.py.
    zmq_directory = os.path.dirname(mod.__file__)
    for ext in ('pyd', 'so', 'dll', 'dylib'):
        bundled = glob.glob(os.path.join(zmq_directory, 'libzmq*.%s*' % ext))
        if bundled:
            # zmq/__init__.py will look in os.join(sys._MEIPASS, 'zmq'),
            # so libzmq has to land there.
            name = os.path.join('zmq', os.path.basename(bundled[0]))
            mod.binaries.append((name, bundled[0], 'BINARY'))
            break

    hiddenimports.extend(collect_submodules('zmq.backend'))
    hiddenimports.append('zmq.utils.garbage')

    return mod
Exemple #3
0
def hook(mod):
    # If PyZMQ provides its own copy of libzmq, add it to the
    # extension-modules TOC so zmq/__init__.py can load it at runtime.
    # For predictable behavior, the libzmq search here must be identical
    # to the search in zmq/__init__.py.
    zmq_directory = os.path.dirname(mod.__file__)
    for ext in ('pyd', 'so', 'dll', 'dylib'):
        bundled = glob.glob(os.path.join(zmq_directory, 'libzmq*.%s*' % ext))
        if bundled:
            # zmq/__init__.py will look in os.join(sys._MEIPASS, 'zmq'),
            # so libzmq has to land there.
            name = os.path.join('zmq', os.path.basename(bundled[0]))
            mod.binaries.append((name, bundled[0], 'BINARY'))
            break

    hiddenimports.extend(collect_submodules('zmq.backend'))
    hiddenimports.append('zmq.utils.garbage')

    return mod
#-----------------------------------------------------------------------------
# Copyright (c) 2014, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

"""
Testing with keyring 3.7 on MacOS.
"""

from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules('keyring.backends')
Exemple #5
0
from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports_pika = collect_submodules('pika')
hiddenimports_requests = collect_submodules('requests')
hiddenimports_psutils = collect_submodules('psutil')

hiddenimports = hiddenimports_pika + hiddenimports_requests + hiddenimports_psutils
from PyInstaller.hooks.hookutils import collect_submodules
hiddenimports = collect_submodules('nova_plugin')
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

from PyInstaller.hooks.hookutils import collect_submodules

# The layers to load can be configured using scapy's conf.load_layers.
#  from scapy.config import conf; print(conf.load_layers)
# I decided not to use this, but to include all layer modules. The
# reason is: When building the package, load_layers may not include
# all the layer modules the program will use later.

hiddenimports = collect_submodules('scapy.layers')
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
from PyInstaller.hooks.hookutils import collect_submodules

# Pygments uses a dynamic import for its formatters, so gather them all here.
hiddenimports = collect_submodules('pygments.lexers')
# -----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------------------------------------------------


from PyInstaller.hooks.hookutils import collect_submodules, collect_data_files

hiddenimports = (
    collect_submodules("docutils.languages")
    + collect_submodules("docutils.writers")
    + collect_submodules("docutils.parsers.rst.languages")
    + collect_submodules("docutils.parsers.rst.directives")
)
datas = collect_data_files("docutils")
Exemple #10
0
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


"""
Hook for PyZMQ. Cython based Python bindings for messaging library ZeroMQ.
http://www.zeromq.org/
"""
import glob
import os
from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = ['zmq.utils.garbage']
hiddenimports.extend(collect_submodules('zmq.backend'))

def hook(mod):
    # If PyZMQ provides its own copy of libzmq or libsodium, add it to the
    # extension-modules TOC so zmq/__init__.py can load it at runtime.
    # For predictable behavior, the libzmq search here must be equivalent
    # to the search in zmq/__init__.py.
    zmq_directory = os.path.dirname(mod.__file__)
    for libname in ('libzmq', 'libsodium'):
        bundled = glob.glob(os.path.join(zmq_directory,
                                         libname + '*.{pyd,so,dll,dylib}*'))
        if bundled:
            # zmq/__init__.py will look in os.join(sys._MEIPASS, 'zmq'),
            # so libzmq has to land there.
            name = os.path.join('zmq', os.path.basename(bundled[0]))
            # TODO fix this hook to use attribute 'binaries'.
import os

from PyInstaller.hooks.hookutils import collect_submodules
from PyInstaller.hooks.hookutils import get_package_paths

hiddenimports = collect_submodules('cloudify')

_relative_ctx_client_path = 'cloudify/proxy'
_pkg_base, _pkg_dir = get_package_paths('cloudify')
_full_ctx_client_path = os.path.join(_pkg_base, _relative_ctx_client_path,
                                     'client.py')

datas = [(_full_ctx_client_path, _relative_ctx_client_path)]
from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules("nova_plugin")
 def test_6(self):
     self.mod_list = collect_submodules(HOOKUTILS_TEST_FILES +
                                        '.subpkg')
     self.assert_subpackge_equal()
 def test_5(self):
     self.mod_list = collect_submodules(HOOKUTILS_TEST_FILES)
     self.test_3()
Exemple #15
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules('sqlite3')
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 20:43:57 2015

@author: Miguel
"""
from PyInstaller.hooks.hookutils import collect_submodules
hiddenimports = collect_submodules("numpy")
from PyInstaller.hooks.hookutils import collect_submodules, collect_data_files
hiddenimports = collect_submodules('neutron_plugin')
Exemple #18
0
# -----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------------------------------------------------

from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules('markdown.extensions')  # pragma: no cover
from PyInstaller.hooks.hookutils import collect_submodules
hiddenimports = collect_submodules('fabric_plugin')
Exemple #20
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

import os.path
from PyInstaller.hooks.hookutils import (collect_data_files,
                                         collect_submodules)
from distutils.sysconfig import get_python_inc

# IPython (tested with 0.13) requires the following files:
#   ./site-packages/IPython/config/profile/README_STARTUP
datas = collect_data_files('scipy.weave')
datas += collect_data_files('numpy.core')
datas += [(get_python_inc(), 'include')]

hiddenimports = collect_submodules('scipy.weave')
Exemple #21
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

from PyInstaller.hooks.hookutils import collect_submodules, collect_data_files

hiddenimports = collect_submodules('markdown.extensions')
Exemple #22
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
from PyInstaller.hooks.hookutils import collect_submodules


# Pygments uses a dynamic import for its formatters, so gather them all here.
hiddenimports = collect_submodules('pygments.formatters')
Exemple #23
0
#        pkg_base, pkg_dir = get_package_paths(package)
#      File "/usr/local/lib/python2.7/dist-packages/PyInstaller-2.1.1dev_9e9d21b-py2.7.egg/PyInstaller/hooks/hookutils.py", line 646, in get_package_paths
#        assert is_package, 'Package %s does not have __path__ attribute' % package
#    AssertionError: Package PyKDE4 does not have __path__ attribute
#
# Therefeore, catch this exception and ignore it. When this happends, a message
# is still generated::
#
#    2141 INFO: Processing hook hook-PyQt4.QtCore
#    Traceback (most recent call last):
#      File "<string>", line 1, in <module>
#    ImportError: No module named PyKDE4
#    2862 INFO: Processing hook hook-PyQt4.uic
#
# Note that the warning comes BEFORE hook-PyQt4.uic is listed, not after;
# however, the raised assertion caught by the try/except block below produces
# it, not any code in hook-PyQt4.QtCore.
if is_linux:
    try:
        hiddenimports = collect_submodules('PyKDE4') + [
            'PyQt4.QtSvg', 'PyQt4.QtXml'
        ]
    except AssertionError:
        pass
# Need to include modules in PyQt4.uic.widget-plugins, so they can be
# dynamically loaded by uic. They should both be included as separate
# (data-like) files, so they can be found by os.listdir and friends. However,
# this directory isn't a package, refer to it using the package (PyQt4.uic)
# followed by the subdirectory name (widget-plugins/).
datas = collect_data_files('PyQt4.uic', True, 'widget-plugins')
from PyInstaller.hooks.hookutils import collect_submodules
hiddenimports = collect_submodules('cinder_plugin')
Exemple #25
0
from PyInstaller.hooks.hookutils import collect_submodules
hiddenimports = collect_submodules('openstack_plugin_common')
# -*- coding: utf-8 -*-

from PyInstaller.hooks.hookutils import collect_submodules, collect_data_files

hiddenimports = collect_submodules('flask.ext')
hiddenimports += collect_submodules('flask_security')

datas = collect_data_files('flask_security', subdir='templates')

Exemple #27
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


from PyInstaller.hooks.hookutils import (collect_data_files, collect_submodules)


# IPython (tested with 0.13) requires the following files:
#   ./site-packages/IPython/config/profile/README_STARTUP
datas = collect_data_files('IPython')
hiddenimports = collect_submodules('IPython')
# -*- coding: utf-8 -*-

from PyInstaller.hooks.hookutils import collect_submodules, collect_data_files

hiddenimports = collect_submodules('faker')
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


"""
Hook for cryptography module from the Python Cryptography Authority.
"""

import os.path
import glob
from PyInstaller.hooks.hookutils import collect_submodules, get_module_file_attribute
from PyInstaller.hooks.hookutils import PY_EXTENSION_SUFFIXES

# add the OpenSSL FFI binding modules as hidden imports
hiddenimports = collect_submodules('cryptography.hazmat.bindings.openssl')

def hook(mod):
    """
    Include the cffi extensions as binaries in a subfolder named like the package.
    The cffi verifier expects to find them inside the package directory for 
    the main module. We cannot use hiddenimports because that would add the modules
	outside the package.
    """
    cryptography_dir = os.path.dirname(get_module_file_attribute('cryptography'))
    for ext in PY_EXTENSION_SUFFIXES:
        ffimods = glob.glob(os.path.join(cryptography_dir, '*_cffi_*%s*' % ext))
        for f in ffimods:
            name = os.path.join('cryptography', os.path.basename(f))
            # TODO fix this hook to use attribute 'binaries'.
            mod.pyinstaller_binaries.append((name, f, 'BINARY'))
#-----------------------------------------------------------------------------
# Copyright (c) 2014, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
"""
Testing with keyring 3.7 on MacOS.
"""

from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules('keyring.backends')
# -*- coding: utf-8 -*-

from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules('flask_script')


Exemple #32
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

from PyInstaller.hooks.hookutils import collect_submodules
hiddenimports = []

# Tested on Windows 7 x64 with Python 2.7.6 x32 using ReportLab 3.0
# This has been observed to *not* work on ReportLab 2.7

for x in collect_submodules('reportlab.pdfbase'):
    if x.startswith('reportlab.pdfbase._fontdata_'):
        hiddenimports.append(x)
Exemple #33
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

from PyInstaller.hooks.hookutils import collect_submodules, collect_data_files

hiddenimports = (collect_submodules('docutils.languages') +
                 collect_submodules('docutils.writers') +
                 collect_submodules('docutils.parsers.rst.languages') +
                 collect_submodules('docutils.parsers.rst.directives'))
datas = collect_data_files('docutils')
Exemple #34
0
from PyInstaller.hooks.hookutils import collect_data_files, collect_submodules
datas = collect_data_files('natcap.rios') + collect_data_files(
    'natcap.rios.rui')
hiddenimports = collect_submodules('natcap.rios') + collect_submodules(
    'natcap.rios.rui') + collect_submodules('multiprocessing')
# -*- coding: utf-8 -*-

import os
import glob

from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules('passlib.handlers')

Exemple #36
0
from PyInstaller.hooks.hookutils import collect_submodules
hiddenimports = collect_submodules('neutronclient')
# -----------------------------------------------------------------------------
# Copyright (c) 2014, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------------------------------------------------

# Tested with keyring 3.7 on MacOS.

from PyInstaller.hooks.hookutils import collect_submodules

hiddenimports = collect_submodules('keyring.backends')  # pragma: no cover
Exemple #38
0
 def test_0(self):
     # os is a module, not a package.
     with self.assertRaises(AttributeError):
         collect_submodules(__import__('os'))
Exemple #39
0
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
"""
Hook for cryptography module from the Python Cryptography Authority.
"""

import os.path
import glob
from PyInstaller.hooks.hookutils import collect_submodules, get_module_file_attribute
from PyInstaller.hooks.hookutils import PY_EXTENSION_SUFFIXES

# add the OpenSSL FFI binding modules as hidden imports
hiddenimports = collect_submodules('cryptography.hazmat.bindings.openssl')


def hook(mod):
    """
    Include the cffi extensions as binaries in a subfolder named like the package.
    The cffi verifier expects to find them inside the package directory for 
    the main module. We cannot use hiddenimports because that would add the modules
	outside the package.
    """
    cryptography_dir = os.path.dirname(
        get_module_file_attribute('cryptography'))
    for ext in PY_EXTENSION_SUFFIXES:
        ffimods = glob.glob(os.path.join(cryptography_dir,
                                         '*_cffi_*%s*' % ext))
        for f in ffimods:
Exemple #40
0
 def test_5(self):
     self.mod_list = collect_submodules(HOOKUTILS_TEST_FILES)
     self.test_3()
Exemple #41
0
 def test_6(self):
     self.mod_list = collect_submodules(HOOKUTILS_TEST_FILES + '.subpkg')
     self.assert_subpackge_equal()
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
from PyInstaller.hooks.hookutils import collect_submodules

# Pygments uses a dynamic import for its formatters, so gather them all here.
hiddenimports = collect_submodules('pygments.styles')
#        hiddenimports += collect_submodules('PyKDE4') + ['PyQt4.QtSvg', 'PyQt4.QtXml']
#      File "/usr/local/lib/python2.7/dist-packages/PyInstaller-2.1.1dev_9e9d21b-py2.7.egg/PyInstaller/hooks/hookutils.py", line 679, in collect_submodules
#        pkg_base, pkg_dir = get_package_paths(package)
#      File "/usr/local/lib/python2.7/dist-packages/PyInstaller-2.1.1dev_9e9d21b-py2.7.egg/PyInstaller/hooks/hookutils.py", line 646, in get_package_paths
#        assert is_package, 'Package %s does not have __path__ attribute' % package
#    AssertionError: Package PyKDE4 does not have __path__ attribute
#
# Therefeore, catch this exception and ignore it. When this happends, a message
# is still generated::
#
#    2141 INFO: Processing hook hook-PyQt4.QtCore
#    Traceback (most recent call last):
#      File "<string>", line 1, in <module>
#    ImportError: No module named PyKDE4
#    2862 INFO: Processing hook hook-PyQt4.uic
#
# Note that the warning comes BEFORE hook-PyQt4.uic is listed, not after;
# however, the raised assertion caught by the try/except block below produces
# it, not any code in hook-PyQt4.QtCore.
if is_linux:
    try:
        hiddenimports = collect_submodules('PyKDE4') + ['PyQt4.QtSvg', 'PyQt4.QtXml']
    except AssertionError:
        pass
# Need to include modules in PyQt4.uic.widget-plugins, so they can be
# dynamically loaded by uic. They should both be included as separate
# (data-like) files, so they can be found by os.listdir and friends. However,
# this directory isn't a package, refer to it using the package (PyQt4.uic)
# followed by the subdirectory name (widget-plugins/).
datas = collect_data_files('PyQt4.uic', True, 'widget-plugins')
Exemple #44
0
from PyInstaller.compat import is_linux

hiddenimports = ['scipy._lib.messagestream']
# Special hook necessary for PyInstaller v2.x (our linux builds)
if is_linux:
    from PyInstaller.hooks.hookutils import collect_submodules
    hiddenimports.extend([
        'scipy.special._ufuncs_cxx', 'scipy.io.matlab.streams',
        'scipy.sparse.cgraph._validation',
        ] + collect_submodules('scipy.linalg'))
Exemple #45
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------


from PyInstaller.hooks.hookutils import collect_submodules, collect_data_files

hiddenimports = collect_submodules('sphinx.ext')
datas = collect_data_files('sphinx')
Exemple #46
0
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------

from PyInstaller.hooks.hookutils import (collect_data_files,
                                         collect_submodules)

# IPython (tested with 0.13) requires the following files:
#   ./site-packages/IPython/config/profile/README_STARTUP
datas = collect_data_files('IPython')
hiddenimports = collect_submodules('IPython')