From 54fac962e0194584b12d83c90063b66cdcf13e80 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 12 Mar 2018 11:42:57 -0400 Subject: [PATCH 01/18] initial travis config for OSX test script for klayout python binding build script w python3 filtering output to reduce log size (travis complains about >4Mb) Fixing exit code in macbuild Adding unit tests including long tests in ut_runner --- .travis.yml | 49 +++++++++++++++++++++++++++++++++++++++++++ Brewfile | 6 ++++++ filter-clang.sh | 3 +++ macbuild/build4mac.py | 2 -- test-pylib-script.py | 18 ++++++++++++---- 5 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 .travis.yml create mode 100644 Brewfile create mode 100644 filter-clang.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..2db5b7711 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,49 @@ +# qt app example with linux and mac: https://stackoverflow.com/questions/29721240/ci-for-qt-app-build-with-different-qt-versions + +matrix: + include: + - os: osx + osx_image: xcode9.3beta + env: + - MATRIX_EVAL="" + + # - os: osx + # osx_image: xcode8 + # env: + # - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" + + # - os: osx + # osx_image: xcode8 + # env: + # - MATRIX_EVAL="brew install gcc5 && CC=gcc-5 && CXX=g++-5" + + # - os: osx + # osx_image: xcode8 + # env: + # - MATRIX_EVAL="brew install gcc6 && CC=gcc-6 && CXX=g++-6" + + # - os: osx + # osx_image: xcode8 + # env: + # - MATRIX_EVAL="brew install gcc && CC=gcc-7 && CXX=g++-7" + +before_install: + - eval "${MATRIX_EVAL}" + - brew update + - brew bundle + +install: + - git clone https://github.com/kristovatlas/osx-config-check + - cd osx-config-check ; python2.7 app.py --report-only --skip-sudo-checks ; cd .. + +script: + - python3 build4mac.py -p B36 -q Qt5Brew -c + - source filter-clang.sh; python3 build4mac.py -p B36 -q Qt5Brew | filter + - python3 build4mac.py -p B36 -q Qt5Brew -y + - qt5.pkg.macos-HighSierra-release/klayout.app/Contents/MacOS/klayout -b -r test-pylib-script.py + - cd qt5.build.macos-HighSierra-release + - ln -s klayout.app/Contents/MacOS/klayout klayout + - export TESTTMP=testtmp # path to a directory that will hold temporary data (will be created) + - export TESTSRC=.. # path to the source directory + - ./ut_runner -h + - ./ut_runner -s diff --git a/Brewfile b/Brewfile new file mode 100644 index 000000000..53d3f65bc --- /dev/null +++ b/Brewfile @@ -0,0 +1,6 @@ +tap "homebrew/core" +brew "postgresql" +brew "mysql" +brew "python3" +brew "python@2", link: false +brew "qt" diff --git a/filter-clang.sh b/filter-clang.sh new file mode 100644 index 000000000..7697038a9 --- /dev/null +++ b/filter-clang.sh @@ -0,0 +1,3 @@ +filter () { + sed -E 's/^\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault\.xctoolchain\/usr\/bin\/clang\+\+ -c[[:space:]]+([^[:space:]]+[[:space:]]+)*/Compiling \1/' +} diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index 907226d2e..ae7b97c18 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -1012,8 +1012,6 @@ def main(): if not ret2 == 0: sys.exit(1) - else: - sys.exit(0) #=================================================================================== if __name__ == "__main__": diff --git a/test-pylib-script.py b/test-pylib-script.py index 52d1c0673..0325b5ba9 100644 --- a/test-pylib-script.py +++ b/test-pylib-script.py @@ -6,9 +6,20 @@ installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages]) print(installed_packages_list) +def get_pip_main(): + import pip + # check if pip version is new: + if int(pip.__version__.split('.')[0]) > 9: + from pip._internal import main + else: + from pip import main + return main + print("-------------") -if pip.main(['install', '--upgrade', 'numpy']) > 0: +pipmain = get_pip_main() + +if pipmain(['install', '--upgrade', 'numpy']) > 0: exit(1) print("-------------") @@ -18,12 +29,11 @@ import numpy print("-------------") -import sys; +import sys print("Executing from: ", sys.executable) print("-------------") import os print("Environment variables:") for variable, value in os.environ.items(): - print(variable, ":", value) - + print(variable, ":", value) \ No newline at end of file From 293fb905c1fb405643f49ed754d094f5acaffcc4 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Mon, 9 Jul 2018 16:49:47 -0400 Subject: [PATCH 02/18] Updated Homebrew Python version to 3.7 Updated travis.yml --- .travis.yml | 67 +++++++++++++-------------------------- macbuild/ReadMe.md | 12 +++---- macbuild/build4mac.py | 8 ++--- macbuild/build4mac_env.py | 12 +++---- 4 files changed, 38 insertions(+), 61 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2db5b7711..e1a2b7329 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,49 +1,26 @@ -# qt app example with linux and mac: https://stackoverflow.com/questions/29721240/ci-for-qt-app-build-with-different-qt-versions - matrix: include: - - os: osx - osx_image: xcode9.3beta - env: - - MATRIX_EVAL="" - - # - os: osx - # osx_image: xcode8 - # env: - # - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" - - # - os: osx - # osx_image: xcode8 - # env: - # - MATRIX_EVAL="brew install gcc5 && CC=gcc-5 && CXX=g++-5" - - # - os: osx - # osx_image: xcode8 - # env: - # - MATRIX_EVAL="brew install gcc6 && CC=gcc-6 && CXX=g++-6" - - # - os: osx - # osx_image: xcode8 - # env: - # - MATRIX_EVAL="brew install gcc && CC=gcc-7 && CXX=g++-7" - + - os: osx + osx_image: xcode9.3beta + env: + - MATRIX_EVAL="" before_install: - - eval "${MATRIX_EVAL}" - - brew update - - brew bundle - -install: - - git clone https://github.com/kristovatlas/osx-config-check - - cd osx-config-check ; python2.7 app.py --report-only --skip-sudo-checks ; cd .. - +- eval "${MATRIX_EVAL}" +- brew update +- brew bundle script: - - python3 build4mac.py -p B36 -q Qt5Brew -c - - source filter-clang.sh; python3 build4mac.py -p B36 -q Qt5Brew | filter - - python3 build4mac.py -p B36 -q Qt5Brew -y - - qt5.pkg.macos-HighSierra-release/klayout.app/Contents/MacOS/klayout -b -r test-pylib-script.py - - cd qt5.build.macos-HighSierra-release - - ln -s klayout.app/Contents/MacOS/klayout klayout - - export TESTTMP=testtmp # path to a directory that will hold temporary data (will be created) - - export TESTSRC=.. # path to the source directory - - ./ut_runner -h - - ./ut_runner -s +- python3 build4mac.py -p B37 -q Qt5Brew -c +- source filter-clang.sh; python3 build4mac.py -p B37 -q Qt5Brew | filter +- python3 build4mac.py -p B37 -q Qt5Brew -y + +deploy: + provider: s3 + access_key_id: AKIAIV2JJIENURARWFUQ + secret_access_key: + secure: LdxO80/boYFIa/6XuF1gi2V7vtoDFro+ImIcmf8ARKddYxjlLp31mVDt1ZezeYvjPt3T0KvDErMtez7Ea8yUPXayxLycAb5nEhP6QMTuW3QcSTllsG3Bpz1b1zCx4LiYWzYbmgqHru1kh3WhqQbKAgq4Xl5zIIE2yvWlGvpUf9mP586KGe5HJl6hbAJI8XdkJTjp48jHanKIUlxDDPrxon1i1GD+8PSl2JEvggRpp+mSaA5dJJJRYPNFlQn0T1TuHkRBErLqHYJ8qTSee72jMbTOVOPxuMy4KKdZt6bpDJiJccH2FJ87+qyXM/8dDQnlpWPVOgQhklFBMUmGkooVxfjphVLmBRNgkfohBC6DmKeIk/Os+TRvXjuL/SMwQ17jwKSRw/QPrIGwvGb2GdZ/jQCV0WWw3x/N8xlXZ2EhkLC8lznVuaf++CCC3qm0+ejojRFz7uFyqDvq9HPXHzllZTbTMI+6+QE5Gpi1s513iio/nRPYCLoyFe5144VfnlJCXxsC11jrous2HWo2YFJGqj0ipJdnit/Kolq+Shs2gTiGz0yb7f/JKsyA/N0Bz4npKlt7O1MmXyFjDJCfSn2WyfXjSYiyKu3fjkbf4e4AK5qsR2BcNlJXl6Z3ACLIS6OinRPFLZyCS24yQ0eNIR1Q5Xvg88vTUbyhDc2QsYpyP1Y= + bucket: danielwang + acl: bucket_owner_full_control + skip_cleanup: true + on: + repo: dwang/klayout + branch: travis-ci diff --git a/macbuild/ReadMe.md b/macbuild/ReadMe.md index f03e3ca97..9ea112376 100644 --- a/macbuild/ReadMe.md +++ b/macbuild/ReadMe.md @@ -31,7 +31,7 @@ Also by default, supported script languages, i.e, Ruby and Python, are those sta You may want to use a non-OS-standard script language such as Python 3.6 from Anaconda2 (https://www.anaconda.com/download/#macos) in combination with KLayout. Since Anaconda2 is a popular Python development environment, this is worth trying. Unfortunately, however, some dynamic linkage problems are observed as of today. -On the other hand, Python 3.6 provided by MacPorts or Homebrew is usable. +On the other hand, Python 3.7 provided by MacPorts or Homebrew is usable. Please try this (refer to 3B below or Section #5) if you feel it's useful. # 3. Use-cases @@ -90,20 +90,20 @@ $ ./makeDMG4mac.py -p qt5.pkg.macos-HighSierra-release -m # 5. Alternative building options -### 5.1 Python 3.6 from Homebrew, Qt 5.10.1 from Homebrew +### 5.1 Python 3.7 from Homebrew, Qt 5.10.1 from Homebrew Homebrew's installation of python3 (`brew install python3`) places a `Python.framework` in `/usr/local/opt/python/Frameworks/Python.framework/`, which you can use to build KLayout from. Qt can also be downloaded from brew with `brew install qt`. ``` # Build step -./build4mac.py -p B36 -q Qt5Brew +./build4mac.py -p B37 -q Qt5Brew # build with log -./build4mac.py -p B36 -q Qt5Brew 2>&1 | tee qt5.build.macos-HighSierra-release-version.log +./build4mac.py -p B37 -q Qt5Brew 2>&1 | tee qt5.build.macos-HighSierra-release-version.log # Deploy step -./build4mac.py -p B36 -q Qt5Brew -y # normal deploy -./build4mac.py -p B36 -q Qt5Brew -y -v 3 2>&1 | tee qt5.pkg.macos-HighSierra-release.log # deploy with debug options +./build4mac.py -p B37 -q Qt5Brew -y # normal deploy +./build4mac.py -p B37 -q Qt5Brew -y -v 3 2>&1 | tee qt5.pkg.macos-HighSierra-release.log # deploy with debug options # Packaging step ./makeDMG4mac.py -p qt5.pkg.macos-HighSierra-release -m -q Qt5101 diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index ae7b97c18..52cb46615 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -67,7 +67,7 @@ def SetGlobals(): Usage += " : Refer to 'macbuild/build4mac_env.py' for details | \n" Usage += " [-q|--qt ] : type=['Qt4MacPorts', 'Qt5MacPorts', 'Qt5Brew'] | qt5macports \n" Usage += " [-r|--ruby ] : type=['nil', 'Sys', 'Src24', 'MP24', 'B25'] | sys \n" - Usage += " [-p|--python ] : type=['nil', 'Sys', 'Ana27', 'Ana36', 'MP36', 'B36'] | sys \n" + Usage += " [-p|--python ] : type=['nil', 'Sys', 'Ana27', 'Ana36', 'MP36', 'B37'] | sys \n" Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n" Usage += " [-m|--make