a
    {b&                  q   @   sb  d dl Z d dlZd dlmZmZmZ ddlmZ zd dlm	Z	 W n   dZ	Y n0 dd Z
dd	 Zed
dddddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdyoZed}i eZd{d| ZdS )~    N)dprint	autoclassObjcException   )enum)callc                 K   sh   | dd}|sLtjtjtd}tj|dd}ttj||  n
t|  td	|  dS )aU   Function for loading dynamic library with ctypes

    Args:
        path: Path to user defined library
        abs_path: If setted to True, pyobjus will load library with absolute path provided by user -> path arg
        Otherwise it will look in /objc_usr_classes dir, which is in pyobjus root dir

    Note:
        Work in progress
    usr_pathTz..Zobjc_classestestzDynamic library {0} loadedN)
getospathjoindirname__file__ctypesCDLLr   format)r   kwargsr   Zroot_pyobjusZobjc_test_dir r   e/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/pyobjus/dylib_manager.py
load_dylib   s    
r   c                 K   s   | dd}| dd}| dd}|sBdtj| d dg}d| d	|d
g}|dur`|| }|r|D ]}|d || qht| dS )z Function for making .dylib from some .m file

    Args:
        path: Path to some .m file which we want to convert to .dylib

    Note:
        Work in progress
    
frameworksNoutoptions.r   Zdylibclangz-oz-dynamiclibz
-framework)r
   r   r   r   splitextappendr   )r   r   r   r   Zadditional_optsarg_list	frameworkr   r   r   
make_dylib"   s    	
r    z//System/Library/Frameworks/Accelerate.frameworkz-/System/Library/Frameworks/Accounts.frameworkz0/System/Library/Frameworks/AddressBook.frameworkz(/System/Library/Frameworks/AGL.frameworkz+/System/Library/Frameworks/AppKit.frameworkz4/System/Library/Frameworks/AppKitScripting.frameworkz3/System/Library/Frameworks/AppleScriptKit.frameworkz4/System/Library/Frameworks/AppleScriptObjC.frameworkz9/System/Library/Frameworks/AppleShareClientCore.frameworkz./System/Library/Frameworks/AppleTalk.frameworkz8/System/Library/Frameworks/ApplicationServices.frameworkz1/System/Library/Frameworks/AudioToolbox.frameworkz./System/Library/Frameworks/AudioUnit.frameworkz7/System/Library/Frameworks/AudioVideoBridging.frameworkz./System/Library/Frameworks/Automator.frameworkz1/System/Library/Frameworks/AVFoundation.frameworkz2/System/Library/Frameworks/CalendarStore.frameworkz+/System/Library/Frameworks/Carbon.frameworkz./System/Library/Frameworks/CFNetwork.frameworkz*/System/Library/Frameworks/Cocoa.frameworkz2/System/Library/Frameworks/Collaboration.frameworkz./System/Library/Frameworks/CoreAudio.frameworkz1/System/Library/Frameworks/CoreAudioKit.frameworkz-/System/Library/Frameworks/CoreData.frameworkz3/System/Library/Frameworks/CoreFoundation.frameworkz1/System/Library/Frameworks/CoreGraphics.frameworkz1/System/Library/Frameworks/CoreLocation.frameworkz./System/Library/Frameworks/CoreMedia.frameworkz0/System/Library/Frameworks/CoreMediaIO.frameworkz-/System/Library/Frameworks/CoreMIDI.frameworkz3/System/Library/Frameworks/CoreMIDIServer.frameworkz1/System/Library/Frameworks/CoreServices.frameworkz-/System/Library/Frameworks/CoreText.frameworkz./System/Library/Frameworks/CoreVideo.frameworkz-/System/Library/Frameworks/CoreWiFi.frameworkz-/System/Library/Frameworks/CoreWLAN.frameworkz5/System/Library/Frameworks/DirectoryService.frameworkz2/System/Library/Frameworks/DiscRecording.frameworkz4/System/Library/Frameworks/DiscRecordingUI.frameworkz4/System/Library/Frameworks/DiskArbitration.frameworkz1/System/Library/Frameworks/DrawSprocket.frameworkz4/System/Library/Frameworks/DVComponentGlue.frameworkz0/System/Library/Frameworks/DVDPlayback.frameworkz-/System/Library/Frameworks/EventKit.frameworkz6/System/Library/Frameworks/ExceptionHandling.frameworkz2/System/Library/Frameworks/ForceFeedback.frameworkz//System/Library/Frameworks/Foundation.frameworkz//System/Library/Frameworks/FWAUserLib.frameworkz,/System/Library/Frameworks/GameKit.frameworkz*/System/Library/Frameworks/GLKit.frameworkz)/System/Library/Frameworks/GLUT.frameworkz(/System/Library/Frameworks/GSS.frameworkz//System/Library/Frameworks/ICADevices.frameworkz5/System/Library/Frameworks/ImageCaptureCore.frameworkz,/System/Library/Frameworks/ImageIO.frameworkz4/System/Library/Frameworks/IMServicePlugIn.frameworkz3/System/Library/Frameworks/InputMethodKit.frameworkz5/System/Library/Frameworks/InstallerPlugins.frameworkz3/System/Library/Frameworks/InstantMessage.frameworkz0/System/Library/Frameworks/IOBluetooth.frameworkz2/System/Library/Frameworks/IOBluetoothUI.frameworkz*/System/Library/Frameworks/IOKit.frameworkz./System/Library/Frameworks/IOSurface.frameworkz7/System/Library/Frameworks/JavaFrameEmbedding.frameworkz3/System/Library/Frameworks/JavaScriptCore.frameworkz+/System/Library/Frameworks/JavaVM.frameworkz-/System/Library/Frameworks/Kerberos.frameworkz+/System/Library/Frameworks/Kernel.frameworkz:/System/Library/Frameworks/LatentSemanticMapping.frameworkz)/System/Library/Frameworks/LDAP.frameworkz1/System/Library/Frameworks/MediaToolbox.frameworkz,/System/Library/Frameworks/Message.frameworkz*/System/Library/Frameworks/NetFS.frameworkz+/System/Library/Frameworks/OpenAL.frameworkz+/System/Library/Frameworks/OpenCL.frameworkz2/System/Library/Frameworks/OpenDirectory.frameworkz+/System/Library/Frameworks/OpenGL.frameworkz+/System/Library/Frameworks/OSAKit.frameworkz)/System/Library/Frameworks/PCSC.frameworkz4/System/Library/Frameworks/PreferencePanes.frameworkz+/System/Library/Frameworks/PubSub.frameworkz+/System/Library/Frameworks/Python.frameworkz*/System/Library/Frameworks/QTKit.frameworkz+/System/Library/Frameworks/Quartz.frameworkz//System/Library/Frameworks/QuartzCore.frameworkz./System/Library/Frameworks/QuickLook.frameworkz./System/Library/Frameworks/QuickTime.frameworkz)/System/Library/Frameworks/Ruby.frameworkz./System/Library/Frameworks/RubyCocoa.frameworkz-/System/Library/Frameworks/SceneKit.frameworkz0/System/Library/Frameworks/ScreenSaver.frameworkz./System/Library/Frameworks/Scripting.frameworkz4/System/Library/Frameworks/ScriptingBridge.frameworkz-/System/Library/Frameworks/Security.frameworkz7/System/Library/Frameworks/SecurityFoundation.frameworkz6/System/Library/Frameworks/SecurityInterface.frameworkz7/System/Library/Frameworks/ServerNotification.frameworkz6/System/Library/Frameworks/ServiceManagement.frameworkz+/System/Library/Frameworks/Social.frameworkz-/System/Library/Frameworks/StoreKit.frameworkz1/System/Library/Frameworks/SyncServices.frameworkz+/System/Library/Frameworks/System.frameworkz8/System/Library/Frameworks/SystemConfiguration.frameworkz(/System/Library/Frameworks/Tcl.frameworkz'/System/Library/Frameworks/Tk.frameworkz*/System/Library/Frameworks/TWAIN.frameworkz+/System/Library/Frameworks/vecLib.frameworkz</System/Library/Frameworks/VideoDecodeAcceleration.frameworkz1/System/Library/Frameworks/VideoToolbox.frameworkz+/System/Library/Frameworks/WebKit.frameworkz4/System/Library/Frameworks/XgridFoundation.framework)oZ
AccelerateZAccountsZAddressBookZAGLZAppKitZAppKitScriptingZAppleScriptKitZAppleScriptObjCZAppleShareClientCoreZ	AppleTalkZApplicationServicesZAudioToolboxZ	AudioUnitZAudioVideoBridgingZ	AutomatorZAVFoundationZCalendarStoreZCarbonZ	CFNetworkZCocoaZCollaborationZ	CoreAudioZCoreAudioKitZCoreDataZCoreFoundationZCoreGraphicsZCoreLocationZ	CoreMediaZCoreMediaIOZCoreMIDIZCoreMIDIServerZCoreServicesZCoreTextZ	CoreVideoZCoreWiFiZCoreWLANZDirectoryServiceZDiscRecordingZDiscRecordingUIZDiskArbitrationZDrawSprocketZDVComponentGlueZDVDPlaybackZEventKitZExceptionHandlingZForceFeedbackZ
FoundationZ
FWAUserLibZGameKitZGLKitZGLUTZGSSZ
ICADevicesZImageCaptureCoreZImageIOZIMServicePlugInZInputMethodKitZInstallerPluginsZInstantMessageZIOBluetoothZIOBluetoothUIZIOKitZ	IOSurfaceZJavaFrameEmbeddingZJavaScriptCoreZJavaVMZKerberosZKernelZLatentSemanticMappingZLDAPZMediaToolboxMessageZNetFSZOpenALZOpenCLZOpenDirectoryZOpenGLZOSAKitZPCSCZPreferencePanesZPubSubPythonZQTKitZQuartzZ
QuartzCoreZ	QuickLookZ	QuickTimeZRubyZ	RubyCocoaZSceneKitZScreenSaverZ	ScriptingZScriptingBridgeZSecurityZSecurityFoundationZSecurityInterfaceZServerNotificationZServiceManagementZSocialZStoreKitZSyncServicesSystemZSystemConfigurationZTclZTkZTWAINZvecLibZVideoDecodeAccelerationZVideoToolboxZWebKitZXgridFoundationpyobjus_includec                 C   sZ   t d}t d| }||}z| r8td|  W n   td| Y n0 dS )z Function for loading frameworks

    Args:
        framework: Framework to load

    Raises:
        ObjcException if it can't load framework
    NSBundleZNSStringz"Framework {0} succesufully loaded!z!Error while loading {0} frameworkN)r   ZstringWithUTF8String_ZbundleWithPath_loadr   r   r   )r   r%   Zns_frameworkZbundler   r   r   load_framework   s    	
r'   )r$   )r   r   Zpyobjusr   r   r   Zobjc_py_typesr   
subprocessr   r   r    dictr   ZINCLUDEr'   r   r   r   r   <module>   s   
r