native FAF on ubuntu (QtWebKit on ubuntu 17.04+)
Note: the steps for Python 3 with PyQt5 are proven to work while the steps for Python 2 with PyQt4 and PySide are still experimental.
Python 3 with PyQt5 (proven to work)
It appears that the 474-feature-py3
branch of the FAForever/client GitHub repository uses Python 3 with PyQt5, which contains QtWebKit. Therefore, using this branch is the most straightforward solution. Note that PyQt5 (but not PyQt4) can in fact be installed with pip
, so that makes things way more convenient.
Steps for Python 3 with PyQt5:
cd
into a directory of your choice, which will be~/Desktop/temp
for the purpose of writing this answer,git clone
the FAForever/client GitHub repository andgit checkout
the474-feature-py3
branch:mkdir ~/Desktop/temp cd ~/Desktop/temp git clone https://github.com/FAForever/client.git faf-client cd faf-client git checkout 474-feature-py3
Create and activate a virtualenv for Python 3 (the default is Python 3.5 for Ubuntu 17.04) and force-upgrade
pip
just to make sure it is up-to-date:virtualenv venv -p python3 # replace python3 with python3.6 if you want to use Python 3.6 instead source venv/bin/activate pip install -U --force-reinstall pip
Use
pip
to installPyQt5
and fromrequirements.txt
:pip install PyQt5 pip install -r requirements.txt
Download the
faf-uid
binary intofaf-client/lib
and make it executable:wget https://github.com/FAForever/uid/releases/download/v4.0.4/faf-uid -O lib/faf-uid chmod +x lib/faf-uid
Run
python
onsrc/__main__.py
:python src/__main__.py
Python 2 with PyQt4 and PySide (experimental)
It looks like I may have figured out how to import the QtWebKit
module, but I don't have the FAF game installed, so I cannot fully verify that this works and therefore this answer is a work in progress.
In a nutshell, I used apt
to install python-qt4
, which does not have the QtWebKit
module. I created and activated a virtualenv without using the --system-site-packages
option and used pip
to install PySide
, which does have the QtWebKit
module. I then symlinked the appropriate system libraries and files for PyQt4 into the virtualenv. Then I made a couple of changes to faf-client/src
to import the QtWebKit
module from PySide
. This solution is inspired by https://stackoverflow.com/a/28850104/486919, https://stackoverflow.com/a/36887302/486919 and https://stackoverflow.com/a/37616466/486919.
Steps:
Install
python-qt4
:sudo apt update sudo apt install python-qt4
cd
into a directory of your choice, which will be~/Desktop/temp
for the purpose of writing this answer,git clone
my version of the repository andgit checkout
thepatch
branch:mkdir ~/Desktop/temp cd ~/Desktop/temp git clone https://github.com/edwinksl/client.git faf-client cd faf-client git checkout patch
This
patch
branch has several additional commits compared to the defaultdevelop
branch: 1) it gets rid of the version specification forcx_Freeze
, which was giving me installation problems if I used the4.3.4
version previously specified, and 2) it importsQtWebKit
fromPySide
instead ofPyQt4
.Create and activate a virtualenv for Python 2 and force-upgrade
pip
just to make sure it is up-to-date:virtualenv venv source venv/bin/activate pip install -U --force-reinstall pip
Use
pip
to installPySide
and fromrequirements.txt
:pip install PySide pip install -r requirements.txt
Download the
faf-uid
binary intofaf-client/lib
and make it executable:wget https://github.com/FAForever/uid/releases/download/v4.0.4/faf-uid -O lib/faf-uid chmod +x lib/faf-uid
cd
to thesite-packages
directory inside the virtualenv and make appropriate symlinks:cd venv/lib/python2.7/site-packages ln -s /usr/lib/python2.7/dist-packages/PyQt4/ . ln -s /usr/lib/python2.7/dist-packages/sip.x86_64-linux-gnu.so .
Note the
.
at the end of each symlink.cd
back tofaf-client
and runpython
onsrc/__main__.py
:cd - # this goes back to previous directory, which should be ~/Desktop/temp/faf-client python src/__main__.py