将travis ci与wxpython测试结合使用

将travis ci与wxpython测试结合使用,python,wxpython,homebrew,travis-ci,Python,Wxpython,Homebrew,Travis Ci,我试图添加一些wxPython测试来使用travisci,但是我不知道如何在构建环境中安装wxPython。我使用brew在我的计算机上安装wxPython,但我无法让brew与travis ci一起工作。在travis ci文档中,brew似乎应该是内置的,但据我所知,它不是。如果我尝试使用brew,我会收到以下错误消息: $ brew update /home/travis/build.sh: line 41: brew: command not found The command "ru

我试图添加一些wxPython测试来使用travisci,但是我不知道如何在构建环境中安装wxPython。我使用brew在我的计算机上安装wxPython,但我无法让brew与travis ci一起工作。在travis ci文档中,brew似乎应该是内置的,但据我所知,它不是。如果我尝试使用brew,我会收到以下错误消息:

$ brew update
/home/travis/build.sh: line 41: brew: command not found
The command "ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"" failed and exited with 1 during .
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
make: *** [.pch/wxprec_coredll/wx/wxprec.h.gch] Error 4
make: *** Waiting for unfinished jobs....
make: *** [.pch/wxprec_mediadll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_auidll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_richtextdll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_gldll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_stcdll/wx/wxprec.h.gch] Error 4
Error building
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "build-wxpython.py", line 378, in <module>
wxbuild.main(wxscript, build_options)
File "/home/travis/build/ltauxe/PmagPy/wxPython-src2.9.4.0/build/tools/build-wxwidgets.py", line 470, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "/home/travis/build/ltauxe/PmagPy/wxPython-src-2.9.4.0/build/tools/build-wxwidgets.py", line 74, in exitIfError
raise builder.BuildError(msg)
BuildError
The command "python build-wxpython.py --build_dir=../bld" failed and exited with 1 during .
if warn: warnings.warn(_use_error_msg)
Xlib:  extension "RANDR" missing on display ":99.0".
以下是我在.travis.yml文件中尝试获取brew/wxPython的一些其他方法:

- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
生成此错误消息:

$ brew update
/home/travis/build.sh: line 41: brew: command not found
The command "ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"" failed and exited with 1 during .
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
make: *** [.pch/wxprec_coredll/wx/wxprec.h.gch] Error 4
make: *** Waiting for unfinished jobs....
make: *** [.pch/wxprec_mediadll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_auidll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_richtextdll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_gldll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_stcdll/wx/wxprec.h.gch] Error 4
Error building
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "build-wxpython.py", line 378, in <module>
wxbuild.main(wxscript, build_options)
File "/home/travis/build/ltauxe/PmagPy/wxPython-src2.9.4.0/build/tools/build-wxwidgets.py", line 470, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "/home/travis/build/ltauxe/PmagPy/wxPython-src-2.9.4.0/build/tools/build-wxwidgets.py", line 74, in exitIfError
raise builder.BuildError(msg)
BuildError
The command "python build-wxpython.py --build_dir=../bld" failed and exited with 1 during .
if warn: warnings.warn(_use_error_msg)
Xlib:  extension "RANDR" missing on display ":99.0".
然后我试着:

- mkdir homebrew && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C homebrew
- brew install wxpython
这给了我:

The command "brew install wxpython" failed and exited with 127 during .
我还尝试通过以下方式直接安装wxPython:

- sudo apt-get update -qq                                                                         
- sudo apt-get install -qq libgtk2.0-dev libgtkglextmm-x11-1.2-dev libgtkmm-2.4-dev               
- sudo apt-get install python-dev                                                                 
- sudo apt-get install libboost-python-dev libboost-signals-dev                                   
- sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev                     
- wget http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.b\z2                                                                                                   
- tar xf wxPython-src-2.9.4.0.tar.bz2                                                             
- cd wxPython-src-2.9.4.0/                                                                        
- wget http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.1.patch
- patch -p0 < wxPython-src-2.9.4.1.patch                                                          
- cd wxPython/                                                                                    
## fails at this step:                                                                                    
- python build-wxpython.py --build_dir=../bld                                                     
- cd ..                                                                                           
- export PYTHONPATH="$PWD/wxPython"                                                               
- export LD_LIBRARY_PATH="$PWD/bld/lib"                                                           
- cd .. 
这似乎成功安装了wxpython,但随后测试暂停,并显示以下错误消息:

$ brew update
/home/travis/build.sh: line 41: brew: command not found
The command "ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"" failed and exited with 1 during .
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
make: *** [.pch/wxprec_coredll/wx/wxprec.h.gch] Error 4
make: *** Waiting for unfinished jobs....
make: *** [.pch/wxprec_mediadll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_auidll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_richtextdll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_gldll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_stcdll/wx/wxprec.h.gch] Error 4
Error building
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "build-wxpython.py", line 378, in <module>
wxbuild.main(wxscript, build_options)
File "/home/travis/build/ltauxe/PmagPy/wxPython-src2.9.4.0/build/tools/build-wxwidgets.py", line 470, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "/home/travis/build/ltauxe/PmagPy/wxPython-src-2.9.4.0/build/tools/build-wxwidgets.py", line 74, in exitIfError
raise builder.BuildError(msg)
BuildError
The command "python build-wxpython.py --build_dir=../bld" failed and exited with 1 during .
if warn: warnings.warn(_use_error_msg)
Xlib:  extension "RANDR" missing on display ":99.0".

测试超时了

很长一段时间以来,我一直在尝试做同样的事情。以下是我的发现:

特拉维斯·西: 事情有点困难的原因之一是Travis CI正在运行Ubunutu 12.04,而wxPython只有11.04之前的预构建二进制文件。另一个原因是一些ubuntu软件包在travis上是不允许的(尽管它们后来被列入了白名单)


Python 2和wxPython 2.8: 这个很简单,因为它在ubuntu apt存储库中。在.travis.yml文件中包含以下内容:

- sudo apt-get install -y python-wxgtk2.8
addons:
  apt:
    packages:
      # for wxPython:
      - python-wxgtk2.8
      - python-wxtools
      - wx2.8-doc
      - wx2.8-examples
      - wx2.8-headers
      - wx2.8-i18n


对于Python 2和wxPython 3.0(经典版,非Phoenix版): 您可以使用Conda在wxPython上安装它。以下是.travis.yml的相关部分:

before_install:
  # get Conda
  - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
      wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
    else
      wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
    fi
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - hash -r
  - conda config --set always_yes yes --set changeps1 no
  - conda update -q conda
  # Useful for debugging any issues with conda
  - conda info -a

install:
  # install wxPython 3.0.0.0
  - conda install -c https://conda.anaconda.org/travis wxpython
(我个人喜欢安装前的
,但是你也可以把它放在
安装的顶部)


对于Python 3和wxPython Phoenix 3.0: 到目前为止,我在这方面一直不成功。我试过:

  • 使用wxPython提供的build/build.py脚本从源代码构建
  • 以标准linux方式从源代码构建(
    configure
    make
    makeinstall
  • 使用康达
  • pip安装--升级--预信任主机wxpython.org-vvv-fhttp://wxpython.org/Phoenix/snapshot-builds/ 凤凰城wxPython_

    • 注意pip上的-vvv:由于构建需要约20分钟,如果没有控制台输出,Travis将中止(它假设cmd已锁定)。添加详细信息可以防止中止的发生
而且没有一个能完全发挥作用。有些人比其他人走得更远:例如,通过
pip
安装似乎通过了wxWidgets的配置,并做得很好,但在SIP构建的某个地方失败了(也需要20分钟…)

希望我能很快找到答案


验船师: 我知道你只问过Travis,但我使用Travis+AppVeyor来涵盖所有操作系统,所以我想其他人也会这么做。最好把所有的信息都放在一个地方

这些要容易得多。只需找到您想要的wxPython版本的预构建控制盘文件,并使用
pip
安装它:

- "%CMD_IN_ENV% pip install --upgrade --pre http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev1820+49a8884-cp34-none-win32.whl"

对于wxpython的较新版本,您需要使用pip和wheel文件进行安装。此位置有一些预构建可用:

为我工作的travis文件是:

language: python
python:
  - "3.5.3"

addons:
  apt:
    packages:
    - libwebkitgtk-dev
    - libjpeg-dev
    - libtiff-dev
    - libgtk2.0-dev
    - libsdl1.2-dev
    - libgstreamer-plugins-base0.10-dev
    - freeglut3
    - freeglut3-dev
    - libnotify-dev

# command to install dependencies
install: 
  - sudo apt-get update
  - wget "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/wxPython-4.0.0b1-cp35-cp35m-linux_x86_64.whl"
  - pip install wxPython-4.0.0b1-cp35-cp35m-linux_x86_64.whl 

script: nosetests -v --with-id  --with-coverage --with-html --cover-package=./
请注意,whl文件的位置为:

  • 官方发布位于以下位置:
  • 预发布版本如下所示:

您的travis ci服务器是否安装了X11或其他GUI界面?我的.travis.yml文件中有以下行:-“导出显示=:99.0”-“sh-e/etc/init.d/xvfb start”。这适用于我之前测试的一些tkinter/matplotlib东西。这就是你的意思吗?这是2岁。。。“你成功了吗?”特雷比亚说。遗憾的是,没有,我从来没能让它工作。然而,现在WxPythonPhoenix的PyPI上有Windows和MacOS控制盘,所以至少这两个现在很容易安装。正如我刚才在下面看到的,快照构建中有Linux控制盘可用。这些是预发布的快照构建。一些linux发行版的发布版本可以在这里找到:@robindurn谢谢你的提示,我在我的项目中按照你的建议进行了测试,仔细检查并更新了帖子,所以任何寻找这篇文章的人都会得到正确的信息。快速提问,为了能够批量测试(在我的电脑中可以),我现在正在努力使用显示器,你知道我该怎么做吗?谢谢!