def test_collect_submod_egg(self, tmpdir, monkeypatch): # Copy files to a tmpdir for egg building. dest_path = tmpdir.join('hookutils_package') shutil.copytree(TEST_MOD_PATH, dest_path.strpath) monkeypatch.chdir(dest_path) # Create an egg from the test package. For debug, show the output of # the egg build. print(exec_python('setup.py', 'bdist_egg')) # Obtain the name of the egg, which depends on the Python version. dist_path = dest_path.join('dist') fl = os.listdir(dist_path.strpath) assert len(fl) == 1 egg_name = fl[0] assert egg_name.endswith('.egg') # Add the egg to Python's path. pth = dist_path.join(egg_name).strpath monkeypatch.setattr('PyInstaller.config.CONF', {'pathex': [pth]}) monkeypatch.syspath_prepend(pth) # Verify its contents. ml = collect_submodules(TEST_MOD) self.test_collect_submod_all_included(ml)
def get_deps_all(): '''Similar to :func:`get_deps_minimal`, but this returns all the kivy modules that can indirectly imported. Which includes all the possible kivy providers. This can be used to get a list of all the possible providers which can then manually be included/excluded by commenting out elements in the list instead of passing on all the items. See module description. :returns: A dict with three keys, ``hiddenimports``, ``excludes``, and ``binaries``. Their values are a list of the corresponding modules to include/exclude. This can be passed directly to `Analysis`` with e.g. :: a = Analysis(['..\\kivy\\examples\\demo\\touchtracer\\main.py'], ... **get_deps_all()) ''' return { 'binaries': _find_gst_binaries(), 'hiddenimports': sorted(set(kivy_modules + collect_submodules('kivy.core'))), 'excludes': []}
def mod_list(monkeypatch): # Add 'hookutils_files' to sys.path (so ``is_package`` can find it) and to # ``pathex`` (so code run in a subprocess can find it). monkeypatch.setattr('PyInstaller.config.CONF', {'pathex': [TEST_MOD_PATH]}) monkeypatch.syspath_prepend(TEST_MOD_PATH) # Use the hookutils_test_files package for testing. return collect_submodules(TEST_MOD)
def test_collect_submod_subpkg(self, mod_list): # Note: Even though mod_list is overwritten, it's still needed as a # fixture, so that the path to the TEST_MOD will be set correctly. mod_list = collect_submodules(TEST_MOD + '.subpkg') mod_list.sort() assert mod_list == [TEST_MOD + '.subpkg', TEST_MOD + '.subpkg.twelve']
def mod_list(monkeypatch): # Add path with 'hookutils_files' module to PYTHONPATH so tests # could find this module - useful for subprocesses. pth = os.path.dirname(os.path.abspath(__file__)) monkeypatch.setenv('PYTHONPATH', pth) # Use the hookutils_test_files package for testing. return collect_submodules(TEST_MOD)
#----------------------------------------------------------------------------- # Copyright (c) 2005-2019, 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.utils.hooks import collect_submodules hiddenimports = collect_submodules('django.contrib.sessions.backends')
#----------------------------------------------------------------------------- # Copyright (c) 2013-2018, 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.utils.hooks import collect_submodules hiddenimports = [] # On Windows in Python 3.4 'sqlite3' package might contain tests. # these tests are not necessary for the final executable. for mod in collect_submodules('sqlite3'): if not mod.startswith('sqlite3.test'): hiddenimports.append(mod)
logger = logging.getLogger(__name__) datas, binaries, hiddenimports = collect_all('django') root_dir = django_find_root_dir() if root_dir: logger.info('Django root directory %s', root_dir) # Include imports from the mysite.settings.py module. settings_py_imports = django_dottedstring_imports(root_dir) # Include all submodules of all imports detected in mysite.settings.py. for submod in settings_py_imports: hiddenimports.append(submod) hiddenimports += collect_submodules(submod) # Include main django modules - settings.py, urls.py, wsgi.py. # Without them the django server won't run. package_name = os.path.basename(root_dir) hiddenimports += [ # TODO Consider including 'mysite.settings.py' in source code as a data files. # Since users might need to edit this file. package_name + '.settings', package_name + '.urls', package_name + '.wsgi', ] # Django hiddenimports from the standard Python library. if sys.version_info.major == 3: # Python 3.x hiddenimports += [ 'http.cookies',
def get_deps_minimal(exclude_ignored=True, **kwargs): '''Returns Kivy hidden modules as well as excluded modules to be used with ``Analysis``. The function takes core modules as keyword arguments and their value indicates which of the providers to include/exclude from the compiled app. The possible keyword names are ``audio, camera, clipboard, image, spelling, text, video, and window``. Their values can be: ``True``: Include current provider The providers imported when the core module is loaded on this system are added to hidden imports. This is the default if the keyword name is not specified. ``None``: Exclude Don't return this core module at all. ``A string or list of strings``: Providers to include Each string is the name of a provider for this module to be included. For example, ``get_deps_minimal(video=None, window=True, audio=['gstplayer', 'ffpyplayer'], spelling='enchant')`` will exclude all the video providers, will include the gstreamer and ffpyplayer providers for audio, will include the enchant provider for spelling, and will use the current default provider for ``window``. ``exclude_ignored``, if ``True`` (the default), if the value for a core library is ``None``, then if ``exclude_ignored`` is True, not only will the library not be included in the hiddenimports but it'll also added to the excluded imports to prevent it being included accidentally by pyinstaller. :returns: A dict with three keys, ``hiddenimports``, ``excludes``, and ``binaries``. Their values are a list of the corresponding modules to include/exclude. This can be passed directly to `Analysis`` with e.g. :: a = Analysis(['..\\kivy\\examples\\demo\\touchtracer\\main.py'], ... hookspath=hookspath(), runtime_hooks=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, **get_deps_minimal(video=None, audio=None)) ''' core_mods = ['audio', 'camera', 'clipboard', 'image', 'spelling', 'text', 'video', 'window'] mods = kivy_modules[:] excludes = excludedimports[:] for mod_name, val in kwargs.items(): if mod_name not in core_mods: raise KeyError('{} not found in {}'.format(mod_name, core_mods)) full_name = 'kivy.core.{}'.format(mod_name) if not val: core_mods.remove(mod_name) if exclude_ignored: excludes.extend(collect_submodules(full_name)) continue if val is True: continue core_mods.remove(mod_name) mods.append(full_name) single_mod = False if sys.version < '3.0': # Mod name could potentially be any basestring subclass if isinstance(val, basestring): single_mod = True mods.append('kivy.core.{0}.{0}_{1}'.format(mod_name, val)) else: # There is no `basestring` in Py3 if isinstance(val, (str, bytes)): single_mod = True mods.append('kivy.core.{0}.{0}_{1}'.format(mod_name, val)) if not single_mod: for v in val: mods.append('kivy.core.{0}.{0}_{1}'.format(mod_name, v)) for mod_name in core_mods: # process remaining default modules full_name = 'kivy.core.{}'.format(mod_name) mods.append(full_name) m = importlib.import_module(full_name) if mod_name == 'clipboard' and m.CutBuffer: mods.append(m.CutBuffer.__module__) if hasattr(m, mod_name.capitalize()): # e.g. video -> Video val = getattr(m, mod_name.capitalize()) if val: mods.append(getattr(val, '__module__')) if hasattr(m, 'libs_loaded') and m.libs_loaded: for name in m.libs_loaded: mods.append('kivy.core.{}.{}'.format(mod_name, name)) mods = sorted(set(mods)) binaries = [] if any('gstplayer' in m for m in mods): binaries = _find_gst_binaries() elif exclude_ignored: excludes.append('kivy.lib.gstplayer') return { 'hiddenimports': mods, 'excludes': excludes, 'binaries': binaries, }
logger = logging.getLogger(__name__) hiddenimports = [] root_dir = django_find_root_dir() if root_dir: logger.info('Django root directory %s', root_dir) # Include imports from the mysite.settings.py module. settings_py_imports = django_dottedstring_imports(root_dir) # Include all submodules of all imports detected in mysite.settings.py. for submod in settings_py_imports: hiddenimports.append(submod) hiddenimports += collect_submodules(submod) # Include main django modules - settings.py, urls.py, wsgi.py. # Without them the django server won't run. package_name = os.path.basename(root_dir) hiddenimports += [ # TODO Consider including 'mysite.settings.py' in source code as a data files. # Since users might need to edit this file. package_name + '.settings', package_name + '.urls', package_name + '.wsgi', ] # Include some hidden modules that are not imported directly in django. hiddenimports += [ 'django.template.defaultfilters', 'django.template.defaulttags', 'django.template.loader_tags',
# in order for chaco to work in frozen mode, uncomment the line # # raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname)) # # in pyface.toolkt.py in line 92 from PyInstaller.utils.hooks import collect_submodules hiddenimports=['enable', 'enable.toolkit_constants', 'kiva', 'kiwisolver', 'pyface', 'pyface.image_resource', 'traitsui.toolkit', 'traits.etsconfig.api', 'wx', 'reportlab', 'reportlab.rl_settings', 'pyface.action.action_item', ] hiddenimports += collect_submodules('pyface.ui.wx') hiddenimports += collect_submodules('traitsui.wx') hiddenimports += collect_submodules('enable.wx') excludedimports = ['PyQt4', 'PyQt5', 'PySide', 'Tkinter', 'wx.lib.activex']
#----------------------------------------------------------------------------- # Copyright (c) 2005-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is in the file COPYING.txt, distributed with this software. # # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception) #----------------------------------------------------------------------------- """ Hook for ncclient. ncclient is a Python library that facilitates client-side scripting and application development around the NETCONF protocol. https://pypi.python.org/pypi/ncclient This hook was tested with ncclient 0.4.3. """ from PyInstaller.utils.hooks import collect_submodules # Modules 'ncclient.devices.*' are dynamically loaded and PyInstaller # is not able to find them. hiddenimports = collect_submodules('ncclient.devices')
# Copyright (c) 2013-2018, 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. #----------------------------------------------------------------------------- # Hook for wxPython 2.8.x, 2.9.x, and 3.0.x for Python 2.7. # Includes submodules of wx.lib.pubsub to handle the way # wx.lib.pubsub may provide different versions of its API # according to the order in which certain modules are imported. from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('wx.lib.pubsub') # collect_submodules does not find `pubsub1` or `pubsub2` because # they are not packages, just folders without an `__init__.py` # Thus they are invisible to ModuleGraph and must be included as data files pubsub_datas = collect_data_files('wx.lib.pubsub', include_py_files=True) def _match(src, dst): # Since ``pubsub1`` and ``pubsub2`` are directories, they should be in dst. # However, ``autosetuppubsubv1`` is a ``.py`` file, so it will only appear # in the ``src``. For example:: # # pubsub_datas = [('c:\\python27\\lib\\site-packages\\wx-2.8-msw-unicode\\wx\\lib\\pubsub\\autosetuppubsubv1.py', # 'wx\\lib\\pubsub') ]
from PyInstaller.utils.hooks import collect_submodules from PyInstaller.utils.hooks import collect_data_files hiddenimports = collect_submodules("pyaudio") datas = collect_data_files("pyaudio")
from PyInstaller.utils.hooks import collect_submodules hiddenimports = ['scipy.special._ufuncs_cxx', 'scipy.io.matlab.streams', 'scipy.sparse.cgraph._validation'] + collect_submodules('scipy.linalg')
# # BRAIN_MODULES_DIR = join(dirname(__file__), 'brain') # if BRAIN_MODULES_DIR not in sys.path: # # add it to the end of the list so user path take precedence # sys.path.append(BRAIN_MODULES_DIR) # # load modules in this directory # for module in listdir(BRAIN_MODULES_DIR): # if module.endswith('.py'): # __import__(module[:-3]) # # So, we need all the Python source in the ``brain/`` subdirectory, # since this is run-time discovered and loaded. Therefore, these # files are all data files. from PyInstaller.utils.hooks import collect_data_files, collect_submodules, \ is_module_or_submodule # Note that brain/ isn't a module (it lacks an __init__.py, so it can't be # referred to as astroid.brain; instead, locate it as package astriod, # subdirectory brain/. datas = collect_data_files('astroid', True, 'brain') # Update: in astroid v 1.4.1, the brain/ module import parts of astroid. Since # everything in brain/ is dynamically imported, these are hidden imports. For # simplicity, include everything in astroid. Exclude all the test/ subpackage # contents and the test_util module. hiddenimports = collect_submodules( 'astroid', lambda name: (not is_module_or_submodule(name, 'astroid.tests')) and (not name == 'test_util'))
""" Hook for cryptography module from the Python Cryptography Authority. """ import os.path import glob from PyInstaller.compat import EXTENSION_SUFFIXES from PyInstaller.utils.hooks import collect_submodules, get_module_file_attribute from PyInstaller.utils.hooks import copy_metadata # get the package data so we can load the backends datas = copy_metadata('cryptography') # Add the backends as hidden imports hiddenimports = collect_submodules('cryptography.hazmat.backends') # Add the OpenSSL FFI binding modules as hidden imports hiddenimports += collect_submodules('cryptography.hazmat.bindings.openssl') + [ '_cffi_backend' ] # 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. binaries = [] cryptography_dir = os.path.dirname(get_module_file_attribute('cryptography')) for ext in EXTENSION_SUFFIXES: ffimods = glob.glob(os.path.join(cryptography_dir, '*_cffi_*%s*' % ext)) for f in ffimods:
from PyInstaller.building.datastruct import Tree from PyInstaller.utils.hooks import collect_submodules, collect_data_files from distutils.sysconfig import get_python_lib import os datas = [ (os.path.join(os.getenv('EYEX_LIB_PATH'), 'Tobii.EyeX.Client.dll'), '.\\'), ('../gazer/assets', './gazer/assets'), ] datas += collect_data_files("skimage.io._plugins") hiddenimports = ['gazer', 'scipy', 'skimage.io', #'skimage.io._plugins', ] hiddenimports += collect_submodules('scipy') #hiddenimports += collect_submodules('skimage.io._plugins')
from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules('shapely.geos')
from PyInstaller.compat import is_win binaries = [] datas = [] hiddenimports = ['zmq.utils.garbage'] # PyZMQ comes with two backends, cython and cffi. Calling collect_submodules() # on zmq.backend seems to trigger attempt at compilation of C extension # module for cffi backend, which will fail if ZeroMQ development files # are not installed on the system. On non-English locales, the resulting # localized error messages may cause UnicodeDecodeError. Collecting each # backend individually, however, does not seem to cause any problems. hiddenimports += ['zmq.backend'] # cython backend hiddenimports += collect_submodules('zmq.backend.cython') # cffi backend: contains extra data that needs to be collected # (e.g., _cdefs.h) # # NOTE: the cffi backend requires compilation of C extension at runtime, # which appears to be broken in frozen program. So avoid collecting # it altogether... if False: from PyInstaller.utils.hooks import collect_data_files hiddenimports += collect_submodules('zmq.backend.cffi') datas += collect_data_files('zmq.backend.cffi', excludes=[ '**/__pycache__', ])
#----------------------------------------------------------------------------- # 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.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('markdown.extensions')
#----------------------------------------------------------------------------- # Copyright (c) 2005-2019, 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.utils.hooks import collect_submodules hiddenimports = collect_submodules('django.template.loaders')
#----------------------------------------------------------------------------- # Copyright (c) 2005-2016, 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.utils.hooks import collect_submodules hiddenimports = collect_submodules('django.contrib.sessions.backends')
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, \ copy_metadata datas = copy_metadata('chaostoolkit-google-cloud-platform', recursive=True) hiddenimports = (collect_submodules('chaosgcp'))
# ----------------------------------------------------------------------------- # Copyright (c) 2013-2019, 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 from PyInstaller.utils.hooks import collect_data_files, collect_submodules from jupyter_core.paths import jupyter_config_path, jupyter_path # collect modules for handlers hiddenimports = collect_submodules( 'notebook', filter=lambda name: name.endswith('.handles')) hiddenimports.append('notebook.services.shutdown') datas = collect_data_files('notebook') # Collect share and etc folder for pre-installed extensions datas += [(path, 'share/jupyter') for path in jupyter_path() if os.path.exists(path)] datas += [(path, 'etc/jupyter') for path in jupyter_config_path() if os.path.exists(path)]
from PyInstaller.utils.hooks import collect_submodules, collect_data_files hiddenimports = collect_submodules('pubsub') # collect_submodules does not find `arg1` or `kwargs` because # they are not packages, just folders without an `__init__.py` # Thus they are invisible to ModuleGraph and must be included as data files pubsub_datas = collect_data_files('pubsub', include_py_files=True) def _match(dst): return "kwargs" in dst or "arg1" in dst datas = [(src, dst) for src, dst in pubsub_datas if _match(dst)]
# https://github.com/pyinstaller/pyinstaller/issues/4400#issuecomment-551147137 from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules('tensorflow_core')
#----------------------------------------------------------------------------- # Copyright (c) 2005-2017, 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. #----------------------------------------------------------------------------- """ Hook for ncclient. ncclient is a Python library that facilitates client-side scripting and application development around the NETCONF protocol. https://pypi.python.org/pypi/ncclient This hook was tested with ncclient 0.4.3. """ from PyInstaller.utils.hooks import collect_submodules # Modules 'ncclient.devices.*' are dynamically loaded and PyInstaller # is not able to find them. hiddenimports = collect_submodules('ncclient.devices')
#----------------------------------------------------------------------------- # Copyright (c) 2018-2019, 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.utils.hooks import collect_submodules # The ``eth_hash.utils.load_backend`` function does a dynamic import. hiddenimports = collect_submodules('eth_hash.backends')
from PyInstaller.utils.hooks import exec_statement, collect_submodules strptime_data_file = exec_statement( "import inspect; import _strptime; print(inspect.getfile(_strptime))") datas = [(strptime_data_file, ".")] hiddenimports = collect_submodules('dateparser')
#----------------------------------------------------------------------------- # Copyright (c) 2005-2019, 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.utils.hooks import collect_submodules hiddenimports = collect_submodules('django.core.cache.backends')
from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules('spacy.lang')
#----------------------------------------------------------------------------- # Copyright (c) 2013-2016, 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.utils.hooks 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-2018, 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.utils.hooks import collect_submodules hiddenimports = collect_submodules('rdflib.plugins')
# ----------------------------------------------------------------------------- # Copyright (c) 2013-2018, 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.utils.hooks import collect_submodules, copy_metadata hiddenimports = collect_submodules('keyrings.alt') # keyring uses entrypoints to read keyring.backends from metadata file entry_points.txt. datas = copy_metadata('keyrings.alt')
#----------------------------------------------------------------------------- # Copyright (c) 2013-2017, 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.utils.hooks import collect_submodules # 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 hiddenimports = collect_submodules('reportlab.pdfbase', lambda name: name.startswith('reportlab.pdfbase._fontdata_'))
from PyInstaller.utils.hooks import collect_submodules, collect_data_files from PyInstaller.utils.hooks import copy_metadata qt = collect_submodules('pyface.qt') ui_qt = collect_submodules('pyface.ui.qt4') hiddenimports = qt + ui_qt datas = collect_data_files('pyface') + copy_metadata('pyface')
# ------------------------------------------------------------------ # Copyright (c) 2020 PyInstaller Development Team. # # This file is distributed under the terms of the GNU General Public # License (version 2.0 or later). # # The full license is available in LICENSE.GPL.txt, distributed with # this software. # # SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------ """ Hook for PyZMQ. Cython based Python bindings for messaging library ZeroMQ. http://www.zeromq.org/ """ from PyInstaller.utils.hooks import collect_submodules, get_module_file_attribute from PyInstaller.compat import is_win hiddenimports = ['zmq.utils.garbage'] + collect_submodules('zmq.backend')
from PyInstaller.utils.hooks import collect_submodules, collect_data_files from PyInstaller.utils.hooks import copy_metadata distutils = collect_submodules('distutils') hiddenimports = distutils datas = collect_data_files('traits') + copy_metadata('traits')
#----------------------------------------------------------------------------- # Copyright (c) 2005-2019, 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. #----------------------------------------------------------------------------- """ PyInstaller hook file for Pygments. Tested with version 2.0.2. """ from PyInstaller.utils.hooks import collect_submodules # The following applies to pygments version 2.0.2, as reported by ``pip show # pygments``. # # From pygments.formatters, line 37:: # # def _load_formatters(module_name): # """Load a formatter (and all others in the module too).""" # mod = __import__(module_name, None, None, ['__all__']) # # Therefore, we need all the modules in ``pygments.formatters``. hiddenimports = collect_submodules('pygments.formatters') hiddenimports.extend(collect_submodules('pygments.lexers')) hiddenimports.extend(collect_submodules('pygments.styles'))
#----------------------------------------------------------------------------- # Copyright (c) 2005-2016, 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. #----------------------------------------------------------------------------- """ PyInstaller hook file for Pygments. Tested with version 2.0.2. """ from PyInstaller.utils.hooks import collect_submodules # The following applies to pygments version 2.0.2, as reported by ``pip show # pygments``. # # From pygments.formatters, line 37:: # # def _load_formatters(module_name): # """Load a formatter (and all others in the module too).""" # mod = __import__(module_name, None, None, ['__all__']) # # Therefore, we need all the modules in ``pygments.formatters``. hiddenimports = collect_submodules('pygments.formatters') hiddenimports.extend(collect_submodules('pygments.lexers')) hiddenimports.extend(collect_submodules('pygments.styles'))
#----------------------------------------------------------------------------- # Copyright (c) 2005-2017, 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.utils.hooks import collect_submodules hiddenimports = collect_submodules('django.core.cache.backends')
import kivy import kivy.deps from kivy.factory import Factory from PyInstaller.depend import bindepend from os import environ if 'KIVY_DOC' not in environ: from PyInstaller.compat import modname_tkinter from PyInstaller.utils.hooks import collect_submodules curdir = dirname(__file__) kivy_modules = [ 'xml.etree.cElementTree', 'kivy.core.gl' ] + collect_submodules('kivy.graphics') '''List of kivy modules that are always needed as hiddenimports of pyinstaller. ''' excludedimports = [modname_tkinter, '_tkinter', 'twisted'] '''List of excludedimports that should always be excluded from pyinstaller. ''' datas = [ (kivy.kivy_data_dir, os.path.join('kivy_install', os.path.basename(kivy.kivy_data_dir))), (kivy.kivy_modules_dir, os.path.join('kivy_install', os.path.basename(kivy.kivy_modules_dir))) ]
from PyInstaller.utils.hooks import collect_submodules, collect_data_files qt = collect_submodules('enable.qt4') trait_defs_ui_qt = collect_submodules('enable.trait_defs.ui.qt4') savage_trait_defs_ui_qt = collect_submodules('enable.savage.trait_defs.ui.qt4') hiddenimports = qt + trait_defs_ui_qt + savage_trait_defs_ui_qt datas = collect_data_files('enable')
# Parsec Cloud (https://parsec.cloud) Copyright (c) AGPLv3 2019 Scille SAS from PyInstaller.utils.hooks import collect_data_files, collect_submodules # Pendulum checks for locale modules via os.path.exists before import. # If the include_py_files option is turned off, this check fails, pendulum # will raise a ValueError. datas = collect_data_files("pendulum.locales", include_py_files=True) hiddenimports = collect_submodules("pendulum.locales")
from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules('uvicorn')
#----------------------------------------------------------------------------- # Copyright (c) 2013-2018, 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.utils.hooks 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')
# 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-sphinx.py - Pyinstaller hook for Sphinx # ******************************************** from PyInstaller.utils.hooks import collect_submodules, collect_data_files, \ eval_statement hiddenimports = ( # Per http://sphinx-doc.org/extensions.html#builtin-sphinx-extensions, # Sphinx extensions are all placed in ``sphinx.ext``. Include these. collect_submodules('sphinx.ext') + # # The following analysis applies to Sphinx v. 1.3.1, reported by "pip show # sphinx". # # From sphinx.application line 429: # # mod = __import__(extension, None, None, ['setup']) # # From sphinx.search line 228: # # lang_class = getattr(__import__(module, None, None, [classname]), # classname) # # From sphinx.search line 119: #
from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules('sklearn')
#----------------------------------------------------------------------------- # Copyright (c) 2005-2017, 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.compat import modname_tkinter from PyInstaller.utils.hooks import collect_submodules # Module django.core.management.commands.shell imports IPython but it # introduces many other dependencies that are not necessary for simple # django project. Ignore then IPython module. excludedimports = ['IPython', 'matplotlib', modname_tkinter] # Django requres management modules for the script 'manage.py'. hiddenimports = collect_submodules('django.core.management.commands')
#----------------------------------------------------------------------------- # Copyright (c) 2005-2018, 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. #----------------------------------------------------------------------------- # This hook was tested with Pillow 2.9.0 (Maintained fork of PIL): # https://pypi.python.org/pypi/Pillow from PyInstaller.utils.hooks import collect_submodules # Include all PIL image plugins - module names containing 'ImagePlugin'. # e.g. PIL.JpegImagePlugin hiddenimports = collect_submodules('PIL', lambda name: 'ImagePlugin' in name)
import glob import kivy import kivy.deps from kivy.factory import Factory from PyInstaller.depend import bindepend from os import environ if 'KIVY_DOC' not in environ: from PyInstaller.compat import modname_tkinter from PyInstaller.utils.hooks import collect_submodules curdir = dirname(__file__) kivy_modules = ['xml.etree.cElementTree', 'kivy.core.gl' ] + collect_submodules('kivy.graphics') '''List of kivy modules that are always needed as hiddenimports of pyinstaller. ''' excludedimports = [modname_tkinter, '_tkinter', 'twisted'] '''List of excludedimports that should always be excluded from pyinstaller. ''' datas = [(kivy.kivy_data_dir, os.path.join('kivy_install', os.path.basename(kivy.kivy_data_dir))), (kivy.kivy_modules_dir, os.path.join('kivy_install', os.path.basename(kivy.kivy_modules_dir)))]
#----------------------------------------------------------------------------- # Copyright (c) 2013-2018, 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. #----------------------------------------------------------------------------- """ Hook for https://pypi.python.org/pypi/jira/ """ from PyInstaller.utils.hooks import copy_metadata, collect_submodules datas = copy_metadata('jira') hiddenimports = collect_submodules('jira')
def get_deps_minimal(exclude_ignored=True, **kwargs): '''Returns Kivy hidden modules as well as excluded modules to be used with ``Analysis``. The function takes core modules as keyword arguments and their value indicates which of the providers to include/exclude from the compiled app. The possible keyword names are ``audio, camera, clipboard, image, spelling, text, video, and window``. Their values can be: ``True``: Include current provider The providers imported when the core module is loaded on this system are added to hidden imports. This is the default if the keyword name is not specified. ``None``: Exclude Don't return this core module at all. ``A string or list of strings``: Providers to include Each string is the name of a provider for this module to be included. For example, ``get_deps_minimal(video=None, window=True, audio=['gstplayer', 'ffpyplayer'], spelling='enchant')`` will exclude all the video providers, will include the gstreamer and ffpyplayer providers for audio, will include the enchant provider for spelling, and will use the current default provider for ``window``. ``exclude_ignored``, if ``True`` (the default), if the value for a core library is ``None``, then if ``exclude_ignored`` is True, not only will the library not be included in the hiddenimports but it'll also added to the excluded imports to prevent it being included accidentally by pyinstaller. :returns: A dict with three keys, ``hiddenimports``, ``excludes``, and ``binaries``. Their values are a list of the corresponding modules to include/exclude. This can be passed directly to `Analysis`` with e.g. :: a = Analysis(['..\\kivy\\examples\\demo\\touchtracer\\main.py'], ... hookspath=hookspath(), runtime_hooks=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, **get_deps_minimal(video=None, audio=None)) ''' core_mods = [ 'audio', 'camera', 'clipboard', 'image', 'spelling', 'text', 'video', 'window' ] mods = kivy_modules[:] excludes = excludedimports[:] for mod_name, val in kwargs.items(): if mod_name not in core_mods: raise KeyError('{} not found in {}'.format(mod_name, core_mods)) full_name = 'kivy.core.{}'.format(mod_name) if not val: core_mods.remove(mod_name) if exclude_ignored: excludes.extend(collect_submodules(full_name)) continue if val is True: continue core_mods.remove(mod_name) mods.append(full_name) single_mod = False if sys.version < '3.0': # Mod name could potentially be any basestring subclass if isinstance(val, basestring): single_mod = True mods.append('kivy.core.{0}.{0}_{1}'.format(mod_name, val)) else: # There is no `basestring` in Py3 if isinstance(val, (str, bytes)): single_mod = True mods.append('kivy.core.{0}.{0}_{1}'.format(mod_name, val)) if not single_mod: for v in val: mods.append('kivy.core.{0}.{0}_{1}'.format(mod_name, v)) for mod_name in core_mods: # process remaining default modules full_name = 'kivy.core.{}'.format(mod_name) mods.append(full_name) m = importlib.import_module(full_name) if mod_name == 'clipboard' and m.CutBuffer: mods.append(m.CutBuffer.__module__) if hasattr(m, mod_name.capitalize()): # e.g. video -> Video val = getattr(m, mod_name.capitalize()) if val: mods.append(getattr(val, '__module__')) if hasattr(m, 'libs_loaded') and m.libs_loaded: for name in m.libs_loaded: mods.append('kivy.core.{}.{}'.format(mod_name, name)) mods = sorted(set(mods)) binaries = [] if any('gstplayer' in m for m in mods): binaries = _find_gst_binaries() elif exclude_ignored: excludes.append('kivy.lib.gstplayer') return { 'hiddenimports': mods, 'excludes': excludes, 'binaries': binaries, }
urlpatterns = urls_module.urlpatterns hid_list = [urls_module.__name__] for pattern in urlpatterns: if isinstance(pattern, RegexURLPattern): hid_list.append(pattern.callback.__module__) elif isinstance(pattern, RegexURLResolver): hid_list += find_url_callbacks(pattern.urlconf_module) return hid_list # Add templatetags and context processors for each installed app. for app in settings.INSTALLED_APPS: app_templatetag_module = app + '.templatetags' app_ctx_proc_module = app + '.context_processors' hiddenimports.append(app_templatetag_module) hiddenimports += collect_submodules(app_templatetag_module) hiddenimports.append(app_ctx_proc_module) from django.core.urlresolvers import RegexURLPattern, RegexURLResolver # Construct base module name - without 'settings' suffix. base_module_name = '.'.join(os.environ['DJANGO_SETTINGS_MODULE'].split('.')[0:-1]) base_module = __import__(base_module_name, {}, {}, ["urls"]) urls = base_module.urls # Find url imports. hiddenimports += find_url_callbacks(urls) # Deduplicate imports.
from PyInstaller.utils.hooks import collect_data_files, collect_submodules hiddenimports = (collect_submodules('chaosk8s'))
#----------------------------------------------------------------------------- # Copyright (c) 2015-2016, 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. #----------------------------------------------------------------------------- # # CherryPy is a minimalist Python web framework. # # http://www.cherrypy.org/ # # Tested with CherryPy 5.0.1 from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules('cherrypy.wsgiserver')
# ------------------------------------------------------------------ # Copyright (c) 2020 PyInstaller Development Team. # # This file is distributed under the terms of the GNU General Public # License (version 2.0 or later). # # The full license is available in LICENSE.GPL.txt, distributed with # this software. # # SPDX-License-Identifier: GPL-2.0-or-later # ------------------------------------------------------------------ from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules('rdflib.plugins')