Ejemplo n.º 1
0
def leak():
    # taken from platform._mac_ver_lookup()
    from gestalt import gestalt
    import MacOS

    try:
        gestalt('sysu')
    except MacOS.Error:
        pass
Ejemplo n.º 2
0
def main():
    # Check for -n option
    if len(sys.argv) > 1 and sys.argv[1] == '-n':
        do_apply = False
    else:
        do_apply = True
    # First check OS version
    if gestalt.gestalt('sysv') < 0x1030:
        print 'fixapplepython23: no fix needed on MacOSX < 10.3'
        sys.exit(0)
    # Test that a framework Python is indeed installed
    if not os.path.exists(MAKEFILE):
        print 'fixapplepython23: Python framework does not appear to be installed (?), nothing fixed'
        sys.exit(0)
    # Check that we can actually write the file
    if do_apply and not os.access(MAKEFILE, os.W_OK):
        print 'fixapplepython23: No write permission, please run with "sudo"'
        sys.exit(2)
    # Create the shell scripts
    if do_apply:
        if not os.access(GCC_SCRIPT, os.X_OK):
            makescript(GCC_SCRIPT, "gcc")
        if not os.access(GXX_SCRIPT, os.X_OK):
            makescript(GXX_SCRIPT, "g++")
    #  Finally fix the makefile
    rv = fix(MAKEFILE, do_apply)
    sys.exit(rv)
def main():
    # Check for -n option
    if len(sys.argv) > 1 and sys.argv[1] == '-n':
        do_apply = False
    else:
        do_apply = True
    # First check OS version
    if gestalt.gestalt('sysv') < 0x1030:
        print 'fixapplepython23: no fix needed on MacOSX < 10.3'
        sys.exit(0)
    # Test that a framework Python is indeed installed
    if not os.path.exists(MAKEFILE):
        print 'fixapplepython23: Python framework does not appear to be installed (?), nothing fixed'
        sys.exit(0)
    # Check that we can actually write the file
    if do_apply and not os.access(MAKEFILE, os.W_OK):
        print 'fixapplepython23: No write permission, please run with "sudo"'
        sys.exit(2)
    # Create the shell scripts
    if do_apply:
        if not os.access(GCC_SCRIPT, os.X_OK):
            makescript(GCC_SCRIPT, "gcc")
        if not os.access(GXX_SCRIPT, os.X_OK):
            makescript(GXX_SCRIPT, "g++")
    #  Finally fix the makefile
    rv = fix(MAKEFILE, do_apply)
    sys.exit(rv)
Ejemplo n.º 4
0
def _mac_ver_lookup(selectors,default=None):

    from gestalt import gestalt
    l = []
    append = l.append
    for selector in selectors:
        try:
            append(gestalt(selector))
        except RuntimeError:
            append(default)
    return l
Ejemplo n.º 5
0
def _mac_ver_lookup(selectors, default=None):

    from gestalt import gestalt
    l = []
    append = l.append
    for selector in selectors:
        try:
            append(gestalt(selector))
        except RuntimeError:
            append(default)
    return l
Ejemplo n.º 6
0
 def _get_macos_ver_info_from_gestalt(self):
     import gestalt
     import MacOS
     try:
         sysv = gestalt.gestalt("sysv")
     except MacOS.Error, ex:
         # On Mac OS X/Intel (at least on the early release dev
         # boxes) the Gestalt Manager does not seem to be intialized
         # with the standard selectors -- or the equivalent.
         # Requesting information on "sysv", "sysu", etc. all return:
         #   gestaltUndefSelectorErr (-5551)
         #   Specifies an undefined selector was passed to the
         #   Gestalt Manager.
         pass
Ejemplo n.º 7
0
 def _get_macos_ver_info_from_gestalt(self):
     import gestalt
     import MacOS
     try:
         sysv = gestalt.gestalt("sysv")
     except MacOS.Error, ex:
         # On Mac OS X/Intel (at least on the early release dev
         # boxes) the Gestalt Manager does not seem to be intialized
         # with the standard selectors -- or the equivalent.
         # Requesting information on "sysv", "sysu", etc. all return:
         #   gestaltUndefSelectorErr (-5551)
         #   Specifies an undefined selector was passed to the
         #   Gestalt Manager.
         pass
Ejemplo n.º 8
0
 def _get_macos_ver_info_from_gestalt(self):
     import gestalt
     import MacOS
     try:
         sysv = gestalt.gestalt("sysv")
     except MacOS.Error:
         # On Mac OS X/Intel (at least on the early release dev
         # boxes) the Gestalt Manager does not seem to be intialized
         # with the standard selectors -- or the equivalent.
         # Requesting information on "sysv", "sysu", etc. all return:
         #   gestaltUndefSelectorErr (-5551)
         #   Specifies an undefined selector was passed to the
         #   Gestalt Manager.
         pass
     else:
         def bcd2int(bcd): return int(hex(bcd)[2:])
         major = bcd2int((sysv & 0xFF00) >> 8)
         minor = (sysv & 0x00F0) >> 4
         patch = (sysv & 0x000F)
         return {
             "os_ver": "%d.%d.%d" % (major, minor, patch),
         }
Ejemplo n.º 9
0
DEFAULT_MODE = RTLD_LOCAL
if _os.name == "posix" and _sys.platform == "darwin":
    import gestalt

    # gestalt.gestalt("sysv") returns the version number of the
    # currently active system file as BCD.
    # On OS X 10.4.6 -> 0x1046
    # On OS X 10.2.8 -> 0x1028
    # See also http://www.rgaros.nl/gestalt/
    #
    # On OS X 10.3, we use RTLD_GLOBAL as default mode
    # because RTLD_LOCAL does not work at least on some
    # libraries.

    if gestalt.gestalt("sysv") < 0x1040:
        DEFAULT_MODE = RTLD_GLOBAL

from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \
     FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI

"""
WINOLEAPI -> HRESULT
WINOLEAPI_(type)

STDMETHODCALLTYPE

STDMETHOD(name)
STDMETHOD_(type, name)

STDAPICALLTYPE
Ejemplo n.º 10
0
DEFAULT_MODE = RTLD_LOCAL
if _os.name == "posix" and _sys.platform == "darwin":
    import gestalt

    # gestalt.gestalt("sysv") returns the version number of the
    # currently active system file as BCD.
    # On OS X 10.4.6 -> 0x1046
    # On OS X 10.2.8 -> 0x1028
    # See also http://www.rgaros.nl/gestalt/
    #
    # On OS X 10.3, we use RTLD_GLOBAL as default mode
    # because RTLD_LOCAL does not work at least on some
    # libraries.

    if gestalt.gestalt("sysv") < 0x1040:
        DEFAULT_MODE = RTLD_GLOBAL

from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \
     FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI
"""
WINOLEAPI -> HRESULT
WINOLEAPI_(type)

STDMETHODCALLTYPE

STDMETHOD(name)
STDMETHOD_(type, name)

STDAPICALLTYPE
"""
Ejemplo n.º 11
0
import sys
from support import TestSkipped

REPS = 65580

#XXX: Is there a way around the method length limit in Jython?
if sys.platform.startswith('java'):
    raise TestSkipped('The 65535 byte limit on methods in the JVM is a problem for jython.')

if sys.platform == 'mac':
    import gestalt
    if gestalt.gestalt('sysv') > 0x9ff:
        raise TestSkipped('Triggers pathological malloc slowdown on OSX MacPython')

l = eval("[" + "2," * REPS + "]")
print(len(l))
Ejemplo n.º 12
0
    import logging  # socketIO_client uses this to log
    #logging.basicConfig(level=logging.DEBUG)
    logging.basicConfig()
    #from socketIO_client import SocketIO, BaseNamespace

    import os
    import re
    import signal
    import socket
    import codecs
    import requests
    import subprocess

    #signal.signal(signal.SIGCHLD, signalHandler)
    signal.signal(signal.SIGINT, signalHandler)

    from gestalt import gestalt
    osxver = gestalt('sysv')
    print 'OSX version =', hex(osxver)
    if osxver > 0x1080:
        print 'creating event tap to catch media keys'
        createEventTap()
    else:
        print 'OSX < 10.8, skipping event tap'

    #app.run()  # can't use AppHelper.stopEventLoop() to exit if we do this
    AppHelper.runEventLoop()

    #pool.release()
Ejemplo n.º 13
0
def runningOnOSX():
    from gestalt import gestalt
    gestaltMenuMgrAquaLayoutBit = 1  # menus have the Aqua 1.0 layout
    gestaltMenuMgrAquaLayoutMask = (1L << gestaltMenuMgrAquaLayoutBit)
    value = gestalt("menu") & gestaltMenuMgrAquaLayoutMask
    return not not value
Ejemplo n.º 14
0
# This python script creates Finder aliases for all the
Ejemplo n.º 15
0
# This python script creates Finder aliases for all the
Ejemplo n.º 16
0
import sys
from test_support import TestSkipped

REPS = 65580

#XXX: Is there a way around the method length limit in Jython?
if sys.platform.startswith('java'):
    raise TestSkipped, 'The 65535 byte limit on methods in the JVM is a problem for jython.'

if sys.platform == 'mac':
    import gestalt
    if gestalt.gestalt('sysv') > 0x9ff:
        raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython'

l = eval("[" + "2," * REPS + "]")
print len(l)
Ejemplo n.º 17
0
def runningOnOSX():
    from gestalt import gestalt
    gestaltMenuMgrAquaLayoutBit = 1  # menus have the Aqua 1.0 layout
    gestaltMenuMgrAquaLayoutMask = (1L << gestaltMenuMgrAquaLayoutBit)
    value = gestalt("menu") & gestaltMenuMgrAquaLayoutMask
    return not not value