On 23 July 2013 07:27, Robert Schilling <[email protected]> wrote:

> I'm trying to bundle a large scale python application using cx_freeze.
> My applycation has a similar layout as the folllowing (more complex):
>
>     src
>         setup.py
>         main.py
>         version.py
>         control
>           __init__.py
>           controller1.py
>           controller2.py
>         lib
>            __init__.py
>           lib1
>              __init__py
>              lib1_1.py
>              lib1_2.py
>           lib2
>             __init__.py
>             lib2_1.py
>             lib2_2.py
>         ui
>           __init__.py
>           widget1.py
>           widget2.py
>         tools
>             tool1.exe
>
> Currently I use releative imports. For example if I want to include a
> `widget1` in `controller1` I write
>
> from src.ui.widget1 import Widget1 # Assumung the class named this inside
>
> But this doesn't work yet with `cx_freeze`. Consider following `setup.py`
>
>
>     import sys
>     from cx_Freeze import setup, Executable
>
>     exe = Executable(
>         script="main.py",
>         base="Win32GUI"
>     )
>
>     includefiles = ["re", "sip", "PyQt4.QtCore", "src.ui.widet",
> "src.version"]
>
>     setup(
>         name = "MyApp",
>         version = "1.0",
>         description = "MyApp.",
>         executables = [exe],
>         options = {"build_exe": {"includes":includes, "include_files":
> includefiles}},
>     )
>
> How do I get track of the absolute imports?
>
> Thank you in advance!
> Regards Robert
>
>
This import structure does work with cx_Freeze, it's how I'm currently
doing it so it's probably something in your setup script.

I don't have a lot of experience with cx_Freeze, but I think you want to
pass the list of python modules to includes instead of include_files;
include_files takes a list of relative paths of typically non python files
you want to get included. (possible to the 'packages' keyword argument
instead).

Another thing I do that might help is I have my setup.py file in the parent
directory of src, so src is then is then in the PYTHONPATH implicitly
because it's in the cwd. Try moving setup.py up a directory and change the
script argument in Executable to os.path.join("src", "main.py")


>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> cx-freeze-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
>
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
cx-freeze-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users

Reply via email to