diff --git a/.travis.yml b/.travis.yml index 2c4493af2..0ce3c486d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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 diff --git a/gui/build.py b/gui/build.py index 1c35041af..83ef90272 100644 --- a/gui/build.py +++ b/gui/build.py @@ -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: diff --git a/gui/gui.spec b/gui/gui.spec index 04a71c5df..03d7f0e96 100644 --- a/gui/gui.spec +++ b/gui/gui.spec @@ -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 = [], [], [] @@ -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') diff --git a/gui/icons/app_icon.icns b/gui/icons/app_icon.icns new file mode 100644 index 000000000..ee990b50e Binary files /dev/null and b/gui/icons/app_icon.icns differ diff --git a/gui/mozregui/ui/mainwindow.ui b/gui/mozregui/ui/mainwindow.ui index 0176f14bb..27f048100 100644 --- a/gui/mozregui/ui/mainwindow.ui +++ b/gui/mozregui/ui/mainwindow.ui @@ -14,7 +14,7 @@ Qt::NoContextMenu - Mozregression-gui + mozregression-gui diff --git a/tests/unit/test_launchers.py b/tests/unit/test_launchers.py index b1bc23f63..bb167e6df 100644 --- a/tests/unit/test_launchers.py +++ b/tests/unit/test_launchers.py @@ -1,6 +1,7 @@ from __future__ import absolute_import import os +import sys import tempfile import unittest @@ -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")