2017-07-14 77 views
1

我在github上的PyQt5項目,下面是我的環境設置:如何縮短在travis上構建pyqt5環境的時間?

dist: trusty 
sudo: required 
language: python 

python: 
- 3.4 
- 3.5 

before_install: 
    #SIP 
    - cd .. 
    - curl -L -O "https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.3/sip-4.19.3.tar.gz" 
    - tar -xvf sip-4.19.3.tar.gz 
    - cd sip-4.19.3 
    - python configure.py 
    - sudo make install 
    #Qt5 
    - sudo add-apt-repository -y "ppa:beineri/opt-qt59-trusty" 
    - sudo apt-get update -qq 
    - sudo apt-get install qt59-meta-full qt59charts-no-lgpl 
    - QTDIR="/opt/qt59" 
    - PATH="$QTDIR/bin:$PATH" 
    - source /opt/qt59/bin/qt59-env.sh 
    - qmake -v 
    #PyQt5 
    - cd .. 
    - curl -L -O "https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.9/PyQt5_gpl-5.9.tar.gz" 
    - tar -xvf PyQt5_gpl-5.9.tar.gz 
    - cd PyQt5_gpl-5.9 
    - python configure.py --confirm-license 
    - sudo make install 
    #QScintilla 
    - cd .. 
    - curl -L -O "https://sourceforge.net/projects/pyqt/files/QScintilla2/QScintilla-2.10.1/QScintilla_gpl-2.10.1.tar.gz" 
    - tar -xvf QScintilla_gpl-2.10.1.tar.gz 
    - cd QScintilla_gpl-2.10.1 
    - cd Qt4Qt5 
    - qmake qscintilla.pro 
    - sudo make install 
    - cd ../designer-Qt4Qt5 
    - qmake designer.pro 
    - sudo make install 
    - cd ../Python 
    - python configure.py --pyqt=PyQt5 
    - sudo make install 
    #PyQtChart 
    - cd ../.. 
    - curl -L -O "https://sourceforge.net/projects/pyqt/files/PyQtChart/PyQtChart-5.9/PyQtChart_gpl-5.9.tar.gz" 
    - tar -xvf PyQtChart_gpl-5.9.tar.gz 
    - cd PyQtChart_gpl-5.9 
    - python configure.py 
    - sudo make install 
    - cd $TRAVIS_BUILD_DIR 

install: 
    - pip install -r requirements.txt 
    - pip install pyinstaller 

script: 
- make 

before_cache: 
    - rm -rf $HOME/.cache/pip/log 
cache: 
    directories: 
    - $HOME/.cache/pip 

我的項目需要SIP,PyQt的5.7以上(PyQtChart),QScintilla和一些Python模塊。

可以想象它已經超過了50分鐘。

有什麼辦法讓這些步驟更快?

回答

1

這是比適當的修復更多的解決方法,但我一直在使用miniconda成功地爲我安裝pyqt。這不是非常快,但比你現在做的要快很多。

以下行讓您進入安裝與PyQt的一個python虛擬環境:

wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; 
bash ./miniconda.sh -b -p ${HOME}/miniconda; 
export PATH=${HOME}/miniconda/bin:$PATH; 
conda install --yes python="2.7" pyqt; 

另一種解決辦法是使用暴露在這裏保持非官方的PyPI:https://github.com/pyqt/python-qt5

通過運行pip install python-qt5。請記住,這不是官方的,可能會打破/失效。使用風險自負。

另外,請記住,在Python 3.5及以上,你可以通過簡單地運行

pip3 install pyqt5 

最後但並非最不重要的安裝使用PIP pyqt5,Travis的維護者可能願意加入PyQt的基礎,因爲一部分他們自己的環境,無論是預先安裝的還是作爲預編譯的二進制文件提供,以便使用pip進行安裝。

我會+1任何此類請求。