Next Safari Browser written in Python?
Friday, October 28th, 2005Go to http://nightly.webkit.org/builds/ and download WebKit++SVG, then do this:
$ cat /Volumes/WebKit+SVG/WebKit+SVG.app/Contents/Resources/main.py
#!/usr/bin/env python
import os, sys
from Foundation import NSBundle
from LaunchServices.Launch import LSFindApplicationForInfo
from Carbon.CoreFoundation import kCFURLPOSIXPathStyle
kLSUnknownCreator = '\x00\x00\x00\x00'
def pathForName(appName):
"""
Returns the file system path for an application by name.
NOTE: You should include the suffix, as in "Python.app".
"""
fsRef, cfURL = LSFindApplicationForInfo(kLSUnknownCreator, None, appName)
return cfURL.CFURLCopyFileSystemPath(kCFURLPOSIXPathStyle).toPython()
frameworkPath = NSBundle.mainBundle().resourcePath().encode('utf8')
safariPath = pathForName('Safari.app')
if safariPath:
safariPath = NSBundle.bundleWithPath_(safariPath).executablePath()
os.environ['DYLD_FRAMEWORK_PATH'] = frameworkPath
os.environ['WEBKIT_UNSET_DYLD_FRAMEWORK_PATH'] = 'YES'
os.execve(safariPath, [safariPath] + sys.argv[1:], {'DYLD_FRAMEWORK_PATH': frameworkPath, 'WEBKIT_UNSET_DYLD_FRAMEWORK_PATH': 'YES'})
So the nightly builds are coded in Python ;-)





