Giter VIP home page Giter VIP logo

marcelotduarte / cx_freeze Goto Github PK

View Code? Open in Web Editor NEW
1.3K 24.0 210.0 6.71 MB

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.

Home Page: https://marcelotduarte.github.io/cx_Freeze/

License: Other

Python 89.53% C 9.69% Makefile 0.71% Shell 0.06%
freeze cx-freeze python freezing-python-scripts

cx_freeze's Introduction

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.

PyPI version PyPi Downloads Conda Version Conda Downloads Python Actions status CodeQL Coverage Ruff Documentation Status

Installation

In a virtual environment, install by issuing the command:

pip install --upgrade cx_Freeze

To install the latest development build:

pip install --force --no-cache --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze

Please check the installation for more information and how to install in other environments such as pipenv, conda-forge, etc.

Documentation

The official documentation is available here.

If you need help you can also ask on the discussion channel.

What's New v7.1:

  • Added new option --zip-filename in build_exe
  • Bug fixes and improvements

What's New v7.0:

  • Added support for pyproject.toml
  • Create Linux AppImage format: bdist_appimage
  • Create an DEB distribution: bdist_deb
  • Improved bdist_mac
  • New and updated hooks, including support for QtWebengine on macOS
  • Python 3.12 support.
  • Improved tests and coverage ( >80% ).
  • Bug fixes and improvements

License

cx_Freeze uses a license derived from the Python Software Foundation License. You can read the cx_Freeze license in the documentation or in the source repository.

cx_freeze's People

Contributors

adamlongroad avatar almarklein avatar ambrice avatar anthony-tuininga avatar behrisch avatar cainesi avatar cedk avatar cimbali avatar dependabot[bot] avatar dereas avatar diddileija avatar freeharry avatar gamesun avatar jjreyka avatar johan-ronnkvist avatar jonasgroeger avatar jurko-gospodnetic avatar klensy avatar lexa avatar libor-m avatar marcelotduarte avatar mragi avatar okin avatar pre-commit-ci[bot] avatar ptramsey avatar quantumentangledandy avatar rcutmore avatar sekrause avatar takluyver avatar technicalpirate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cx_freeze's Issues

Executable.initScript not executed?

Originally reported by: Sebastian Rahlf (Bitbucket: basti, GitHub: basti)


I've got script which is used to push some Hudson build information (from os.environment) into my GTK application.

Using Executable's initScript parameter seemed to be the logic choice. So I used

#!python

Executable(
    'deconvolute/ui.py',
    targetName="deconvolute.exe",
    initScript=os.path.abspath('insert-version-info.py'),
    base=base,
)

but for some reason this is not executed.

What am I missing?


Cannot import zope.interface

Originally reported by: Craig McQueen (Bitbucket: cmcqueen1975, GitHub: Unknown)


I have a program that uses Twisted. On Windows, that depends on zope.interface. But zope.interface is not included by cx_Freeze.

So I tried adding "includes": ['zope.interface', ] in build_exe_options. But then it made:
ImportError: no module named "zope.interface"
when I tried to build with cx_Freeze.

Then I found some documentation of namespace_packages, so I tried adding "namespace_packages": ['zope.interface', ] in build_exe_options. But then the build seems to never complete, so I have to Ctrl-C.

I added an empty __init__.py into C:\Python27\Lib\site-packages\zope, and then it worked.

It seems that this behaviour needs some sort of fix.

Python 2.7.6 on Windows XP SP3 32-bit.


Incorrect paths in installed cxfreeze scripts...

Originally reported by: David Lotton (Bitbucket: dlotton, GitHub: dlotton)


When attempting to execute the cxfreeze script I kept getting 'The system cannot find the path specified.'

After many hours of googling and bashing my head on the table I looked at the cxfreeze scripts that were installed. The paths in these scripts did not match the path to my python installation.

The base path to the python installation on my system is 'c:\python27'. This is where 'python.exe', 'scrpits', 'libs', etc... live. For some reason the installed cxfreeze scripts were referring to base paths of 'c:\python\32-bit\2.7' and 'c:\python\64-bit\2.7'.

I'm not sure where those paths came from. When I installed python I just did a straight install without any modifications to the install path during install.

When I installed cx_Freeze there was some mention of using the Python found in the registry. I searched the registry and any references to python were at the 'C:\python27' path, there were no registry keys that had paths that looked like the paths shown in the cx_Freeze scripts.

[edit] I modified the base path in all of the installed scripts in the 'c:\python27\Scripts' directory and that seemed to fix the problem.


Unable to build an simple installer via bdist_msi

Originally reported by: sifu (Bitbucket: sifu, GitHub: sifu)


Hello,

When I try to build an simple installer, I have the following error:

#!python

Traceback (most recent call last):
  File "setup_czfreeze.py", line 20, in <module>
    executables = [Executable( script = "bin/imageresizer"
  File "c:\Python27\lib\site-packages\cx_Freeze\dist.py", line 365, in setup
    distutils.core.setup(**attrs)
  File "c:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "c:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "c:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\Python27\lib\site-packages\cx_Freeze\windist.py", line 390, in run
    self.add_files()
  File "c:\Python27\lib\site-packages\cx_Freeze\windist.py", line 131, in add_fi
les
    dir.add_file(file)
  File "c:\Python27\lib\msilib\__init__.py", line 337, in add_file
    sequence, logical = self.cab.append(absolute, file, logical)
  File "c:\Python27\lib\msilib\__init__.py", line 207, in append
    logical = self.gen_id(file)
  File "c:\Python27\lib\msilib\__init__.py", line 195, in gen_id
    logical = _logical = make_id(file)
  File "c:\Python27\lib\msilib\__init__.py", line 181, in make_id
    assert re.match("^[A-Za-z_][A-Za-z0-9_.]*$", str), "FILE"+str
AssertionError: FILEGMT+0

It seems that cz_freeze was unable to add a file with a "+" like "GMT+0".

You can find the setup.py file here https://gitorious.org/yet-another-piwigo-image-resizer/yet-another-piwigo-image-resizer/commit/e9cc0b8be3008407ac7ad65ed10d07936338d7d7

Thanks.


Compilation fails in Ubuntu python3.2

Originally reported by: Anonymous


Getting the following compilation error.
building 'cx_Freeze.util' extension
creating build/temp.linux-x86_64-3.2/source
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -I/usr/include/python3.2mu -c source/util.c -o build/temp.linux-x86_64-3.2/source/util.o
source/util.c:6:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1


SubPackages on Windows

Originally reported by: Pavel Boldin (Bitbucket: pavelboldin, GitHub: Unknown)


Seems like 'packages' option does not work correctly, at least on Windows.

This is because cycle in Finder._ImportAllSubModules requires for fileName to end with suffix. In case thats directory with subpackage there is no suffix so no subpackages are scrabed, even if recursive=True.

To fix this I'm proposing to check explicitly if fileName is actually directory containing init file with any suffix.


Error copying imageformats directory into PyQt4 app

Originally reported by: Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver)


In master, when I try to freeze the sample PyQt4 app, I get an error:

error: /usr/lib/python2.7/dist-packages/PyQt4/plugins/imageformats: No such file or directory

The build succeeds anyway (as it doesn't require those plugins), but it's the last message from the build, so users are going to think there's a problem, even if there isn't.

It's reproducible with Python 2.7 and 3.2 (I haven't tested other versions). The root cause is that the hook that looks for the Qt plugins directory adjacent to the PyQt libraries, whereas on my system it's at:

/usr/lib/i386-linux-gnu/qt4/plugins/imageformats

From comments on pull request 11, it looks like QtCore.QCoreApplication.libraryPaths can be used to find the correct directory.


OSX bundle generated by cx_Freeze failed to pass Apple's codesign

Originally reported by: handsomegui (Bitbucket: handsomegui, GitHub: handsomegui)


My app InternetWorks.app was generated by the latest version of cx_Freeze(4.3.2).

As Apple requires all OSX apps should be signed before running on other people's Mac since Mountain Lion(10.8), so my app should be 'code sign' first before deployment.

Here is the output info during code signing:

$ codesign -s "3rd Party Mac Developer Application: GUI ZHENWEI" InternetWorks.app
InternetWorks.app: code object is not signed at all
In subcomponent: /Users/zhenweigui/.code/InternetWorks/build/InternetWorks.app/Contents/MacOS/_AE.so

$ 

But if i append the --deep option to the above command, it actually will pass the code sign process:

$ codesign -s "3rd Party Mac Developer Application: GUI ZHENWEI" InternetWorks.app --deep
$ 

Any comments on this? Thanks.


4.3.1 fails to run on ubuntu 64b

Originally reported by: Gaëtan de Menten (Bitbucket: gdementen, GitHub: gdementen)


I use Ubuntu 12.10. cx_Freeze seem to work fine on Ubuntu 32b (when installed manually using "sudo python setup.py install") but not on Ubuntu 64b

:::bash
ged@vbox-ubuntu-12:~/devel/liam2/trunk/src/ > python setup.py build
running build
running build_ext
skipping 'groupby.c' Cython extension (up-to-date)
running build_exe
Traceback (most recent call last):
  File "setup.py", line 47, in <module>
    executables=[Executable("main.py")])
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/dist.py", line 365, in setup
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
    self.run_command(cmd_name)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/dist.py", line 235, in run
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/freezer.py", line 567, in Freeze
ImportError: No module named util

ged@vbox-ubuntu-12:~/devel/liam2/trunk/src/ > cd /usr/local/lib/python2.7/dist-packages/cx_Freeze/
ged@vbox-ubuntu-12:/usr/local/lib/python2.7/dist-packages/cx_Freeze/ > echo $PYTHONPATH 
.:/home/ged/devel/sqlalchemy/trunk/lib:/home/ged/devel/elixir/trunk:
ged@vbox-ubuntu-12:/usr/local/lib/python2.7/dist-packages/cx_Freeze/ > python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import util
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named util
>>> 
ged@vbox-ubuntu-12:/usr/local/lib/python2.7/dist-packages/cx_Freeze/ > cd ~/devel/cx_Freeze-4.3.1/build/lib.linux-x86_64-2.7/cx_Freeze/
ged@vbox-ubuntu-12:~/devel/cx_Freeze-4.3.1/build/lib.linux-x86_64-2.7/cx_Freeze/ > ls
bases  dist.py  finder.py  freezer.py  hooks.py  __init__.py  macdist.py  main.py  setupwriter.py  util.so  windist.py
ged@vbox-ubuntu-12:~/devel/cx_Freeze-4.3.1/build/lib.linux-x86_64-2.7/cx_Freeze/ > python 
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import util
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: dynamic module not initialized properly
>>> 

Packaging fails on Mac when using PyQt

Originally reported by: Santiago Reig (Bitbucket: chiva, GitHub: chiva)


When packaging an application that uses PyQt on Mac, the cx_Freeze building process fails to complete:

Lions-Mac:Platex User$ sudo /Library/Frameworks/Python.framework/Versions/Current/bin/python setup.py bdist_dmg

..... (full log at http://pastebin.com/166Umc4T )

copying Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyQt4/Qt.so -> build/exe.macosx-10.6-intel-2.7/PyQt4.Qt.so
copying /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyQt4/QtCore.so -> build/exe.macosx-10.6-intel-2.7/PyQt4.QtCore.so
copying QtCore.framework/Versions/4/QtCore -> build/exe.macosx-10.6-intel-2.7/QtCore
error: QtCore.framework/Versions/4/QtCore: No such file or directory

I think it fails because it tries to get the file from QtCore.framework/Versions/4/QtCore when it should be /Library/Frameworks/QtCore.framework/Versions/4/QtCore


Cannot import mpl_toolkits

Originally reported by: Anonymous


I have a project that requires mpl_toolits from matplotlib. mpl_toolkits is not a submodule of matplotlib; it exists in the site-packages directory as it's own module, and is import by itself:

#!python

import mpl_toolkits

I have it listed as an included module in the setup function, and I just get an ImportError.


An opportunity: cx_Freeze in Eric IDE

Originally reported by: Anonymous


Dear Mr. Anthony Tuininga,
Dear Anthony,
Purpose of this “E(5)-PrjPackager – Tech.Report”, now available at URL: https://www.box.com/s/uzw8f77jyqlidbq8vv35
is that of building together a valid opportunity of understanding and improvement between cx_Freeze people and the Eric IDE users' community.
Looking forward collaborating with you to this aim, for the common benefit.
All the best.

  • P.M.

Error when scanning for modules with a different Python 3 version

Originally reported by: Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver)


From this StackOverflow question

Digging in to debugging it, I can reproduce it, and I find that, on Python 3.3, it's trying to load scipy.lib.lapack.flapack.cpython-32mu. That comes about because the filename flapack.cpython-32mu.so is an extension module (scipy.lib.lapack.flapack) for Python 3.2, but .so alone is also valid as a suffix.

_InternalImportModule checks first in a cache (_modules), which includes modules it has looked for and failed to find (represented as a None value). However, if it finds a None value in the cache, it doesn't set the error part of the return value, so the caller tries to use the None as a module.

The attached patch is a quick fix for this, but we should consider better ways to approach it. E.g. we could do away with the separate returnError field, and just check if module is None for a failure to find the module.


Dropbox include

Originally reported by: Anonymous


Hello there,

Thanks a lot for your cool work.

I'm trying to freeze an app using the dropbox sdk (https://www.dropbox.com/developers/core/sdk). It basically installs a module called dropbox.

I can run scripts by doing import dropbox, but whenever I try to freeze the app, the module is not found anymore.

I use cx_freeze on os x and even tried to add the module in the includes of setup.py...

Any ideas?

Thanks a lot


4.3.1 fails to install properly with pip

Originally reported by: Anonymous


I am not sure it is a bug in cx_freeze but I have never had any problem with other packages. I use Ubuntu 12.10 (I have both 32b & 64b versions and the problem seem present with both)

sudo pip install cx_Freeze
Downloading/unpacking cx-Freeze
Downloading cx_Freeze-4.3.1.tar.gz (53Kb): 53Kb downloaded
Running setup.py egg_info for package cx-Freeze
adding base module named xxx
...
adding base module named weakref

warning: no files found matching '*.html' under directory 'doc'

Installing collected packages: cx-Freeze
Running setup.py install for cx-Freeze
adding base module named xxx
...
adding base module named weakref
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

or: -c --help [cmd1 cmd2 ...]

or: -c --help-commands

or: -c cmd --help

error: option --single-version-externally-managed not recognized


Command /usr/bin/python -c "import setuptools;file='/home/ged/build/cx-Freeze/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --single-version-externally-managed --record /tmp/pip-voaIwz-record/install-record.txt failed with error code 1 in /home/ged/build/cx-Freeze
Storing complete log in /home/ged/.pip/pip.log


Trouble with PyQt4

Originally reported by: Anonymous


I have built Qt 4.8.2, PyQt 4.9.4 and cx_Freeze 4.3 with mingw 4.6.2.

Under these conditions, an example of cx_Freeze-4.3\samples\PyQt4\PyQt4app.py ends with the message -
"Runtime Error!

Program: ...reeze-4.3\samples\PyQt4\build\exe.win32-2.6\PyQt4app.exe

This application has requested the Runtime to terminate it in an unusual way.
Please contct the application's support team for more information."

I'm doing something wrong?


__debug__ is always True

Originally reported by: Anonymous


In compiled executable debug is always True, even if build_exe setting 'optimize' is 1 or 2 or setup build script was launched with Python interpreter in optimized mode (python -O)

Python 3.3

(this issue is correct, the one before this when i say it is always False is wrong - mixed up, sorry)


Missing internal modules and packages for python 3

Originally reported by: Anonymous


I use python 3.3 and when I run cx_Freeze I find that all internal
packages and modules are missing with the exception of main and modules within the main scripts directory.

#!python

#Works
import TestModule
MyClass = Statement.MyClass

#Results in "Missing modules: ? Test.MyClass imported from main__main__ "
from TestModule import MyClass

#Results in "Missing modules: ? TestPackage imported from main__main__ "
import TestPackage


Pbm with distutils.util.get_platform on OSX

Originally reported by: Olivier Grisel (Bitbucket: ogrisel, GitHub: ogrisel)


If I freeze a python script with the following lines on OSX 10.6.6 and cx_Freeze 4.2.3:

#!/usr/bin/env python

from distutils.util import get_platform
print (get_platform())

I get the following traceback at execution time:

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
    exec code in m.__dict__
  File "/var/folders/VQ/VQbKi1w7F8KNUU4382MrrU+++TI/-Tmp-/tmpW879Pl/scripts/example.py", line 5, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/util.py", line 97, in get_platform
    cfgvars = get_config_vars()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/sysconfig.py", line 525, in get_config_vars
    func()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/sysconfig.py", line 382, in _init_posix
    raise DistutilsPlatformError(my_msg)
distutils.errors.DistutilsPlatformError: invalid Python installation: unable to open /lib/python2.6/config/Makefile (No such file or directory)

Any idea why this is happening?


Failure in strange code path

Originally reported by: Jonathan Geddes (Bitbucket: jargv, GitHub: jargv)


The stacktrace I get is:

Traceback (most recent call last):
File "build.py", line 15, in
executables=[Executable("Agent.py", base=None)])
File "C:\Python33\lib\site-packages\cx_Freeze\dist.py", line 365, in setup
distutils.core.setup(**attrs)
File "C:\Python33\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python33\lib\distutils\dist.py", line 917, in run_commands
self.run_command(cmd)
File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
cmd_obj.run()
File "C:\Python33\lib\site-packages\cx_Freeze\windist.py", line 363, in run
self.run_command('build')
File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
cmd_obj.run()
File "C:\Python33\lib\distutils\command\build.py", line 126, in run
self.run_command(cmd_name)
File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
cmd_obj.run()
File "C:\Python33\lib\site-packages\cx_Freeze\dist.py", line 235, in run
freezer.Freeze()
File "C:\Python33\lib\site-packages\cx_Freeze\freezer.py", line 570, in Freeze
self.finder = self._GetModuleFinder()
File "C:\Python33\lib\site-packages\cx_Freeze\freezer.py", line 325, in _GetModuleFinder
finder.IncludePackage(name)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 536, in IncludePackage
self._ImportAllSubModules(module, deferredImports)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 211, in _ImportAllSubModules
recursive)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 211, in _ImportAllSubModules
recursive)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 205, in _ImportAllSubModules
deferredImports)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 320, in _InternalImportModule
parentModule, namespace)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 367, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 455, in _ScanCode
module, relativeImportIndex)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 269, in _ImportModule
deferredImports, namespace = namespace)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 320, in _InternalImportModule
parentModule, namespace)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 367, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 492, in _ScanCode
topLevel = False)
File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 452, in _ScanCode
fromList, = arguments
ValueError: too many values to unpack (expected 1)


Support for Win32 service dependencies

Originally reported by: boris_kuchin (Bitbucket: boris_kuchin, GitHub: Unknown)


Parameters for win32 service are missing ability to set dependency on other services. In this call (source/bases/Win32Service.c:407):

serviceHandle = CreateService(managerHandle, PyString_AS_STRING(fullName),
            PyString_AS_STRING(displayName), SERVICE_ALL_ACCESS,
            SERVICE_WIN32_OWN_PROCESS, info.startType, SERVICE_ERROR_NORMAL,
            PyString_AS_STRING(command), NULL, NULL, NULL, NULL, NULL);

third parameter from the end allows to pass service dependencies as LPCTSTR. So, if one adds one more entry in udt_ServiceInfo struct and read it in Setup_Python it would be possible to add service dependencies while installing service.


win32com relies on modules with non-identifier names

Originally reported by: Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver)


For 4.3.2, I made the module finder check that modules had valid Python names before copying them. However, win32com generates modules for dynamic loading with names based on Windows CLSIDs, containing dashes, which make them not valid Python identifiers.

The issue was identified by this StackOverflow question.

We could either relax the restriction globally (but carefully, because it was fixing another bug), or special-case win32com somehow.


Handle Qt 5 platform plugins

Originally reported by: Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver)


Qt 5 seems to introduce a new concept of platform plugins, dynamically loaded to integrate the program with the operating system. So on Windows it needs a platforms\qwindows.dll plugin for the application to work at all. The abstraction is briefly documented here.

This should be simple to handle automatically - we just need a hook that will check which platform it's on and copy the relevant plugin file to the target directory. We need to find out whether QtCore requires the platform plugin, or if it's only when QtGui is in use.

Prompted by this StackOverflow question.


4.3.1 does not run correctly when installed using easy_install

Originally reported by: Anonymous


I use Ubuntu 12.10 (I have both 32b & 64b versions and the problem seem present with both)

ged@vbox-ubuntu-12:~/devel/liam2/trunk/src/ > python setup.py build
running build
running build_ext
skipping 'groupby.c' Cython extension (up-to-date)
running build_exe
Traceback (most recent call last):
File "setup.py", line 47, in
executables=[Executable("main.py")])
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-x86_64.egg/cx_Freeze/dist.py", line 365, in setup
distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/distutils/command/build.py", line 128, in run
self.run_command(cmd_name)
File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-x86_64.egg/cx_Freeze/dist.py", line 234, in run
metadata = metadata)
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-x86_64.egg/cx_Freeze/freezer.py", line 104, in init
self._VerifyConfiguration()
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-x86_64.egg/cx_Freeze/freezer.py", line 466, in _VerifyConfiguration
self._GetInitScriptFileName()
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.1-py2.7-linux-x86_64.egg/cx_Freeze/freezer.py", line 311, in _GetInitScriptFileName
raise ConfigError("no initscript named %s", name)
cx_Freeze.freezer.ConfigError: no initscript named Console


wrong behavior of cx_Freeze, when source-program is without ".py"-extension

Originally reported by: Andrej Antonov (Bitbucket: polymorphm, GitHub: polymorphm)


good day! :)

i will show this in example:

step 1: making source

making source file ("test-exception-message"):

$ cat test-exception-message 
#!/usr/bin/env python3

if __name__ == '__main__':
    raise Exception('***** SOME MESSAGE *****') # we want will see this message!

it just displays error with message.

file name ("test-exception-message") MUST be without py-extension.

this works correctly with default python:

$ chmod -v +x test-exception-message 
mode of `test-exception-message' changed to 0775 (rwxrwxr-x)

$ ./test-exception-message
Traceback (most recent call last):
  File "./test-exception-message", line 4, in <module>
    raise Exception('***** SOME MESSAGE *****') # we want will see this message!
Exception: ***** SOME MESSAGE *****

step 2: using cx_Freeze

$ cxfreeze -s test-exception-message
$ ls
dist  test-exception-message

step 3: removing (or renaming) source file

this step is also important.

$ mv -v test-exception-message __REMOVED__test-exception-message__
`test-exception-message' -> `__REMOVED__test-exception-message__'

step 4: running dist-version

$ dist/test-exception-message 
Traceback (most recent call last):
  File "/home/regular-user/.local/lib/python3.2/site-packages/cx_Freeze/initscripts/Console3.py", line 27, in <module>
    exec(code, m.__dict__)
  File "test-exception-message", line 4, in <module>

message of exception not shown.

program has crashed earlier, then show error message.


thanks in advance!

sorry for bad english.


OSX bundles behavior changed after sign-ed by Apple's codesign utility

Originally reported by: handsomegui (Bitbucket: handsomegui, GitHub: handsomegui)


I wrote a small and simple PyQt4 app on Mac OS X 10.9 Mavericks which stays on the system tray and monitors a service after launching. And i can interact with it's context menu using mouse click. (Click on the system tray icon --> then context menu pop-up)

I pack my OSX bundle using below command:

python setup.py bdist_mac --iconfile=myapp.icns

It is OK to run after i packed it as myapp.app bundle using cx_Freeze(4.3.2).
But, once i signed it using the following command:

$ codesign --entitlements my-entitlements-file.plist -s "3rd Party Mac Developer Application: my-developer-id" myapp.app

After that, although i could still launch this osx bundle, but the context menu of it has gone! No matter how i click on the system tray icon, it just has no menu pop-up.

That means, the behavior of this osx bundle generated by cx_Freeze has been changed somehow.

You may ask why i run the above codesign command?
Because before upload to Apple's Mac App Store, apps need to be signed & sandbox-ed by Apple's codesign utility. (Yes, that is a rule of Apple.)

I am not sure if its proper to report here.
But i search a lot indeed, and program written in Python can not be signed in Xcode,
so i have no idea how can i fix this, i am stuck for couple of days already. so please bear me. Thanks.


Can't compile cx_Freeze in Ubuntu 13.04

Originally reported by: Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver)


Ubuntu and Debian now set Py_ENABLE_SHARED to 1 and don't link extensions against the Python shared library (bug report, patch).

This causes a problem when compiling the bases for cx_Freeze. You see a whole load of warnings like this:

/home/thomas/Code/cx_freeze/source/bases/Console.c:36: undefined reference to `PyErr_Print'

I can get it to work by modifying this line to if True: so that it always links against libpython. I'm not sure if that's right, though - cx_Freeze.util can be compiled without explicitly linking to python, but maybe the rules are different for executables.


setup() can't take dictionary as keyword arguments

Originally reported by: Anonymous


If I pass a dictionary

setup_args = {... ,'options' = {'build_exe'=...},'cible'  = [ Executable(...) ]}

setup(**setup_args)

It's failed :

Traceback (most recent call last):
  File "setup.py", line 60, in <module>
    setup(* *setup_args)
  File "C:Python27libsite-packagescx_Freezedist.py", line 359, in setup
    distutils.core.setup(**attrs)
  File "C:Python27libdistutilscore.py", line 112, in setup
    _setup_distribution = dist = klass(attrs)
  File "C:Python27libsite-packagescx_Freezedist.py", line 23, in __init__
    distutils.dist.Distribution.__init__(self, attrs)
  File "C:Python27libdistutilsdist.py", line 241, in __init__
    for (command, cmd_options) in options.items():
AttributeError: 'tuple' object has no attribute 'items'

But if I pass cx_freeze specials arguments outside of the dict :

setup(options = {'build_exe'=...},cible=[ Executable(...) ], **setup_args)

it's work.


ImportError: No module named 'cx_Freeze.util'

Originally reported by: Matthew Dodkins (Bitbucket: mdodkins, GitHub: mdodkins)


Hi - I'm trying to create a .exe using your latest code and getting this weird problem :-

Traceback (most recent call last):
File "cxfreeze", line 5, in
main()
File "C:\Users\d\Desktop\anthony_tuininga-cx_freeze-e71adabfc085\antho
ny_tuininga-cx_freeze-e71adabfc085\cx_Freeze\main.py", line 187, in main
silent = options.silent)
File "C:\Users\d\Desktop\anthony_tuininga-cx_freeze-e71adabfc085\antho
ny_tuininga-cx_freeze-e71adabfc085\cx_Freeze\freezer.py", line 101, in init
for n in self._GetDefaultBinPathExcludes() + binPathExcludes]
File "C:\Users\d\Desktop\anthony_tuininga-cx_freeze-e71adabfc085\antho
ny_tuininga-cx_freeze-e71adabfc085\cx_Freeze\freezer.py", line 235, in _GetDefau
ltBinPathExcludes
import cx_Freeze.util
ImportError: No module named 'cx_Freeze.util'

Any ideas?

Thanks!


Import errors when using cx_Freeze with specific scipy modules

Originally reported by: azylstra (Bitbucket: azylstra, GitHub: azylstra)


Following up on StackOverflow issue

My project uses scipy in a few places and after freezing I would get a variety of import errors. Those seemed to be naming issues (see in the StackOverflow link, the executable was looking for _csr when scipy.sparse.sparsetools._csr was what was packaged).

Unfortunately the project cannot be public but I tried to replicate the issue in an example. The _csr problem appears to be coming from a piece of code that uses import scipy.optimize. Other modules when imported specifically cause other errors. For example, here is some logged console output from an executable:

10/27/13 9:58:08.856 AM Python[8116]: Start cx_Freeze test
10/27/13 9:58:08.959 AM Python[8116]: Imported scipy OK
10/27/13 9:58:08.961 AM Python[8116]: Uh oh, failed to import scipy.interpolate: No module named 'scipy.special._ufuncs_cxx'
10/27/13 9:58:08.962 AM Python[8116]: Uh oh, failed to import scipy.integrate: No module named 'scipy.special._ufuncs_cxx'
10/27/13 9:58:09.020 AM Python[8116]: Uh oh, failed to import scipy.optimize: No module named '_csr'
10/27/13 9:58:09.023 AM Python[8116]: Uh oh, failed to import scipy.stats: No module named 'scipy.special._ufuncs_cxx'
10/27/13 9:58:09.023 AM Python[8116]: cx_Freeze test completed

I've attached a zip of the setup.py and python code used to generate that output, along with a text file containing the console output of the build, and the entire build folder.

Here are the details of my system:

  • OS X 10.9
  • python 3.3.2
  • cx_Freeze 4.3.2
  • scipy 0.13.0

Cannot install different platform versions of cx_Freeze

Originally reported by: Russ Gibson (Bitbucket: squeegee, GitHub: squeegee)


I have a test system set up with various versions of python - 3.3 x64, 3.3 x86, 2.7 x86, 2.7 x64, etc.

After installing cx_Freeze 3.3 x64, I am unable to install any other platforms, as they act as though they are modifying the existing 3.3 x64 install, even thought hey should be installing into their specific python versions.


Documentation of how to create desktop or program menu shortcut in Windows

Originally reported by: Craig McQueen (Bitbucket: cmcqueen1975, GitHub: Unknown)


It would be good to document how to create a desktop shortcut and/or a program menu shortcut with cx_Freeze bdist_msi in Windows.

I found these:

These are good because they explain that option shortcutDir must be set to "DesktopFolder" or "ProgramMenuFolder". But neither make it clear how to put shortcuts in sub-folders (or sub-menus).

That StackOverflow question has an interesting answer about MSI Shortcut tables, but alas, I can't figure out what to put in for icons, subfolders, etc, or how to add to the programs menu.


Specifying targetDir on an Executable leads to confusing failure

Originally reported by: Thomas Kluyver (Bitbucket: takluyver, GitHub: takluyver)


From this SO question: the user had specified targetDir='dist' for the Executable arguments in a setup.py file.

This is one of various options that doesn't make sense to set per-executable. The executable cannot work without its supporting libraries, so the target directory should only be set for the whole freezing process.

I'd be inclined to remove the targetDir option entirely, to avoid confusing people. Although for backwards compatibility, it might be better to ignore it and issue a warning if it's specified. Are there any valid use cases for setting it?


install_name_tool doesn't set relative paths for files added using include_files option

Originally reported by: Adam McNicol (Bitbucket: MrAGi, GitHub: MrAGi)


I encountered this issue whilst trying to build an executable on Mac OS that contains the QSQLite plugin.

I have attached a copy of my setup.py file used to build the application.

Basically it copies the required plugin to a "sqldrivers" directory which is placed inside the application bundle at "Contents/MacOS/"

The Plugin has various dependencies (which can be found using otool) that point outside the app bundle. Using install_name_tool to change these to @executable_path references fixes the issue.

Thomas advised that it may be an issue with cx_Freeze.macdist.setRelativeReferencePaths() not recursively looking into subdirectories.


Recent versions of gevent break __bootstrap__ when packaged

Originally reported by: Miguel Turner (Bitbucket: dhagrow, GitHub: dhagrow)


If you try to package a gevent project (tested with gevent-1.0rc3 on Ubuntu 12) you will will get the following error when the package is run:

#!python

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
    exec code in m.__dict__
  File "test_thread.py", line 20, in <module>
    q = queue.Queue()
  File "/usr/local/lib/python2.7/dist-packages/gevent/queue.py", line 59, in __init__
    self.hub = get_hub()
  File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 169, in get_hub
    hub = _threadlocal.hub = hubtype(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 268, in __init__
    loop_class = _import(self.loop_class)
  File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 198, in _import
    return _import(path[-1])
  File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 210, in _import
    x = __import__(module)
  File "ExtensionLoader_gevent_core.py", line 22, in <module>
  File "ExtensionLoader_gevent_core.py", line 9, in __bootstrap__
AttributeError: 'module' object has no attribute 'path'

After some investigation I found that this happens because cx_Freeze's __bootstrap__ code mistakenly loads gevent's os module, rather than the stdlib's os module.

This can be worked around by changing this line as follows:

#!python

import imp, sys
os = sys.modules['os']

I'm not sure this is the best solution, but it works.


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.