How to build MacOSX executables on Travis CI?

Björn Johansson

I have a small python program that depends only on wxPython. I developed this on Linux and I have managed to set up automatic build of a windows executable using wine on Travis CI (seguid_calculator on github).

My solution involves a combination of a recent wine release and Pyinstaller.

I would like to do a similar thing for MacOS. I understand that there is a MacOSX build environment on Travis as well. I have zero experience with the MacOSX os and I do not own a Mac. I have understood that you can install third party packages using something called "homebrew"

Is there an example out there for what I would like to do? An example travis.yml file would be great!

Thanks for any input, /Björn

* Edit *

I have created a sample wxpython app that only opens a window. It is located at https://github.com/BjornFJohansson/macapp. I uses the .travis.yml below which produces executables that do not work.

os:
- osx
language: objective-c
python:
- '2.7'
before_install:
- brew update
- brew outdated xctool || brew upgrade xctool
- brew install python
- brew install wxpython
- pip install pyinstaller
- pyinstaller --noconsole --onefile hw.py
- ls
- ls dist/
- hdiutil create dist/hw.dmg -srcfolder dist/ -ov
install: true
deploy:
  skip_cleanup: true
  provider: releases
  api_key:
    secure: VK1oVWQCRomgcFNVua00B3YSsotezzU1p6/fh73/0vwQFzVMolVnAsnfSq6EAwIcJvakU0TI9pqZR+0S3PKnUs+Kn3Ar8OwQ88t2azZNwewBfKua3tM2/7BF4y7O0gOtN1F29Yxyu0zPInIVY17BqGygibQ1kthBTm+tj3YyNW8=
  file: 
    - "dist/hw"
    - "dist/hw.dmg"
  on:
    tags: true
    all_branches: true
    repo: BjornFJohansson/macapp

basically, first I update xtools (I have seen many do this, so I decided to do it as well). Then I brew install python and wxpython. Then I pip install pyinstaller. I use the pyinstaller command which produces an executable (hw) and an "hw.app" folder under ./dist.

I didnt manage to deploy the .app folder, so I make a .dmg using hdiutil. I then deploy to github releases.

Could someone tell me what might be wrong with this set up?

The travis log can be found here : https://travis-ci.org/BjornFJohansson/macapp

user1322192

The reason why it didn't work ist that the wxPython version installed via homebrew is not 32bit. You need to install the dmg from the wxPython homepage. I found a script that does that there: https://github.com/ayufan/travis-osx-vm-templates/blob/master/scripts/packages.sh

I forked your example and managed to get it running (https://github.com/paulmueller/macapp/releases).

.travis.yml now looks like this:

language: objective-c
python:
- '2.7'
before_install:
- which python
- brew install python --universal --framework
- brew install wget
- which python
- export VERSIONER_PYTHON_PREFER_32_BIT=yes
- defaults write com.apple.versioner.python Prefer-32-Bit -bool yes
- which python
- python --version
# https://github.com/Homebrew/homebrew/issues/34470
#- arch -i386 brew install wxpython --universal
- mkdir dl
- cd dl
- wget http://downloads.sourceforge.net/wxpython/wxPython3.0-osx-3.0.2.0-cocoa-py2.7.dmg
- ls
- cd ..
- sudo ./packages.sh
- arch -i386 python -c "import wx; print wx.__version__"
- arch -i386 pip install pyinstaller
- arch -i386 pyinstaller --noconsole --onefile hw.py
- ls
- hdiutil create dist/hw.dmg -srcfolder dist/ -ov
- zip -r dist/hw.zip dist/hw.app
- ls dist/
install: true
deploy:
  provider: releases
  skip_cleanup: true
  api_key:
    secure: KjdN4hSHWU3ZDg6lpDNMB2we9jLayM9C8pwyQrV/Xzq8HNH5eNHP8ScI64tvnS0yJegOXnHFwUhUrkMtEs3X29TKrom+8tJ5E52IdBO7xO8fqOfeugC2239vLzc3tNI6RJX/K7CZTsSRu5U++1RJVgcWYjrCln87DuXG+HZRdOI=
  file: 
    - "dist/hw.dmg"
    - "dist/hw.zip"
  on:
    tags: true
    all_branches: true
    repo: paulmueller/macapp

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  7. 7

    Do Idle Snowflake Connections Use Cloud Services Credits?

  8. 8

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  9. 9

    Binding element 'string' implicitly has an 'any' type

  10. 10

    BigQuery - concatenate ignoring NULL

  11. 11

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  12. 12

    In Skype, how to block "User requests your details"?

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Pandas - check if dataframe has negative value in any column

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Generate random UUIDv4 with Elm

  17. 17

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  18. 18

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  19. 19

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  20. 20

    EXCEL: Find sum of values in one column with criteria from other column

  21. 21

    How to use merge windows unallocated space into Ubuntu using GParted?

HotTag

Archive