在wxpython测试中使用travis-ci [英] using travis-ci with wxpython tests
问题描述
我正在尝试添加一些与travis-ci一起使用的wxPython测试,但是我不知道如何在构建环境中安装wxPython.我使用brew在计算机上安装了wxPython,但是我无法使brew与travis-ci一起使用.在travis-ci文档中,似乎brew应该是内置的:
I'm trying to add some wxPython tests to work with travis-ci, but I can't figure out how to install wxPython in the build environment. I used brew to install wxPython on my computer, but I can't get brew to work with travis-ci. In the travis-ci docs, it appears that brew should come built-in: http://docs.travis-ci.com/user/installing-dependencies/#Installing-Mac-Packages, but as far as I can tell it doesn't. If I try to use brew, I get this error message:
$ brew update
/home/travis/build.sh: line 41: brew: command not found
以下是我在.travis.yml文件中尝试过的一些其他操作,以获取brew/wxPython:
Here are some other things I've tried in my .travis.yml file to get brew/wxPython:
- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
产生此错误消息:
The command "ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"" failed and exited with 1 during .
然后我尝试:
- 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:
I also tried to install wxPython directly this way:
- 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 ..
给出了此错误消息:
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 .
您可以在此处查看我的.travis.yml文件: https ://github.com/ltauxe/PmagPy/blob/travis-ci/.travis.yml
You can look at my .travis.yml file here: https://github.com/ltauxe/PmagPy/blob/travis-ci/.travis.yml
最终,我只想要wxPython,而且我不在乎如何获得它.关于使wxPython与travis-ci一起使用的任何建议将不胜感激,或者对为什么我无法使brew工作起作用有深刻的见解.谢谢!
Ultimately, I just want wxPython, and I don't care how I get it. Any suggestions on getting wxPython to work with travis-ci would be appreciated, or insight into why I can't get brew to work. Thanks!
我尝试了一些新操作,并将此行添加到我的.travis.yml文件中:
I've tried something new and added this line to my .travis.yml file:
- sudo apt-get install -y python-wxgtk2.8
这似乎已成功安装了wxpython,但是随后测试停止并显示以下错误消息:
This seems to install wxpython successfully, but then the testing stalls with this error message:
if warn: warnings.warn(_use_error_msg)
Xlib: extension "RANDR" missing on display ":99.0".
并且测试超时.
推荐答案
一段时间以来,我一直在尝试做同样的事情.这是我发现的东西:
I've been trying to do the same thing for quite some time. Here's what I've found:
出现一些困难的原因之一是Travis-CI正在运行Ubunutu 12.04,而wxPython仅具有预编译的二进制文件,最高版本为11.04.另一个原因是travis禁止使用某些ubuntu软件包(尽管此后已将其列入白名单).
One of the reasons things are a little difficult is that Travis-CI is running Ubunutu 12.04, and wxPython only has pre-built binaries up to 11.04. Another reason was that some ubuntu packages were disallowed on travis (though they have since been whitelisted).
这是很容易的,因为它在ubuntu apt仓库中. .travis.yml文件中包含以下内容:
This one is pretty easy, since it's in the ubuntu apt repositories. Have the following in your .travis.yml file:
addons:
apt:
packages:
# for wxPython:
- python-wxgtk2.8
- python-wxtools
- wx2.8-doc
- wx2.8-examples
- wx2.8-headers
- wx2.8-i18n
您可以使用Conda来安装wxPython.这是.travis.yml的相关部分:
You can use Conda to install it wxPython. Here's the relevent portion of .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
(我个人在before_install
中喜欢它,但您也可以将其放在install
的顶部).
(I personally like it in before_install
, but you could also put this towards the top of install
).
到目前为止,我还没有成功.我尝试过:
I've so far been unsuccessful with this. I've tried:
- 使用wxPython提供的build/build.py脚本从源代码构建
- 以标准linux方式(
configure
,make
,make install
)从源代码构建 - 使用conda
-
pip install --upgrade --pre --trusted-host wxpython.org -vvv -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix
- building from source using the build/build.py script provided by wxPython
- building from source in the standard linux way (
configure
,make
,make install
) - using conda
pip install --upgrade --pre --trusted-host wxpython.org -vvv -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix
- 注意pip上的-vvv:由于构建需要大约20分钟的时间,因此如果没有控制台输出,Travis将中止(假定cmd已锁定).添加详细程度可防止中止的发生.
,但它们都没有完全起作用.有些比其他方法更进一步:例如,通过pip
安装似乎可以通过wxWidgets配置进行配置,并且效果很好,但是在SIP构建中的某处失败(也需要20分钟...)
and none of them have worked completely. Some got further than others: for example, installing via pip
appears to get through the wxWidgets configure and make just fine, but fails somewhere in the SIP build (it also takes 20 minutes...)
希望我很快能弄清楚.
我知道您只询问过Travis,但是我使用Travis + AppVeyor涵盖了所有操作系统,因此我认为其他人也可以这样做.最好将所有信息都放在一个地方.
I know you only asked about Travis, but I use Travis + AppVeyor to cover all operating systems so I figured others do the same. Might as well keep all the info in one place.
这些要容易得多.只需找到所需wxPython版本的预构建wheel文件,然后使用pip
:
These are much, much easier. Simply find a pre-built wheel file for the version of wxPython that you want and install it with 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测试中使用travis-ci的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!