[Eric] Eric4 as standalone app on Mac with py2app

Michael Hirschfeld industrie13 at gmx.net
Tue Feb 2 20:17:18 GMT 2010


Hi Larry,

thanks for the detailed help.
Altough Eric worked so far with the install order on the webpage I wanted to build it the right way and started from zero again. This time I used, like recommended, the qt-mac-opensource-4.6.1.dmg, but this seems to cause trouble, at least when it comes to PyQt4, complaining about Qt4 not being 64bit:

In file included from /Library/Frameworks/QtCore.framework/Headers/qmetatype.h:45,
                 from /Library/Frameworks/QtCore.framework/Headers/QMetaType:1,
                 from sipAPIQtCore.h:40,
                 from sipQtCorecmodule.cpp:34:
/Library/Frameworks/QtCore.framework/Headers/qglobal.h:288:2: error: #error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration."
make[1]: *** [sipQtCorecmodule.o] Error 1
make: *** [all] Error 2

So could it be, that the cocoa-package is the only viable option under 10.6 since 64bit is default here, or is it recommended to force PyQt to build in 32bit? 





Am 27.01.2010 um 01:48 schrieb Larry Shaffer:

> Hi Michael,
> 
> The install order is incorrect on the web page you noted. It should be (as
> per eric4 README), or you might not get all of the completion.api files -
> though the page's order may work:
> 
>> If the required packages (Qt4, QScintilla2, sip and PyQt4) are not installed,
>> please get them and install them in the following order (order is important).
>> 
>> 1. Install Qt4
>> 
>> 2. Build and install sip
>> 
>> 3. Build and install QScintilla2
>> 
>> 4. Build and install PyQt4
>> 
>> 5. Build and install QScintilla2 Python bindings
>> 
>> 6. Install eric4
> 
> The page links to a snapshot version of Qt 4.5.x that has a bug that keeps
> the fonts styles in eric4 from being assigned on a Mac, but I see you are
> using 4.6 anyhow. Using the qt-mac-cocoa-opensource-4.6.x.dmg download
> caused some big issues with eric4. Make sure to use the
> qt-mac-opensource-4.6.x.dmg.
> 
> I think eric4 may be too complex for py2app to create a standalone
> executable, but I might give it a try this weekend. py2app issues might best
> be directed to py2app's support. PyInstaller may be able to do a standalone
> of eric4 with it's next version ('full' Mac and PyQt support soon?):
> 
> http://www.pyinstaller.org/roadmap
> 
> In the meantime, I made a convenience AppleScript application to help with
> this (open in Script Editor and save as application bundle and put in Dock):
> 
> tell application "Terminal"
>    set resultTab to do script "/usr/local/bin/eric4"
> end tell
> 
> tell application "System Events"
>    repeat 15 times
>        if name of application processes contains "Python" then
>            delay 1
>            if frontmost of application process "Python" is not true then
>                set frontmost of application process "Python" to true
>                exit repeat
>            end if
>        end if
>    end repeat
> end tell
> 
> Also available as app at:
> 
> http://dl.dropbox.com/u/4058089/eric4/Launch-Eric4.app.zip
> 
> This launches eric4 and brings it to the front, sometimes doesn't bring to
> front on first launch. Eric4 will show up as a separate python app in dock.
> Having Terminal open is very useful for debugging any problem with eric4
> while it's running. You can tell System Events to make the visible attribute
> of Terminal false to hide Terminal on launch, if you want:
> 
> (Add the following after repeat block in System Events block in above
> script)
> 
> set visible of application process "Terminal" to false
> 
> Eric4 (and the script) do not support drag and drop of files for loading
> into eric4, but eric4's main window does. The launch script could be set up
> to accept drops for loading, however, but this would load into a new
> instance of eric4, not the running one.
> 
> -- 
> Larry
> 
> 
>> From: Michael Hirschfeld <industrie13 at gmx.net>
>> Date: Tue, 26 Jan 2010 20:28:52 +0100
>> To: <eric at riverbankcomputing.com>
>> Subject: [Eric] Eric4 as standalone app on Mac with py2app
>> 
>> Hi,
>> 
>> I successfully installed Eric 4.4.0 on my Mac, running Snow Leopard with stock
>> python (Qt 4.6, Sip 4.10, PyQt 4.7, QScintilla 2.4.2) using this
>> http://works13.com/blog/mac/installing-eric4-on-mac-os-x-leopard.htm little
>> HowTo.
>> 
>> However, since I don't find it very convenient to open Eric every time via
>> Terminal and have to let this one open too, I tried to build a standalone app
>> of it with py2app. This is where I get in trouble and would be glad to get any
>> hints.
>> 
>> What did I do?
>> 
>> Eric is installed in /Library/Python/2.6/site-packages/eric4, so I placed a
>> 'setup.py' inside this directory and did a
>> sudo python setup.py py2app
>> 
>> All I get, is an empty build directory and a error.
>> 
>> 
>> My setup.py:
>> ------------------------------------
>> """
>> This is a setup.py script generated by py2applet
>> 
>> Usage:
>>   python setup.py py2app
>> """
>> 
>> from setuptools import setup
>> 
>> APP = ['eric4.py']
>> DATA_FILES = []
>> OPTIONS = {'argv_emulation': True,
>> 'semi_standalone':'False',
>> 'includes': 'Qt4,sip,PyQt4,QScintilla2',
>> 'packages':('Qt4','sip','PyQt4','QScintilla2'),
>> 'site_packages': 'True'}
>> 
>> setup(
>>   app=APP,
>>   data_files=DATA_FILES,
>>   options={'py2app': OPTIONS},
>>   setup_requires=['py2app'],
>> )
>> 
>> 
>> ------------------------------------
>> Terminal output:
>> 
>> eugenie:eric4 industrie13$ sudo python setup.py py2app
>> Password:
>> running py2app
>> Traceback (most recent call last):
>>  File 
>> "/Library/Python/2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py"
>> , line 589, in _run
>>    self.run_normal()
>>  File 
>> "/Library/Python/2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py"
>> , line 641, in run_normal
>>    mf = self.get_modulefinder()
>>  File 
>> "/Library/Python/2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py"
>> , line 549, in get_modulefinder
>>    debug=debug,
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/find_modules.py",
>> line 255, in find_modules
>>    find_needed_modules(mf, scripts, includes, packages)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/find_modules.py",
>> line 176, in find_needed_modules
>>    mf.run_script(path)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 389, in run_script
>>    self.scan_code(co, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 658, in scan_code
>>    self.scan_code(c, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 630, in scan_code
>>    self._safe_import_hook(name, m, fromlist)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 560, in _safe_import_hook
>>    mods = self.import_hook(name, caller)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 401, in import_hook
>>    m = self.load_tail(q, tail)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 461, in load_tail
>>    m = self.import_module(head, mname, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 518, in import_module
>>    m = self.load_module(fqname, fp, pathname, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 553, in load_module
>>    self.scan_code(co, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 630, in scan_code
>>    self._safe_import_hook(name, m, fromlist)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 560, in _safe_import_hook
>>    mods = self.import_hook(name, caller)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 401, in import_hook
>>    m = self.load_tail(q, tail)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 461, in load_tail
>>    m = self.import_module(head, mname, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 518, in import_module
>>    m = self.load_module(fqname, fp, pathname, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 553, in load_module
>>    self.scan_code(co, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 630, in scan_code
>>    self._safe_import_hook(name, m, fromlist)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 560, in _safe_import_hook
>>    mods = self.import_hook(name, caller)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 401, in import_hook
>>    m = self.load_tail(q, tail)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 461, in load_tail
>>    m = self.import_module(head, mname, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 518, in import_module
>>    m = self.load_module(fqname, fp, pathname, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 553, in load_module
>>    self.scan_code(co, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 658, in scan_code
>>    self.scan_code(c, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 630, in scan_code
>>    self._safe_import_hook(name, m, fromlist)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 560, in _safe_import_hook
>>    mods = self.import_hook(name, caller)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 401, in import_hook
>>    m = self.load_tail(q, tail)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 461, in load_tail
>>    m = self.import_module(head, mname, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 518, in import_module
>>    m = self.load_module(fqname, fp, pathname, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 528, in load_module
>>    m = self.load_package(fqname, pathname)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 678, in load_package
>>    self.load_module(fqname, fp, buf, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 553, in load_module
>>    self.scan_code(co, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 630, in scan_code
>>    self._safe_import_hook(name, m, fromlist)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 584, in _safe_import_hook
>>    sm = self.import_hook(name, caller, [sub])
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 404, in import_hook
>>    modules.update(self.ensure_fromlist(m, fromlist))
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 478, in ensure_fromlist
>>    submod = self.import_module(sub, fullname, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 518, in import_module
>>    m = self.load_module(fqname, fp, pathname, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 553, in load_module
>>    self.scan_code(co, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 630, in scan_code
>>    self._safe_import_hook(name, m, fromlist)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 584, in _safe_import_hook
>>    sm = self.import_hook(name, caller, [sub])
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 404, in import_hook
>>    modules.update(self.ensure_fromlist(m, fromlist))
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 478, in ensure_fromlist
>>    submod = self.import_module(sub, fullname, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 518, in import_module
>>    m = self.load_module(fqname, fp, pathname, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 553, in load_module
>>    self.scan_code(co, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 630, in scan_code
>>    self._safe_import_hook(name, m, fromlist)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 560, in _safe_import_hook
>>    mods = self.import_hook(name, caller)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 401, in import_hook
>>    m = self.load_tail(q, tail)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 461, in load_tail
>>    m = self.import_module(head, mname, m)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 518, in import_module
>>    m = self.load_module(fqname, fp, pathname, stuff)
>>  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py",
>> line 532, in load_module
>>    co = compile(fp.read() + '\n', pathname, 'exec')
>>  File "/Library/Python/2.6/site-packages/PyQt4/uic/port_v3/proxy_base.py",
>> line 4
>>     class ProxyBase(metaclass=ProxyType):
>>                              ^
>> SyntaxError: invalid syntax
>>> /Users/industrie13/Downloads/site-packages/eric4/build/bdist.macosx-10.6-univ
>>> ersal/egg/modulegraph/modulegraph.py(532)load_module()
>> (Pdb) 
>> 
>> 
>> ------------------------------------
>> 
>> Any hints or tips?
>> Did anyone from this list managed to build Eric as a standalone app on Mac?
>> And if yes, how did you do?
>> 
>> 
>> Michael
>> 
>> 
>> _______________________________________________
>> Eric mailing list
>> Eric at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/eric
>> 
> 



More information about the Eric mailing list