How to use the macholib.dyld function in macholib

To help you get started, we’ve selected a few macholib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github metachris / py2app / py2app / build_app.py View on Github external
self.includes.add('pkg_resources')
            self.eggs = pkg_resources.require(self.distribution.install_requires)

        # Setuptools/distribute style namespace packages uses
        # __import__('pkg_resources'), and that import isn't detected at the
        # moment. Forcefully include pkg_resources.
        self.includes.add('pkg_resources')

        dylib_excludes = fancy_split(self.dylib_excludes)
        self.dylib_excludes = []
        for fn in dylib_excludes:
            try:
                res = macholib.dyld.framework_find(fn)
            except ValueError:
                try:
                    res = macholib.dyld.dyld_find(fn)
                except ValueError:
                    res = fn
            self.dylib_excludes.append(res)
        self.resources = fancy_split(self.resources)
        frameworks = fancy_split(self.frameworks)
        self.frameworks = []
        for fn in frameworks:
            try:
                res = macholib.dyld.framework_find(fn)
            except ValueError:
                res = macholib.dyld.dyld_find(fn)
            while res in self.dylib_excludes:
                self.dylib_excludes.remove(res)
            self.frameworks.append(res)
        if not self.plist:
            self.plist = {}
github psychopy / psychopy / setupApp.py View on Github external
frameworks = ["libavbin.dylib", "/usr/lib/libxml2.2.dylib", #"libyaml.dylib",
              "libevent.dylib", "libffi.dylib",
              "libmp3lame.0.dylib",
              "/usr/local/Cellar/glfw/3.2.1/lib/libglfw.3.2.dylib",
              ]
opencvLibs = glob.glob(os.path.join(sys.exec_prefix, 'lib', 'libopencv*.2.4.dylib'))
frameworks.extend(opencvLibs)

import macholib
#print("~"*60 + "macholib version: "+macholib.__version__)

if parse_version(macholib.__version__) <= parse_version('1.7'):
    print("Applying macholib patch...")
    import macholib.dyld
    import macholib.MachOGraph
    dyld_find_1_7 = macholib.dyld.dyld_find
    def dyld_find(name, loader=None, **kwargs):
        #print("~"*60 + "calling alternate dyld_find")
        if loader is not None:
            kwargs['loader_path'] = loader
        return dyld_find_1_7(name, **kwargs)
    macholib.MachOGraph.dyld_find = dyld_find

includes = ['Tkinter', 'tkFileDialog',
            'imp', 'subprocess', 'shlex',
            'shelve',  # for scipy.io
            '_elementtree', 'pyexpat',  # for openpyxl
            'hid',
            'pyo', 'greenlet', 'zmq', 'tornado',
            'psutil',  # for iohub
            'tobii_research',  # need tobii_research file and tobiiresearch pkg
            'pysoundcard', 'soundfile', 'sounddevice', 'readline',
github SasView / sasview / installers / macholib_patch.py View on Github external
gives:: 

    TypeError: dyld_find() got an unexpected keyword argument 'loader'

Add the following to the top of your setup_py2app to work around this::

    import macholib_patch
"""

import macholib
#print("~"*60 + "macholib verion: "+macholib.__version__)
if macholib.__version__ <= "1.7":
    print("Applying macholib patch...")
    import macholib.dyld
    import macholib.MachOGraph
    dyld_find_1_7 = macholib.dyld.dyld_find
    def dyld_find(name, loader=None, **kwargs):
        #print("~"*60 + "calling alternate dyld_find")
        if loader is not None:
            kwargs['loader_path'] = loader
        return dyld_find_1_7(name, **kwargs)
    macholib.MachOGraph.dyld_find = dyld_find
github vaexio / vaex / py2app.py View on Github external
def check(self, cmd, graph):
			return dict(packages=["astropy"])
	py2app.recipes.astropy = astropy()
	# see http://stackoverflow.com/questions/31240052/py2app-typeerror-dyld-find-got-an-unexpected-keyword-argument-loader
	"""
	Monkey-patch macholib to fix "dyld_find() got an unexpected keyword argument 'loader'".

	Add 'import macholib_patch' to the top of set_py2app.py
	"""

	import macholib
	if macholib.__version__ <= "1.7":
		print("Applying macholib patch...")
		import macholib.dyld
		import macholib.MachOGraph
		dyld_find_1_7 = macholib.dyld.dyld_find
		def dyld_find(name, loader=None, **kwargs):
			#print("~"*60 + "calling alternate dyld_find")
			if loader is not None:
				kwargs['loader_path'] = loader
			return dyld_find_1_7(name, **kwargs)
		macholib.MachOGraph.dyld_find = dyld_find
#full_name = vaex.__full_name__
cmdclass = {}

if has_py2app and sys.argv[1] == "py2app":
	import vaex.ui
	class my_py2app(py2app.build_app.py2app):
		"""hooks in post script to add in missing libraries and zip the content"""
		def run(self):
			py2app.build_app.py2app.run(self)
			#libQtWebKit.4.dylib
github metachris / py2app / py2app / build_app.py View on Github external
version = sys.version
        version = version[:3]
        info = None
        if os.path.exists(os.path.join(prefix, ".Python")):
            # We're in a virtualenv environment, locate the real prefix
            fn = os.path.join(prefix, "lib", "python%d.%d"%(sys.version_info[:2]), "orig-prefix.txt")
            if os.path.exists(fn):
                with open(fn, 'rU') as fp:
                    prefix = fp.read().strip()

        try:
            fmwk = macholib.dyld.framework_find(prefix)
        except ValueError:
            info = None
        else:
            info = macholib.dyld.framework_info(fmwk)

        if info is not None:
            dylib = info['name']
            runtime = os.path.join(info['location'], info['name'])
        else:
            dylib = 'libpython%s.dylib' % (sys.version[:3],)
            runtime = os.path.join(prefix, 'lib', dylib)

        return dylib, runtime
github metachris / py2app / py2app / build_app.py View on Github external
#       ideally we'd use dylib functions to figure this out
        if prefix is None:
            prefix = sys.prefix
        if version is None:
            version = sys.version
        version = version[:3]
        info = None
        if os.path.exists(os.path.join(prefix, ".Python")):
            # We're in a virtualenv environment, locate the real prefix
            fn = os.path.join(prefix, "lib", "python%d.%d"%(sys.version_info[:2]), "orig-prefix.txt")
            if os.path.exists(fn):
                with open(fn, 'rU') as fp:
                    prefix = fp.read().strip()

        try:
            fmwk = macholib.dyld.framework_find(prefix)
        except ValueError:
            info = None
        else:
            info = macholib.dyld.framework_info(fmwk)

        if info is not None:
            dylib = info['name']
            runtime = os.path.join(info['location'], info['name'])
        else:
            dylib = 'libpython%s.dylib' % (sys.version[:3],)
            runtime = os.path.join(prefix, 'lib', dylib)

        return dylib, runtime
github dorukgezici / iOSAppIconGenerator / py2app / macholib_patch.py View on Github external
"""
Monkey-patch macholib to fix "dyld_find() got an unexpected keyword argument 'loader'".

Add 'import macholib_patch' to the top of set_py2app.py
"""

import macholib
#print("~"*60 + "macholib verion: "+macholib.__version__)
if macholib.__version__ <= "1.7":
    print("Applying macholib patch...")
    import macholib.dyld
    import macholib.MachOGraph
    dyld_find_1_7 = macholib.dyld.dyld_find
    def dyld_find(name, loader=None, **kwargs):
        #print("~"*60 + "calling alternate dyld_find")
        if loader is not None:
            kwargs['loader_path'] = loader
        return dyld_find_1_7(name, **kwargs)
    macholib.MachOGraph.dyld_find = dyld_find
github smathot / OpenSesame / setup-mac.py View on Github external
import sys
import shutil

from setup_shared  import included_plugins, included_extensions
from libopensesame.metadata import __version__ as version, codename

"""
Monkey-patch macholib to fix "dyld_find() got an unexpected keyword argument 'loader'".
"""
import macholib
#print("~"*60 + "macholib verion: "+macholib.__version__)
if macholib.__version__ <= "1.7":
    print("Applying macholib patch...")
    import macholib.dyld
    import macholib.MachOGraph
    dyld_find_1_7 = macholib.dyld.dyld_find
    def dyld_find(name, loader=None, **kwargs):
        #print("~"*60 + "calling alternate dyld_find")
        if loader is not None:
            kwargs['loader_path'] = loader
        return dyld_find_1_7(name, **kwargs)
    macholib.MachOGraph.dyld_find = dyld_find
"""
END Monkey-patch macholib"
"""

# Get the root folder of anaconda
anaconda_path = os.path.dirname(os.path.dirname(sys.executable))

# Clean up previous builds
try:
	shutil.rmtree("dist")