Issues

Issue #69 resolved

extra_scripts does not gather all dependencies

Andrew Barnert
created an issue

Version is 0.7.

If foo.py imports _foo.so, which depends on libfoo.dylib, running py2app on foo.py pulls libfoo.dylib into the package, but running py2app on bar.py with foo.py as an extra_scripts does not.

Comments (7)

  1. Ronald Oussoren repo owner

    That's annoying. I have verified that foo.py and _foo.so get loaded into the bundle, but have to do more work to be able to check that libfoo.dylib gets loaded as well.

    In theory this should have worked in either case, py2app first copies all Python code and extensions into the application bundle and then basicly runs macho_standalone to copy shared libraries. I'm not sure why this doesn't work for extra_scripts, but I'm sure this will get clearer when I've constructed a test case.

  2. Ronald Oussoren repo owner

    Which python do you use, and what build options?

    I can only reproduce this problem with --semi-standalone builds (either by using this option, or by building with a system python), and when I do that the _foo extension doesn't get loaded in the main script as well.

    I've added some code to the app_with_scripts test for reproducding this issue in changeset 155808ea3d40 (in branch branch-0.7) is that the problem you are describing?

    To run that test:

    • Install py2app
    • cd py2app_tests
    • python test_app_with_scripts

    To manually check the app:

    • cd py2app_tests/app_with_scripts
    • python presetup.py build
    • python setup.py py2app

    The generated application contains two helper scripts: helper1 and helper2, the "script" helper2 loads extension "foo" and that extension uses libfoo.dylib. The dylib is created using script presetup.py.

    This works for me unless I use '--semi-standalone', when I do that sys.path is incomplete (the extension is in the app bundle, but the lib-dynload directory is not on sys.path).

    BTW. I'll push out 0.7.1 when this issue is fixed.

  3. Andrew Barnert reporter

    Sorry; on further research, I was a bit confused here.

    The semi-standalone problem is in fact what I was running into when I was trying to make a stripped-down example.

    But it has nothing to do with my actual problem, which is a bug in my code. (When built as a separate app, it works on the build machine, but not elsewhere; when built in as an --extra-scripts script, it doesn't even work on the build machine. That's not a problem with py2app, it just exposed my bug.)

    Let me fix my code and make sure it works both ways, but I think it will.

  4. Log in to comment