Skip to content

Commit

Permalink
Bug 1425105 - Mac (GUI) builds (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
wlach authored Apr 14, 2020
1 parent 6f3352b commit 5e938d0
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 39 deletions.
42 changes: 21 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ matrix:
language: python
python: '3.5'
script:
- pip install -e .
- pip3 install -e .
- coverage run -m pytest tests && mv .coverage .coverage.core
- coverage combine
- pip install coveralls; coveralls
- pip3 install coveralls; coveralls
- name: python3-linux
env: PYTHON=python3.7
os: linux
Expand All @@ -24,39 +24,39 @@ matrix:
language: python
python: '3.7'
script:
- pip install -r requirements/all.txt
- pip3 install -r requirements/all.txt
- coverage run -m pytest tests && mv .coverage .coverage.core
- coverage run gui/build.py test && mv .coverage .coverage.gui
- coverage combine
- pip install coveralls; coveralls
- python gui/build.py bundle
- pip3 install coveralls; coveralls
- python3 gui/build.py bundle
- name: gui-macosx
os: osx
osx_image: xcode11.3
language: shell
before_install:
- python3 --version
- pip3 install -U pip
script:
- pip3 install -r requirements/all.txt
- coverage run -m pytest tests && mv .coverage .coverage.core
- coverage run gui/build.py test && mv .coverage .coverage.gui
- coverage combine
- pip3 install coveralls; coveralls
- python3 gui/build.py bundle
- name: linters
env: PYTHON=python3.7
os: linux
language: python
python: '3.7'
script:
- pip install -r requirements/all.txt
- pip3 install -r requirements/all.txt
- ./bin/lint-check.sh || (echo "Lint fix results:" && ./bin/lint-fix.sh && git diff && false)
- bin/update-glean-documentation.sh
- if [[ $(git diff docs/glean | head -c1 | wc -c) -ne 0 ]]; then echo "Unexpected glean changes! Please regenerate glean documentation via `./bin/update-glean-documentation.sh`." && false; fi

install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew update; brew outdated xctool || brew upgrade xctool;
pip install virtualenv;
brew install pyqt;
brew linkapps qt;
MOZPATH="$PWD";
mkdir -p /Users/travis/Library/Python/2.7/lib/python/site-packages;
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/travis/Library/Python/2.7/lib/python/site-packages/homebrew.pth;
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH;
cd /usr/local/opt/pyqt/lib/python2.7/site-packages/PyQt4;
sudo install_name_tool -id $PWD/QtCore.so QtCore.so;
sudo install_name_tool -id $PWD/QtGui.so QtGui.so;
cd $MOZPATH;
fi
- pip install -r requirements/console.txt
- pip3 install -r requirements/console.txt

deploy:
- provider: releases
Expand Down
8 changes: 7 additions & 1 deletion gui/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ def do_bundle(options):
makensis_path = os.path.join(options.nsis_path, "makensis.exe")
call(makensis_path, "wininst.nsi", cwd="wininst")
elif IS_MAC:
os.chdir("dist")
# create a mozregression-gui subdirectory and make the dmg bundle that
os.mkdir("mozregression-gui")
os.rename(
"mozregression-gui.app", os.path.join("mozregression-gui", "mozregression-gui.app")
)
call(
"hdiutil", "create", "dist/mozregression-gui.dmg", "-srcfolder", "dist/", "-ov",
"hdiutil", "create", "mozregression-gui.dmg", "-srcfolder", "mozregression-gui", "-ov",
)
else:
with tarfile.open("mozregression-gui.tar.gz", "w:gz") as tar:
Expand Down
57 changes: 41 additions & 16 deletions gui/gui.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# -*- mode: python -*-
import sys
from PyInstaller.utils.hooks import collect_all

IS_MAC = sys.platform == "darwin"

block_cipher = None

datas, binaries, hiddenimports = [], [], []
Expand All @@ -22,19 +25,41 @@ a = Analysis(['mozregression-gui.py'],
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='mozregression-gui',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
runtime_tmpdir=None,
console=False,
icon='wininst/app_icon.ico')
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

if IS_MAC:
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='mozregression-gui',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=False,
icon='wininst/app_icon.ico')
app = BUNDLE(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='mozregression-gui.app',
icon='icons/app_icon.icns',
bundle_identifier=None)
else:
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='mozregression-gui',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
runtime_tmpdir=None,
console=False,
icon='wininst/app_icon.ico')
Binary file added gui/icons/app_icon.icns
Binary file not shown.
2 changes: 1 addition & 1 deletion gui/mozregui/ui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<enum>Qt::NoContextMenu</enum>
</property>
<property name="windowTitle">
<string>Mozregression-gui</string>
<string>mozregression-gui</string>
</property>
<property name="windowIcon">
<iconset resource="../../resources.qrc">
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test_launchers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

import os
import sys
import tempfile
import unittest

Expand Down Expand Up @@ -177,6 +178,7 @@ def test_launcher_deleted_whith_statement(self):
self.assertFalse(os.path.isdir(tempdir))


@pytest.mark.skipif(sys.platform == "darwin", reason="fails on macosx")
def test_firefox_install(mocker):
install_ext, binary_name = (
("zip", "firefox.exe")
Expand Down

0 comments on commit 5e938d0

Please sign in to comment.