0

How to pass commands to gcc through cx_Freeze 'disutils.core.setup()' arguments?

Specifically, i want my .exe file to use relative paths in traceback messages, rather than the path where i build .exe file

Here is my setup.py file:

setup(
name="test",
packages=['test'],
package_data={'': ['*.py', '*.txt', '*.sample', '*.mo', 'README.rst']},
options={"build_exe": {
    "icon": r"test\resources\test.ico",
    "compressed": True,
    "create_shared_zip": True,
    "copy_dependent_files": True,
    "include_files": [
        ('test/i18n/', 'i18n/'),
        ('test/resources/', 'resources/'),
        ('test/client.conf.sample', 'client.conf.sample'),
    ],
    "excludes": [
        'urllib.sys',
        'urllib._sre',
        'urllib.array',
        'urllib._locale',
        'urllib.datetime',
        'urllib._functools',
        ]
    }
},
executables=Executable(script=script),)

1 Answers1

0

You need to add one additional option to the ones you already have:

replace_paths = [("*", "")]

That will replace all paths with relative paths. You can also do more interesting things like:

replace_paths = [
    ("/path/to/python/lib", "<Python>"),
    ("/path/to/my/script", "<Script>")
]

In essence, the first element of the tuple is the part of the path which is to be replaced with the value in the second element of the tuple. A value of * in the search value results in all paths being replaced with the replacement value.

Anthony Tuininga
  • 6,388
  • 2
  • 14
  • 23
  • Thanks. So nice when people who create open projects offer support to others. Ill try it out soon –  Aug 25 '16 at 18:12