在 wxpython 测试中使用 travis-ci
using travis-ci with wxpython tests
我正在尝试添加一些 wxPython 测试以使用 travis-ci,但我不知道如何在构建环境中安装 wxPython。我用 brew 在我的电脑上安装了 wxPython,但我无法让 brew 与 travis-ci 一起工作。在 travis-ci 文档中,brew 似乎应该是内置的:http://docs.travis-ci.com/user/installing-dependencies/#Installing-Mac-Packages,但据我所知它没有。如果我尝试使用 brew,我会收到此错误消息:
$ brew update
/home/travis/build.sh: line 41: brew: command not found
这是我在我的 .travis.yml 文件中尝试过的其他一些东西,以获得 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:
- 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
最终,我只想要wxPython,我不在乎我是如何得到它的。任何关于让 wxPython 与 travis-ci 一起工作的建议都会得到应用ci,或者深入了解为什么我不能让 brew 工作。谢谢!
编辑:
我尝试了一些新的东西并将这一行添加到我的 .travis.yml 文件中:
- sudo apt-get install -y python-wxgtk2.8
这似乎成功安装了 wxpython,但随后测试停止并出现以下错误消息:
if warn: warnings.warn(_use_error_msg)
Xlib: extension "RANDR" missing on display ":99.0".
测试超时。
一段时间以来,我一直在尝试做同样的事情。这是我发现的:
Travis-CI:
事情有点困难的原因之一是 Travis-CI 是 运行 Ubunutu 12.04,而 wxPython 只有 pre-built 11.04 的二进制文件。另一个原因是某些 ubuntu 包在 travis 上被禁止使用(尽管它们已被列入白名单)。
Python 2 和 wxPython 2.8:
这个非常简单,因为它在 ubuntu apt 存储库中。在您的 .travis.yml 文件中包含以下内容:
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
(我个人喜欢before_install
,但你也可以把它放在install
的顶部)。
对于 Python 3 和 wxPython Phoenix 3.0:
到目前为止,我一直没有成功。我试过:
- 使用 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
- 注意 pip 上的 -vvv:由于构建需要约 20 分钟,如果没有控制台输出(它假定 cmd 已锁定),Travis 将中止。添加详细信息可防止中止发生。
其中 和 none 已经完全工作。有些比其他的更进一步:例如,通过 pip
安装似乎可以通过 wxWidgets 配置并正常运行,但在 SIP 构建的某处失败(它也需要 20 分钟...)
希望我能尽快弄明白。
供应商:
我知道你只问了 Travis,但我使用 Travis + AppVeyor 来涵盖所有操作系统,所以我想其他人也这样做。不妨将所有信息放在一个地方。
这些要容易得多。只需为您想要的 wxPython 版本找到一个 pre-built wheel 文件,然后使用 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 文件进行安装。此位置有一些预构建可用:https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/
对我有用的 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 文件的位置是:
我正在尝试添加一些 wxPython 测试以使用 travis-ci,但我不知道如何在构建环境中安装 wxPython。我用 brew 在我的电脑上安装了 wxPython,但我无法让 brew 与 travis-ci 一起工作。在 travis-ci 文档中,brew 似乎应该是内置的:http://docs.travis-ci.com/user/installing-dependencies/#Installing-Mac-Packages,但据我所知它没有。如果我尝试使用 brew,我会收到此错误消息:
$ brew update
/home/travis/build.sh: line 41: brew: command not found
这是我在我的 .travis.yml 文件中尝试过的其他一些东西,以获得 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:
- 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
最终,我只想要wxPython,我不在乎我是如何得到它的。任何关于让 wxPython 与 travis-ci 一起工作的建议都会得到应用ci,或者深入了解为什么我不能让 brew 工作。谢谢!
编辑:
我尝试了一些新的东西并将这一行添加到我的 .travis.yml 文件中:
- sudo apt-get install -y python-wxgtk2.8
这似乎成功安装了 wxpython,但随后测试停止并出现以下错误消息:
if warn: warnings.warn(_use_error_msg)
Xlib: extension "RANDR" missing on display ":99.0".
测试超时。
一段时间以来,我一直在尝试做同样的事情。这是我发现的:
Travis-CI:
事情有点困难的原因之一是 Travis-CI 是 运行 Ubunutu 12.04,而 wxPython 只有 pre-built 11.04 的二进制文件。另一个原因是某些 ubuntu 包在 travis 上被禁止使用(尽管它们已被列入白名单)。
Python 2 和 wxPython 2.8:
这个非常简单,因为它在 ubuntu apt 存储库中。在您的 .travis.yml 文件中包含以下内容:
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
(我个人喜欢before_install
,但你也可以把它放在install
的顶部)。
对于 Python 3 和 wxPython Phoenix 3.0:
到目前为止,我一直没有成功。我试过:
- 使用 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
- 注意 pip 上的 -vvv:由于构建需要约 20 分钟,如果没有控制台输出(它假定 cmd 已锁定),Travis 将中止。添加详细信息可防止中止发生。
和 none 已经完全工作。有些比其他的更进一步:例如,通过 pip
安装似乎可以通过 wxWidgets 配置并正常运行,但在 SIP 构建的某处失败(它也需要 20 分钟...)
希望我能尽快弄明白。
供应商:
我知道你只问了 Travis,但我使用 Travis + AppVeyor 来涵盖所有操作系统,所以我想其他人也这样做。不妨将所有信息放在一个地方。
这些要容易得多。只需为您想要的 wxPython 版本找到一个 pre-built wheel 文件,然后使用 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 文件进行安装。此位置有一些预构建可用:https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/
对我有用的 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 文件的位置是: