Skip to content

Developers: Creating Executable Builds for Pyfa

Alex Jones edited this page Nov 25, 2019 · 6 revisions

Currently builds are not done using pyInstaller. This is simply documenting one method to creating builds.

You will need to modify the pyfa.spec file. This file should always be executed from the same level as pyfa.py.

pathex=['C:\\Users\\Ebag333\\Documents\\GitHub\\Ebag333\\Pyfa'],

pathex points to where your pyfa.py and pyfa.spec file lives.

icon='C:/Users/Ebag333/Documents/GitHub/Ebag333/Pyfa/dist_assets/win/pyfa.ico',

icon can be found twice. Modify both locations. Make sure to point to the correct distribution icon.

debug=False,
console=False,

By default we don't show the console or output debugging info. If the build does not run, you may need to enable these to troubleshoot.

Linux

Setup/Configuration

  1. Install Linux (steps below use Ubuntu as a reference)
  2. Escalate to su sudo su or prepend all commands below with sudo
  3. Update apt-get: apt-get update
  4. Install python3 if not already installed (3.6 needed)
  5. Install pip3
apt-get install python3-pip python3-dev build-essential 
pip3 install --upgrade pip3
pip3 install --upgrade virtualenv 
  1. Install wxPython.
apt-get install python-wxgtk3.0 python-wxgtk3.0-dev
  1. Create a directory to place the build files. (I used /tmp/Pyfa_build)
  2. Change directory to the one you created above.
  3. Upload all files into the directory (can be done via git or simply copying the files)
  4. Install Pyfa requirements.
    If you get any memory errors, use --no-cache-dir. If you get build errors ("python setup.py egg_info" failed) try installing libfreetype6-dev.
pip3 install -r requirements.txt
apt-get install libfreetype6-dev
pip3 --no-cache-dir install -r requirements.txt

Build Process

  1. From within the same directory as pyfa.py and pyfa.spec run: pyinstaller --clean --noconfirm --windowed pyfa.spec

Notes

  1. Because Linux doesn't bundle all the libraries in the package, it may not be backwards compatible. It should be forward compatible, but it's recommended to build on the oldest version you want to support.

.

Windows

Setup/Configuration

  1. Install Windows (steps below use Windows 10 as a reference)
  2. Install python if not already installed (2.7 recommended
  3. Install wxPython (version 2.8)
  4. Install Visual Studio (there is a free community edition)
  5. Create a directory to place the build files. (I used /tmp/Pyfa_build)
  6. Change directory to the one you created above.
  7. Upload all files into the directory (can be done via git or simply copying the files)
  8. Install Pyfa requirements:
pip install -r requirements.txt
pip install -r requirements_build_windows.txt

Build Process

  1. From within the same directory as pyfa.py and pyfa.spec run: pyinstaller.exe --clean --noconfirm --windowed --upx-dir=.\scripts\upx.exe pyfa.spec