首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Travis-CI上使用Conan和Python3

在Travis-CI上使用Conan和Python3
EN

Stack Overflow用户
提问于 2018-11-06 20:25:50
回答 2查看 728关注 0票数 2

我有一个使用Travis-CI和Conan的C++项目。我在Travis-CI上的Linux构建在尝试下载libcurl时失败:

代码语言:javascript
复制
libcurl/7.61.1@bincrafters/stable: Building your package in /home/travis/.conan/data/libcurl/7.61.1/bincrafters/stable/build/b6dbf799dd7e6d1c740e159bea361666320a3db8
libcurl/7.61.1@bincrafters/stable: Configuring sources in /home/travis/.conan/data/libcurl/7.61.1/bincrafters/stable/source
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:150: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
ERROR: Error downloading file https://curl.haxx.se/download/curl-7.61.1.tar.gz: 'HTTPSConnectionPool(host='curl.haxx.se', port=443): Max retries exceeded with url: /download/curl-7.61.1.tar.gz (Caused by SSLError(CertificateError("hostname 'curl.haxx.se' doesn't match 'c.sni.fastly.net'",),))'
Waiting 5 seconds to retry...
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:150: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
libcurl/7.61.1@bincrafters/stable: WARN: Trying to remove corrupted source folder
libcurl/7.61.1@bincrafters/stable: WARN: This can take a while for big packages
ERROR: libcurl/7.61.1@bincrafters/stable: Error in source() method, line 131
    tools.get("https://curl.haxx.se/download/curl-%s.tar.gz" % self.version)
    ConanException: Error downloading file https://curl.haxx.se/download/curl-7.61.1.tar.gz: 'HTTPSConnectionPool(host='curl.haxx.se', port=443): Max retries exceeded with url: /download/curl-7.61.1.tar.gz (Caused by SSLError(CertificateError("hostname 'curl.haxx.se' doesn't match 'c.sni.fastly.net'",),))'
The command "conan install .. --build missing" exited with 1.

根据错误中的建议,我试图让特拉维斯使用Python3,看看这是否可以解决问题,但我没有运气。首先,我将python3添加到我的packages:,如下所示:

代码语言:javascript
复制
matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
      env:
        - CC_COMPILER=gcc-7
        - CXX_COMPILER=g++-7
        - BUILD_TYPE=RelWithDebInfo
      addons:
        apt:
          packages:
            - python3
            - gcc-7
            - g++-7
          sources:
            - ubuntu-toolchain-r-test

但我收到了与上面相同的错误。然后我尝试alias命令:

代码语言:javascript
复制
install:
  - |
    if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
      sudo pip install conan
      alias python=python3
    fi

然而,我得到了相同的结果。

如何让Travis-CI对柯南使用python3?或者,有没有其他方法可以让我的conan install命令工作?

谢谢!

EN

回答 2

Stack Overflow用户

发布于 2018-11-07 23:52:16

使用conan new pkg/version -s -cilg生成的默认配置项脚本可能会有所帮助。它们包含如下内容:

代码语言:javascript
复制
linux: &linux
   os: linux
   dist: xenial
   sudo: required
   language: python
   python: "3.6"
   services:
     - docker

matrix:
   include:
      - <<: *linux
        env: ...

install:
  - chmod +x .travis/install.sh
  - ./.travis/install.sh

和安装脚本:

代码语言:javascript
复制
pip install conan --upgrade
pip install conan_package_tools

conan user

所以它不是声明为一个包,而是在根级别定义的,这似乎足以在以后将其与纯pip install一起使用。

票数 1
EN

Stack Overflow用户

发布于 2019-01-09 21:30:16

好吧,如果我没看错的话,这里的问题不是python3。错误是:

代码语言:javascript
复制
CertificateError("hostname 'curl.haxx.se' doesn't match 'c.sni.fastly.net'",

所以ssl有些可疑之处。当使用ssl / https时,Python2确实会产生不安全的平台警告,但这很少是问题所在。

至于Travis上的python3 -我个人不能让柯南在python3的CI中工作。但基本步骤是:

代码语言:javascript
复制
   apt:
      packages:
        - python3
        - python3-pip
...

要使用python3安装conan:

代码语言:javascript
复制
   sudo pip3 install conan

请注意,在您的示例install中,您的名称为pip -它将使用python3安装conan,当从命令行调用它时,尽管有别名,它仍将由python2运行。要使用的解释器实际上在conan脚本中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53171865

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档