From b05b43090b26d49661d3b648f93001a8b1b82c96 Mon Sep 17 00:00:00 2001 From: Saurav Sachidanand Date: Thu, 3 Dec 2015 11:59:53 +0530 Subject: [PATCH 1/2] Updated PyInstaller section for OS X Added explanation and examples for PyInstaller for OS X. --- docs/shipping/freezing.rst | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/shipping/freezing.rst b/docs/shipping/freezing.rst index 8b01d647e..eff9ead36 100644 --- a/docs/shipping/freezing.rst +++ b/docs/shipping/freezing.rst @@ -117,6 +117,50 @@ py2app PyInstaller ~~~~~~~~~~~ +PyInstaller can be used to build Unix executables and windowed apps on Mac OS X 10.6 (Snow Leopard) or newer. + +- To install PyInstaller, use pip: + + .. code-block:: console + + $ pip install pyinstaller + +- To create a standard Unix executable, from say :code:`script.py`, use: + + .. code-block:: console + + $ pyinstaller script.py + + This creates, + + - a :code:`script.spec` file, analogous to a :code:`make` file + - a :code:`build` folder, that holds some log files + - a :code:`dist` folder, that holds the main executable :code:`script`, and some dependent Python libraries, + + all in the same folder as :code:`script.py`. PyInstaller puts all the Python libraries used in :code:`script.py` into the :code:`dist` folder, so when distributing the executable, distribute the whole :code:`dist` folder. + +- The :code:`script.spec` file can be edited to `customise the build `_, with options such as + + - bundling data files with the executable + - including run-time libraries (:code:`.dll` or :code:`.so` files) that PyInstaller can't infer automatically + - adding Python run-time options to the executable, + + Now :code:`script.spec` can be run with :code:`pyinstaller` (instead of using :code:`script.py` again): + + .. code-block:: console + + $ pyinstaller script.spec + +- To create a standalone windowed OS X application, use the :code:`--windowed` option + + .. code-block:: console + + $ pyinstaller --windowed script.spec + + This creates a :code:`script.app` in the :code:`dist` folder. Make sure to use GUI packages in your Python code, like `PyQt `_ or `PySide `_, to control the graphical parts of the app. + + There are several options in :code:`script.spec` related to Mac OS X app bundles `here `_. For example, to specify an icon for the app, use the :code:`icon=\path\to\icon.icns` option. + Linux ----- From c9035bd548941b3d2d586b3c43cc3c988a61b4c5 Mon Sep 17 00:00:00 2001 From: Saurav Sachidanand Date: Thu, 3 Dec 2015 12:04:41 +0530 Subject: [PATCH 2/2] Updated formatting in PyInstaller for OS X section --- docs/shipping/freezing.rst | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/shipping/freezing.rst b/docs/shipping/freezing.rst index eff9ead36..7664ad30e 100644 --- a/docs/shipping/freezing.rst +++ b/docs/shipping/freezing.rst @@ -119,47 +119,47 @@ PyInstaller PyInstaller can be used to build Unix executables and windowed apps on Mac OS X 10.6 (Snow Leopard) or newer. -- To install PyInstaller, use pip: +To install PyInstaller, use pip: - .. code-block:: console +.. code-block:: console - $ pip install pyinstaller + $ pip install pyinstaller -- To create a standard Unix executable, from say :code:`script.py`, use: +To create a standard Unix executable, from say :code:`script.py`, use: - .. code-block:: console +.. code-block:: console - $ pyinstaller script.py + $ pyinstaller script.py - This creates, +This creates, - - a :code:`script.spec` file, analogous to a :code:`make` file - - a :code:`build` folder, that holds some log files - - a :code:`dist` folder, that holds the main executable :code:`script`, and some dependent Python libraries, +- a :code:`script.spec` file, analogous to a :code:`make` file +- a :code:`build` folder, that holds some log files +- a :code:`dist` folder, that holds the main executable :code:`script`, and some dependent Python libraries, - all in the same folder as :code:`script.py`. PyInstaller puts all the Python libraries used in :code:`script.py` into the :code:`dist` folder, so when distributing the executable, distribute the whole :code:`dist` folder. +all in the same folder as :code:`script.py`. PyInstaller puts all the Python libraries used in :code:`script.py` into the :code:`dist` folder, so when distributing the executable, distribute the whole :code:`dist` folder. -- The :code:`script.spec` file can be edited to `customise the build `_, with options such as +The :code:`script.spec` file can be edited to `customise the build `_, with options such as - - bundling data files with the executable - - including run-time libraries (:code:`.dll` or :code:`.so` files) that PyInstaller can't infer automatically - - adding Python run-time options to the executable, +- bundling data files with the executable +- including run-time libraries (:code:`.dll` or :code:`.so` files) that PyInstaller can't infer automatically +- adding Python run-time options to the executable, - Now :code:`script.spec` can be run with :code:`pyinstaller` (instead of using :code:`script.py` again): +Now :code:`script.spec` can be run with :code:`pyinstaller` (instead of using :code:`script.py` again): - .. code-block:: console +.. code-block:: console - $ pyinstaller script.spec + $ pyinstaller script.spec -- To create a standalone windowed OS X application, use the :code:`--windowed` option +To create a standalone windowed OS X application, use the :code:`--windowed` option - .. code-block:: console +.. code-block:: console - $ pyinstaller --windowed script.spec + $ pyinstaller --windowed script.spec - This creates a :code:`script.app` in the :code:`dist` folder. Make sure to use GUI packages in your Python code, like `PyQt `_ or `PySide `_, to control the graphical parts of the app. +This creates a :code:`script.app` in the :code:`dist` folder. Make sure to use GUI packages in your Python code, like `PyQt `_ or `PySide `_, to control the graphical parts of the app. - There are several options in :code:`script.spec` related to Mac OS X app bundles `here `_. For example, to specify an icon for the app, use the :code:`icon=\path\to\icon.icns` option. +There are several options in :code:`script.spec` related to Mac OS X app bundles `here `_. For example, to specify an icon for the app, use the :code:`icon=\path\to\icon.icns` option. Linux