Использование Conan с Python3 на Travis-CI - PullRequest
0 голосов
/ 06 ноября 2018

У меня есть проект C ++, который использует Travis-CI и Conan. Моя сборка Linux на Travis-CI терпит неудачу при попытке загрузить libcurl:

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: так:

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 ввести команду:

install:
  - |
    if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
      sudo pip install conan
      alias python=python3
    fi

Тем не менее, я получаю те же результаты.

Как мне заставить Travis-CI использовать python3 для Conan? Или есть другой способ заставить мою команду conan install работать?

Спасибо!

Ответы [ 2 ]

0 голосов
/ 09 января 2019

Хорошо, если я правильно читаю, python3 здесь не проблема. Ошибка:

CertificateError("hostname 'curl.haxx.se' doesn't match 'c.sni.fastly.net'",

Так что что-то подозрительное с ССЛ. Python2 выдает небезопасное предупреждение о платформе при использовании ssl / https, но это редко проблема.

Что касается python3 на Travis - лично я не мог заставить Конана работать в CI с python3. Но основные шаги:

   apt:
      packages:
        - python3
        - python3-pip
...

Чтобы установить conan с помощью python3:

   sudo pip3 install conan

Обратите внимание, что в вашем примере install вы вызвали pip - который устанавливает conan с python3 и запускается на python2 при вызове из командной строки, несмотря на псевдоним. Используемый интерпретатор фактически находится в скрипте conan.

0 голосов
/ 07 ноября 2018

Сценарии CI по умолчанию, сгенерированные с conan new pkg/version -s -cilg, могут помочь. Они содержат что-то вроде:

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

И скрипт установки:

pip install conan --upgrade
pip install conan_package_tools

conan user

Таким образом, он не объявлен как пакет, но определен на корневом уровне, и этого, по-видимому, достаточно, чтобы позже использовать его с голым pip install.

...