.. -- mode: rst; coding: utf-8 --
:Authors: Ralf Schmitt ralf@systemexit.de :Version: 1.1.3 :Date: 2014-01-20 :Download: https://pypi.python.org/pypi/bbfreeze/#downloads :Code: https://github.com/schmir/bbfreeze
.. Note::
bbfreeze currently does not have a maintainer. If that doesn't scare you off, read on!
bbfreeze creates stand-alone executables from python scripts. It's similar in purpose to the well known py2exe for windows, py2app for OS X, PyInstaller_ and cxFreeze (in fact ancient versions were based on cxFreeze. And it uses the modulegraph package, which is also used by py2app).
It has the following features:
easy installation bbfreeze can be installed with setuptools' easy_install command.
zip/egg file import tracking bbfreeze tracks imports from zip files and includes whole egg files if some module is used from an eggfile. Packages using setuputils' pkg_resources module will now work (new in 0.95.0)
binary dependency tracking bbfreeze will track binary dependencies and will include DLLs and shared libraries needed by a frozen program.
multiple script freezing bbfreeze can freeze multiple scripts at once.
python interpreter included bbfreeze will create an extra executable named 'py', which might be used like the python executable itself.
automatic pathname rewriting pathnames in tracebacks are replaced with relative pathnames (i.e. if you import package foo.bar from /home/jdoe/pylib/ tracebacks generated from functions in foo.bar will not show your local path /home/jdoe/pylib/foo/bar.py. They will instead show foo/bar.py)
distutils command 'bdist_bbfreeze' A new distutils/setuptools command bdist_bbfreeze integrates bbfreeze into your setup.py.
bbfreeze works on windows and UNIX-like operating systems. bbfreeze has been tested with python 2.4, 2.5, 2.6 and 2.7 bbfreeze will not work with python 3 or higher. bbfreeze does not work on OS X.
bbfreeze has been developed by brainbot technologies AG
__. Questions
and suggestions should be send to the bbfreeze-users mailing list:
bbfreeze-users@googlegroups.com
You can subscribe by sending email to bbfreeze-users+subscribe@googlegroups.com
An archive is available at http://groups.google.com/group/bbfreeze-users
You can also reach the author via email to ralf@systemexit.de
Windows Eggs and the source code can be downloaded from https://pypi.python.org/pypi/bbfreeze/.
The source code is maintained in a git repository on github: https://github.com/schmir/bbfreeze
Use::
git clone https://github.com/schmir/bbfreeze.git
to create a copy of the repository, then::
git pull
inside the copy to receive the latest version.
You need to have setuptools/easy_install installed. Installation should be as easy as typing::
easy_install bbfreeze
This should download bbfreeze and it's dependencies modulegraph and altgraph and install them.
bbfreeze provides a command line utility called bbfreeze, which freezes all python scripts given on the command line into the directory dist, which then contains for each script an executable and all dependencies needed by those executables.
Example Usage::
$ cat hello-world.py
import sys import email
print unicode("hello", "utf8"), unicode("world!", "ascii")
print "sys.path:", sys.path print "file:", file print "name:", name
print "locals():", locals()
print "sys.argv", sys.argv print "sys.executable:", sys.executable $ bbfreeze hello-world.py WARNING: found encodings in multiple directories. Assuming it's a namespace package. (found in /home/ralf/py27/lib/python2.7/encodings, /usr/lib/python2.7/encodings) applied <function recipe_doctest at 0x1f01aa0> applied <function recipe_time at 0x1f01de8> *** applied <function recipe_urllib at 0x1f01c08> RPATH ${ORIGIN}:${ORIGIN}/../lib is fine $ dist/hello-world hello world! sys.path: ['/home/ralf/bbfreeze/tests/dist/library.zip', '/home/ralf/bbfreeze/tests/dist'] file: hello-world.py name: main locals(): {'builtins': <module 'builtin' (built-in)>, 'file': 'hello-world.py', 'package': None, 'sys': <module 'sys' (built-in)>, 'email': <module 'email' from '/home/ralf/bbfreeze/tests/dist/library.zip/email/init.pyc'>, 'name': 'main', 'doc': None} sys.argv ['/home/ralf/bbfreeze/tests/dist/hello-world'] sys.executable: /home/ralf/bbfreeze/tests/dist/hello-world $ dist/py Python 2.7.2 (default, Nov 21 2011, 17:25:27) [GCC 4.6.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. (MyConsole)
import email
bbfreeze provides a distutils command which works much like the 'bbfreeze' command line tool, but integrates nicely into distutils and setuptools. It collects all 'console_scripts' 'gui_scripts' entry-points, generates the wrapper scripts (like easy_install would do) and freezes these scripts.
After installing bbfreeze, every setup.py which used setuptools, has a new command 'bdist_bbfreeze'. To show the help message just run::
python setup.py bdist_bbfreeze --help
Usage examples::
python setup.py bdist_bbfreeze
python setup.py egg_info --tag-build=dev bdist_bbfreeze
The preferred way to use bbfreeze is by writing short python scripts, which use bbfreeze's API. Let's start with a short example::
from bbfreeze import Freezer f = Freezer("hello-world-1.0", includes=("_strptime",)) f.addScript("hello-world.py") f.addScript("hello-version.py") f() # starts the freezing process
bbfreeze.Freezer(distdir="dist", includes=(), excludes=())
instantiates a Freezer object. It will create the frozen executables
and dependencies inside the distdir
directory. includes
is a list
or tuple of modules to include, excludes
is a list or tuple of
modules to exclude. Note that the freezer will delete the directory
distdir
before freezing!
bbfreeze.Freezer objects have the following members:
use_compression
: flag whether to use compression inside the created
zipfile (default True).include_py
: flag whether to create the included python interpreter
py
(default True)addScript(path, gui_only=False)
: register a python script for
freezing. path
must be the path to a python script.
The freezer will scan the file for dependencies and will create an
executable with the same name in distdir
. The gui_only
flag only
has a meaning on windows: If set, the executable created for this
script will not open a console window.Recipes provide a way to control the freezing process. Have a look at bbfreeze/recipes.py if you need to implement your own. Note that the API might change.
The glibc version on the system used for freezing will generally be the minimum glibc version required to run the binaries.
gtk, gdk, pango, glib shared libraries will not be copied by the freezing process. Those need a rather complicated runtime system and copying them would probably only lead to problems.
binaries created with python 2.6 or 2.7 will need the Microsoft Visual C++ 2008 Redistributable Package (either the 32bit or the 64bit version) installed on the target machine.
bbfreeze contains a modified copy of modulegraph, which is distributed under the MIT license and is copyrighted by Bob Ippolito.
bbfreeze contains a modified copy of getpath.c from the python distribution, which is distributed under the python software foundation license version 2 and copyrighted by the python software foundation.
bbfreeze includes a module 'bdist_bbfreeze.py' which is
Copyright 2008-2012 by Hartmut Goebel h.goebel@goebel-consult.de
The 'bdist_bbfreeze' module may be distributed under the same licence as bbfreeze itself.
The remaining part is distributed under the zlib/libpng license:
Copyright (c) 2007-2012 brainbot technologies AG
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
This notice may not be removed or altered from any source distribution.
.. _py2exe: http://www.py2exe.org/ .. _py2app: https://pypi.python.org/pypi/py2app/ .. _PyInstaller: http://www.pyinstaller.org/ .. _cx_Freeze: http://cx-freeze.sourceforge.net/ .. _modulegraph: https://pypi.python.org/pypi/modulegraph .. __: http://brainbot.com .. _32bit: http://www.microsoft.com/downloads/en/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF .. _64bit: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=BD2A6171-E2D6-4230-B809-9A8D7548C1B6