gpt4 book ai didi

python - 为什么 TravisCI 找不到我的许可证文件?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:15:46 24 4
gpt4 key购买 nike

Travis-CI 不会构建我的项目,并发出此错误:

...
running egg_info
creating myproject.egg-info
writing requirements to myproject.egg-info/requires.txt
writing myproject.egg-info/PKG-INFO
writing top-level names to myproject.egg-info/top_level.txt
writing dependency_links to myproject.egg-info/dependency_links.txt
writing manifest file 'myproject.egg-info/SOURCES.txt'
reading manifest file 'myproject.egg-info/SOURCES.txt'
writing manifest file 'myproject.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-x86_64-2.6/myproject/test/unit/hang.so -> myproject/test/unit
GLOB sdist-make: /home/travis/build/myteam/myproject/setup.py
py27 create: /home/travis/build/myteam/myproject/.tox/py27
py27 installdeps: -rrequirements.txt
py27 inst: /home/travis/build/myteam/myproject/.tox/dist/myproject-0.0.1.zip
ERROR: invocation failed, logfile: /home/travis/build/myteam/myproject/.tox/py27/log/py27-2.log
ERROR: actionid=py27
msg=installpkg
cmdargs=[local('/home/travis/build/myteam/myproject/.tox/py27/bin/pip'), 'install', '--pre', '/home/travis/build/myteam/myproject/.tox/dist/myproject-0.0.1.zip']
env={'GOPATH': '/home/travis/.gvm/pkgsets/go1.1.1/global', 'COMPOSER_NO_INTERACTION': '1', 'rvm_version': '1.21.3 (latest-minor)', 'GOROOT': '/home/travis/.gvm/gos/go1.1.1', 'gvm_pkgset_name': 'global', 'TIMEZONE': 'UTC', 'rvm_path': '/home/travis/.rvm', 'GVM_PATH_BACKUP': '/home/travis/.gvm/bin:/usr/local/gradle/bin:/home/travis/.rvm/gems/ruby-1.9.3-p448/bin:/home/travis/.rvm/gems/ruby-1.9.3-p448@global/bin:/home/travis/.rvm/rubies/ruby-1.9.3-p448/bin:/home/travis/.rvm/bin:/usr/local/pypy/bin:/usr/local/phantomjs/bin:/home/travis/.nvm/v0.10.12/bin:./node_modules/.bin:/home/travis/.gvm/pkgsets/go1.1.1/global/bin:/home/travis/.gvm/gos/go1.1.1/bin:/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/bin:/home/travis/.gvm/bin:/home/travis/.gvm/bin:/usr/local/gradle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'TRAVIS': 'true', 'SSH_CLIENT': '2607:f700:8000:12e:7056:7d4a:a406:dac4 35103 22', 'LOGNAME': 'travis', 'USER': 'travis', 'NVM_DIR': '/home/travis/.nvm', 'HOME': '/home/travis', 'TRAVIS_REPO_SLUG': 'myteam/myproject', 'PATH': '/home/travis/build/myteam/myproject/.tox/py27/bin:/home/travis/virtualenv/python2.6/bin:/usr/local/pypy/bin:/usr/local/phantomjs/bin:./node_modules/.bin:/home/travis/.gvm/pkgsets/go1.1.1/global/bin:/home/travis/.gvm/gos/go1.1.1/bin:/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/bin:/home/travis/.gvm/bin:/home/travis/.gvm/bin:/usr/local/gradle/bin:/home/travis/.rvm/gems/ruby-1.9.3-p448/bin:/home/travis/.rvm/gems/ruby-1.9.3-p448@global/bin:/home/travis/.rvm/rubies/ruby-1.9.3-p448/bin:/home/travis/.rvm/bin:/usr/local/pypy/bin:/usr/local/phantomjs/bin:/home/travis/.nvm/v0.10.12/bin:./node_modules/.bin:/home/travis/.gvm/pkgsets/go1.1.1/global/bin:/home/travis/.gvm/gos/go1.1.1/bin:/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/bin:/home/travis/.gvm/bin:/home/travis/.gvm/bin:/usr/local/gradle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'TRAVIS_PULL_REQUEST': 'false', 'LD_LIBRARY_PATH': '/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/lib:/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/lib:', 'rvm_ruby_string': 'ruby-1.9.3-p448', 'LANG': 'en_US.UTF-8', 'MAVEN_OPTS': '-Xmx512m -XX:MaxPermSize=192m', 'TERM': 'xterm', 'SHELL': '/bin/bash', 'TRAVIS_TEST_RESULT': '0', 'rvm_prefix': '/home/travis', 'TRAVIS_BRANCH': 'develop', 'SHLVL': '3', 'TRAVIS_SECURE_ENV_VARS': 'false', 'HAS_ANTARES_THREE_LITTLE_FRONZIES_BADGE': 'true', 'MERB_ENV': 'test', 'NVM_BIN': '/home/travis/.nvm/v0.10.12/bin', 'NVM_PATH': '/home/travis/.nvm/v0.10.12/lib/node', 'GIT_ASKPASS': 'echo', 'VIRTUAL_ENV_DISABLE_PROMPT': 'true', 'TRAVIS_BUILD_ID': '12957294', 'rvm_env_string': 'ruby-1.9.3-p448', 'MANPATH': '/home/travis/.nvm/v0.10.12/share/man:', 'GVM_ROOT': '/home/travis/.gvm', 'JAVA_HOME': '/usr/lib/jvm/java-7-oracle', 'GVM_VERSION': '1.0.18', 'rvm_bin_path': '/home/travis/.rvm/bin', 'CI': 'true', 'RAILS_ENV': 'test', 'JRUBY_OPTS': '--server -Xcext.enabled=false -Xcompile.invokedynamic=false -J-Xss2m -J-Xmx256m -J-XX:+TieredCompilation', 'DEBIAN_FRONTEND': 'noninteractive', 'gvm_go_name': 'go1.1.1', 'TRAVIS_JOB_NUMBER': '7.1', 'IRBRC': '/home/travis/.rvm/rubies/ruby-1.9.3-p448/.irbrc', 'LC_CTYPE': 'en_US.UTF-8', 'TRAVIS_JOB_ID': '12957295', 'MY_RUBY_HOME': '/home/travis/.rvm/rubies/ruby-1.9.3-p448', 'PKG_CONFIG_PATH': '/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/lib/pkgconfig:/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/lib/pkgconfig:', 'TRAVIS_COMMIT': '27e740905a7da68718f994b5d854633844b16438', 'PLAT': 'linux-x86_64', 'LC_ALL': 'en_US.UTF-8', '_': '/home/travis/virtualenv/python2.6/bin/python', 'DYLD_LIBRARY_PATH': '/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/lib:/home/travis/.gvm/pkgsets/go1.1.1/global/overlay/lib:', 'VIRTUAL_ENV': '/home/travis/virtualenv/python2.6', 'TZ': 'UTC', 'RUBY_VERSION': 'ruby-1.9.3-p448', 'TRAVIS_PYTHON_VERSION': '2.6', 'SSH_TTY': '/dev/pts/1', 'OLDPWD': '/home/travis/build', 'TRAVIS_BUILD_NUMBER': '7', 'TRAVIS_BUILD_DIR': '/home/travis/build/myteam/myproject', 'GEM_PATH': '/home/travis/.rvm/gems/ruby-1.9.3-p448:/home/travis/.rvm/gems/ruby-1.9.3-p448@global', 'PYTHONIOENCODING': 'utf_8', 'PWD': '/home/travis/build/myteam/myproject', 'HAS_JOSH_K_SEAL_OF_APPROVAL': 'true', 'GVM_OVERLAY_PREFIX': '/home/travis/.gvm/pkgsets/go1.1.1/global/overlay', 'TRAVIS_COMMIT_RANGE': '3d43074ff413...27e740905a7d', 'MAIL': '/var/mail/travis', 'SSH_CONNECTION': '2607:f700:8000:12e:7056:7d4a:a406:dac4 35103 2607:f700:8001:134:eabd:6f6c:1c81:6e91 22', 'GEM_HOME': '/home/travis/.rvm/gems/ruby-1.9.3-p448', 'RACK_ENV': 'test'}
Unpacking ./.tox/dist/myproject-0.0.1.zip
Running setup.py egg_info for package from file:///home/travis/build/myteam/myproject/.tox/dist/myproject-0.0.1.zip
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-azSQM4-build/setup.py", line 40, in <module>
license=open("LICENSE").read(),
IOError: [Errno 2] No such file or directory: 'LICENSE'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-azSQM4-build/setup.py", line 40, in <module>
license=open("LICENSE").read(),
IOError: [Errno 2] No such file or directory: 'LICENSE'

该文件应该包含在分发版中,因为它在 setup() 的命名参数 package_data 中被提及:

setup(
...
long_description=open("README.rst").read(),
...
license=open("LICENSE.txt").read(),
...
package_data={'': ['LICENSE.txt', 'README.rst', 'requirements.txt']},
...
install_requires=open("requirements.txt").read().splitlines(),

请注意,我们使用的是 tox:

    tests_require=['tox'],
cmdclass={'test': Tox},
)

及更早的版本:

class Tox(TestCommand):
"""Enables `python setup.py test` to run tox."""
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True

def run_tests(self):
#import here, cause outside the eggs aren't loaded
import tox
try:
tox.cmdline(self.test_args)
except SystemExit as exception:
sys.exit(exception.code)

我没有成功尝试使用这样的绝对路径:

long_description=open(os.path.join(os.path.dirname(os.path.realpath(__file__)), \
"README.rst")).read(),

env= 表明PWDTRAVIS_BUILD_DIR 是一样的,所以open('LICENSE')应该可以工作,因为它位于 Git 目录的根目录中。

在本地通过 Tox,所有 Python 版本的所有测试都成功。

Travis-Lint 接受我的 .travis.yml:

$ travis-lint
Hooray, /home/bengt/MyTeam/MyProject.travis.yml seems to be solid!

最佳答案

在项目根目录下创建MANIFEST.in并放置

include README.rst
include LICENSE.txt
include requirements.txt

里面?

关于python - 为什么 TravisCI 找不到我的许可证文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19554568/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com