如何在travis构建期间更新tox上的setuptools

时间:2014-07-12 15:37:12

标签: python build setuptools travis-ci tox

我正在尝试使用最新版本的setuptools开发python程序。但每次我的构建失败时都会显示以下消息:

$ tox -e $TOX_ENV

GLOB sdist-make: /home/travis/build/kartoch/myapp/setup.py

py26 create: /home/travis/build/kartoch/myapp/.tox/py26

py26 inst: /home/travis/build/kartoch/myapp/.tox/dist/myapp-0.1.0.zip

ERROR: invocation failed, logfile: /home/travis/build/kartoch/myapp/.tox/py26/log/py26-1.log

[...]

Unpacking ./.tox/dist/myap-0.1.0.zip

Running setup.py (path:/tmp/pip-P4VhFx-build/setup.py) egg_info for package from file:///home/travis/build/kartoch/myapp/.tox/dist/myapp-0.1.0.zip

The required version of setuptools (>=5.4.1) is not available,

and can't be installed while this script is running. Please

install a more recent version first, using

'easy_install -U setuptools'.

(Currently using setuptools 3.6 (/home/travis/build/kartoch/myapp/.tox/py26/lib/python2.6/site-packages))

Complete output from command python setup.py egg_info:

到目前为止,问题是:

  • 在travis.yml中更新/重新安装setuptools没有任何效果,因为' virtualenv'由tox生成的以前的setuptools
  • 在通过tox调用setup.py之前无法升级/重新安装setuptools(在此步骤之后安装了依赖项)

有什么想法吗?

我使用以下' .travis.yml'

启动我的测试
language: python
env:
  - TOX_ENV=py26
  - TOX_ENV=py27
install:
  - pip install tox
script: 
  - tox -e $TOX_ENV

tox配置(' tox.ini')如下:

[tox]
envlist = py26, py27

[testenv]
commands =
    nosetests

[testenv:py26]

[testenv:py27]

3 个答案:

答案 0 :(得分:6)

使用:

[testenv]
deps =
  setuptools==5.4.1  # Or whatever version you need
commands =
  nosetests

答案 1 :(得分:5)

我能够通过向install部分添加更新的setuptools来解决这个问题:

install:
  - pip install -U pip wheel
  - pip install setuptools==24.0.3
  - pip install -r ourapp/requirements/requirements.txt

答案 2 :(得分:1)

tox.ini

deps =
    setuptools=38.2.5

它将在tox环境中阻止使用此版本的初始python安装。然后avec将安装鸡蛋所需的那个。