From e9c5300ca6455fda86a98482857441b41fb0af18 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 13:39:38 +0100 Subject: [PATCH 01/14] try windows with conan after linux worked --- .github/workflows/wheels.yml | 55 +++++++++++------------------------- .gitignore | 5 +++- conanfile.txt | 6 ++++ setup.py | 44 ++++++++++++++++++++++------- 4 files changed, 60 insertions(+), 50 deletions(-) create mode 100644 conanfile.txt diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index c739033..fa70e49 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -4,23 +4,13 @@ on: push: tags: - '*' - -jobs: - build_sdist: - name: Build SDist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Build SDist - run: pipx run build --sdist - - - name: Check metadata - run: pipx run twine check dist/* - - - uses: actions/upload-artifact@v2 - with: - path: dist/*.tar.gz + paths-ignore: + - '*.md' + pull_request: + branches: + - 'master' + paths-ignore: + - '*.md' build_wheels: @@ -30,15 +20,21 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest - - macos-latest - # - windows-latest + # - ubuntu-latest + # - macos-latest + - windows-latest steps: - uses: actions/checkout@v2 with: submodules: recursive + - name: Install conan dependencies + if: matrix.os == 'windows-latest' + run: | + pip install conan + conan install . --build=openssl --install-folder $PWD/conan_build --remote conancenter + - uses: pypa/cibuildwheel@v2.3.1 env: MACOSX_DEPLOYMENT_TARGET: 10.15 @@ -51,22 +47,3 @@ jobs: uses: actions/upload-artifact@v2 with: path: wheelhouse/*.whl - - - upload_all: - name: Upload if release - needs: [build_wheels, build_sdist] - runs-on: ubuntu-latest - - steps: - - uses: actions/setup-python@v2 - - - uses: actions/download-artifact@v2 - with: - name: artifact - path: dist - - - uses: pypa/gh-action-pypi-publish@v1.4.2 - with: - user: jonathf - password: ${{ secrets.pypi_password }} diff --git a/.gitignore b/.gitignore index b6e4761..b7366db 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ __pycache__/ # Distribution / packaging .Python -build/ +*build/ develop-eggs/ dist/ downloads/ @@ -117,6 +117,9 @@ venv.bak/ # Rope project settings .ropeproject +# pycharm project settings +.idea + # mkdocs documentation /site diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..72a05a6 --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,6 @@ +[requires] +openssl/1.1.1m +asio/1.21.0 + +[generators] +json diff --git a/setup.py b/setup.py index 2fe18a2..79f1e8a 100644 --- a/setup.py +++ b/setup.py @@ -1,34 +1,58 @@ +import json import os import platform +from pathlib import Path from setuptools import setup from pybind11.setup_helpers import Pybind11Extension, build_ext -extra_compile_args = [ - "-MMD", - "-MP", - "-Wextra", - "-Wpedantic", - "-Wall", - "-O3", - "-DASIO_STANDALONE", - "-DNDEBUG", -] extra_link_args = [ "-lpthread", "-lssl", "-lcrypto", ] +extra_compile_args = [ + "-MMD", + "-MP", + "-Wextra", + "-Wpedantic", + "-Wall", + "-O3", + "-DASIO_STANDALONE", + "-DNDEBUG", + ] include_dirs = [os.path.join("vroom", "src")] +libraries = [] +library_dirs = [] + +# try conan dependency resolution +conanfile = tuple(Path().rglob('conanbuildinfo.json')) +if conanfile: + print("INFO: Using conan to resolve dependencies.") + with open(conanfile[0]) as f: + conan_deps = json.load(f)['dependencies'] + for dep in conan_deps: + include = dep['include_paths'] + libraries = dep['lib_paths'] + + include_dirs.extend(include) + if libraries: + library_dirs.extend(libraries) +else: + print('WARN: Conan not installed and/or no conan build detected. Assuming dependencies are installed.') if platform.system() == "Darwin": # Homebrew puts include folders in weird places. include_dirs.append("/usr/local/opt/openssl@1.1/include") extra_link_args.insert(0, "-L/usr/local/opt/openssl@1.1/lib") +elif platform.system() == "Windows": + extra_compile_args = ["-DNOGDI", "-DNOMINMAX", "-DASIO_STANDALONE"] + extra_link_args = [] ext_modules = [ Pybind11Extension( "_vroom", [os.path.join("src", "_vroom.cpp")], + library_dirs=library_dirs, extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, ), From 2c98b4e1c563096638e0096c952fc347c783760a Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 13:44:17 +0100 Subject: [PATCH 02/14] failed workflow file --- .github/workflows/wheels.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index fa70e49..f61cac1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,8 +2,10 @@ name: Wheels on: push: + branches: + - 'master' tags: - - '*' + - '*' paths-ignore: - '*.md' pull_request: @@ -12,7 +14,7 @@ on: paths-ignore: - '*.md' - +jobs: build_wheels: name: Wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} From b005a0c9777030b97c91e91e6eef023284e46ef2 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 17:49:37 +0100 Subject: [PATCH 03/14] make win work --- .github/workflows/wheels.yml | 12 ++++++------ README.md | 17 ++++++++++++++++- pyproject.toml | 7 ++++++- setup.py | 20 ++++++++++++++++---- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index f61cac1..63efb98 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -31,15 +31,15 @@ jobs: with: submodules: recursive - - name: Install conan dependencies - if: matrix.os == 'windows-latest' - run: | - pip install conan - conan install . --build=openssl --install-folder $PWD/conan_build --remote conancenter + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' - uses: pypa/cibuildwheel@v2.3.1 env: - MACOSX_DEPLOYMENT_TARGET: 10.15 + MACOSX_DEPLOYMENT_TARGET: 10.14 + CIBW_TEST_COMMAND_WINDOWS: '' - name: Verify clean directory run: git diff --exit-code diff --git a/README.md b/README.md index 664459f..e8cbb3d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ VROOM can also solve any mix of the above problem types. ## Installation -Pyvroom currently makes binaries for on MacOS and Linux. +Pyvroom currently makes binaries for on MacOS and Linux (Windows is WIP). Installation should be as simple as: @@ -27,6 +27,21 @@ Installation should be as simple as: pip install pyvroom ``` +## Building + +Building the source distributions on another OS requires: +- the `./build-requirements.txt` Python dependencies +- `asio` headers installed +- `openssl` & `crypto` libraries & headers installed + +Optionally the dependencies can be installed with [`conan`](https://github.com/conan-io/conan): +```shell script +conan install --build=openssl --install-folder conan_build . + +# note, on Windows you might have to execute the following before +conan profile update "settings.compiler=Visual Studio" default +conan profile update "settings.compiler.version=16" default +``` ## Basic usage ```python diff --git a/pyproject.toml b/pyproject.toml index b9ed258..c58134b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,5 +37,10 @@ brew install asio [tool.cibuildwheel.windows] before-all = """ -choco install -y openssl +pip install pip --upgrade +pip install conan +conan profile update "settings.compiler=Visual Studio" default +conan profile update "settings.compiler.version=16" default +conan install --build=openssl --install-folder conan_build . """ +test-command = '' diff --git a/setup.py b/setup.py index 79f1e8a..e44adb6 100644 --- a/setup.py +++ b/setup.py @@ -32,11 +32,17 @@ conan_deps = json.load(f)['dependencies'] for dep in conan_deps: include = dep['include_paths'] - libraries = dep['lib_paths'] + libs = dep['libs'] + system_libs = dep['system_libs'] + libdirs = dep['lib_paths'] include_dirs.extend(include) - if libraries: - library_dirs.extend(libraries) + if libs: + libraries.extend(libs) + if system_libs: + libraries.extend(system_libs) + if libdirs: + library_dirs.extend(libdirs) else: print('WARN: Conan not installed and/or no conan build detected. Assuming dependencies are installed.') @@ -45,7 +51,12 @@ include_dirs.append("/usr/local/opt/openssl@1.1/include") extra_link_args.insert(0, "-L/usr/local/opt/openssl@1.1/lib") elif platform.system() == "Windows": - extra_compile_args = ["-DNOGDI", "-DNOMINMAX", "-DASIO_STANDALONE"] + extra_compile_args = [ + "-DNOGDI", + "-DNOMINMAX", + "-DWIN32_LEAN_AND_MEAN", + "-DASIO_STANDALONE" + ] extra_link_args = [] ext_modules = [ @@ -53,6 +64,7 @@ "_vroom", [os.path.join("src", "_vroom.cpp")], library_dirs=library_dirs, + libraries=libraries, extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, ), From 5eee7de923c9ae6c1f9d23ecfa08cb5186d2331e Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 17:51:44 +0100 Subject: [PATCH 04/14] forgot main renaming again --- .github/workflows/wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 63efb98..5e8eb02 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -3,14 +3,14 @@ name: Wheels on: push: branches: - - 'master' + - 'main' tags: - '*' paths-ignore: - '*.md' pull_request: branches: - - 'master' + - 'main' paths-ignore: - '*.md' From acaf3f4cc2d07200010997d8186e7c0a64e61282 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 18:03:20 +0100 Subject: [PATCH 05/14] some other syntax --- .github/workflows/wheels.yml | 5 ----- pyproject.toml | 14 +++++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5e8eb02..029f889 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -31,11 +31,6 @@ jobs: with: submodules: recursive - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - uses: pypa/cibuildwheel@v2.3.1 env: MACOSX_DEPLOYMENT_TARGET: 10.14 diff --git a/pyproject.toml b/pyproject.toml index c58134b..65c148d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,11 +36,11 @@ brew install asio """ [tool.cibuildwheel.windows] -before-all = """ -pip install pip --upgrade -pip install conan -conan profile update "settings.compiler=Visual Studio" default -conan profile update "settings.compiler.version=16" default -conan install --build=openssl --install-folder conan_build . -""" +before-all = [ + 'pip install pip --upgrade', + 'pip install conan', + 'conan profile update "settings.compiler=Visual Studio" default', + 'conan profile update "settings.compiler.version=16" default', + 'conan install --build=openssl --install-folder conan_build .' +] test-command = '' From 84872f935e1afaa5f83b6fec634104b1ceb04a7e Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 18:06:37 +0100 Subject: [PATCH 06/14] initialize default profile for conan --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 65c148d..79dad45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ brew install asio before-all = [ 'pip install pip --upgrade', 'pip install conan', + 'conan profile new default --detect', 'conan profile update "settings.compiler=Visual Studio" default', 'conan profile update "settings.compiler.version=16" default', 'conan install --build=openssl --install-folder conan_build .' From d49b51f8c54efff8d8f72c3ef3ce35c28497ee62 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 18:34:09 +0100 Subject: [PATCH 07/14] cache conan dependencies, it builds openssl from source --- .github/workflows/wheels.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 029f889..7e35608 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -31,6 +31,13 @@ jobs: with: submodules: recursive + - name: Cache Conan dependencies + if: matrix.os == 'windows-latest' + uses: actions/cache@v2 + with: + path: $USERPROFILE/.conan + key: conan-${{ hashFiles('conanfile.txt') }} + - uses: pypa/cibuildwheel@v2.3.1 env: MACOSX_DEPLOYMENT_TARGET: 10.14 From 74a7abb4f9f15e215ba03c047db20860f8911625 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 19:26:49 +0100 Subject: [PATCH 08/14] add back the other OSs in CI --- .github/workflows/wheels.yml | 47 ++++++++++++++++++++++++++++++------ README.md | 1 + setup.py | 2 +- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7e35608..6d97741 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -15,6 +15,22 @@ on: - '*.md' jobs: + build_sdist: + name: Build SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Build SDist + run: pipx run build --sdist + + - name: Check metadata + run: pipx run twine check dist/* + + - uses: actions/upload-artifact@v2 + with: + path: dist/*.tar.gz + build_wheels: name: Wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -22,8 +38,8 @@ jobs: fail-fast: false matrix: os: - # - ubuntu-latest - # - macos-latest + - ubuntu-latest + - macos-latest - windows-latest steps: @@ -32,22 +48,39 @@ jobs: submodules: recursive - name: Cache Conan dependencies - if: matrix.os == 'windows-latest' + id: cache-conan uses: actions/cache@v2 + if: matrix.os == 'windows-latest' with: path: $USERPROFILE/.conan key: conan-${{ hashFiles('conanfile.txt') }} + - name: Set up Windows Python ${{ matrix.python_version }} + uses: actions/setup-python@v2 + if: matrix.os == 'windows-latest' + with: + python-version: ${{ matrix.python_version }} + + - name: Install conan for Windows + if: matrix.os == 'windows-latest' && steps.cache-conan.outputs.cache-hit != 'true' + run: | + pip install pip --upgrade + pip install conan + conan profile new default --detect + conan profile update "settings.compiler=Visual Studio" default + conan profile update "settings.compiler.version=16" default + conan install --build=openssl --install-folder conan_build . + - uses: pypa/cibuildwheel@v2.3.1 env: MACOSX_DEPLOYMENT_TARGET: 10.14 - CIBW_TEST_COMMAND_WINDOWS: '' - name: Verify clean directory run: git diff --exit-code shell: bash - - name: Upload wheels - uses: actions/upload-artifact@v2 + - uses: pypa/gh-action-pypi-publish@v1.4.2 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') with: - path: wheelhouse/*.whl + user: jonathf + password: ${{ secrets.pypi_password }} diff --git a/README.md b/README.md index e8cbb3d..783299d 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Optionally the dependencies can be installed with [`conan`](https://github.com/c conan install --build=openssl --install-folder conan_build . # note, on Windows you might have to execute the following before +conan profile new default --detect conan profile update "settings.compiler=Visual Studio" default conan profile update "settings.compiler.version=16" default ``` diff --git a/setup.py b/setup.py index e44adb6..f474184 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ "_vroom", [os.path.join("src", "_vroom.cpp")], library_dirs=library_dirs, - libraries=libraries, + extra_libraries=libraries, extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, ), From be5b992a830a9db3533b2c96627b8786b14817a1 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 19:32:14 +0100 Subject: [PATCH 09/14] re-add separate upload job but with condition --- .github/workflows/wheels.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 6d97741..213bfba 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -79,8 +79,26 @@ jobs: run: git diff --exit-code shell: bash + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + path: wheelhouse/*.whl + + upload_all: + name: Upload if release + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-python@v2 + + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - uses: pypa/gh-action-pypi-publish@v1.4.2 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') with: user: jonathf password: ${{ secrets.pypi_password }} From 323d84440a17e251f81b7a49f0a40e54b694fe0f Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 19:35:03 +0100 Subject: [PATCH 10/14] remove the windows cibw env vars --- pyproject.toml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 79dad45..2be1a12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,14 +34,3 @@ apk add openssl-dev before-all = """ brew install asio """ - -[tool.cibuildwheel.windows] -before-all = [ - 'pip install pip --upgrade', - 'pip install conan', - 'conan profile new default --detect', - 'conan profile update "settings.compiler=Visual Studio" default', - 'conan profile update "settings.compiler.version=16" default', - 'conan install --build=openssl --install-folder conan_build .' -] -test-command = '' From 5333a44298bd69a2fb7cefb4429d3df781d139fd Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 20:02:13 +0100 Subject: [PATCH 11/14] libraries, not extra_libraries --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f474184..e44adb6 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ "_vroom", [os.path.join("src", "_vroom.cpp")], library_dirs=library_dirs, - extra_libraries=libraries, + libraries=libraries, extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, ), From 3bdeff1eb0762c48eb7c79be653f3d6d33a974a4 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Sun, 2 Jan 2022 20:11:06 +0100 Subject: [PATCH 12/14] add the conan-build path to the cache for windows; add build-requirements.txt --- .github/workflows/wheels.yml | 6 ++++-- build-requirements.txt | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 build-requirements.txt diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 213bfba..02f48b0 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -52,8 +52,10 @@ jobs: uses: actions/cache@v2 if: matrix.os == 'windows-latest' with: - path: $USERPROFILE/.conan - key: conan-${{ hashFiles('conanfile.txt') }} + path: + $USERPROFILE/.conan + conan-build + key: conan-${{ hashFiles('conanfile.txt') }}-v1.1 - name: Set up Windows Python ${{ matrix.python_version }} uses: actions/setup-python@v2 diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 0000000..937e889 --- /dev/null +++ b/build-requirements.txt @@ -0,0 +1,5 @@ +setuptools>=45 +wheel +setuptools_scm>=6.2 +setuptools_scm_git_archive +pybind11>=2.8.0 From b395658ec44e3e4803aea7c53b791b23e7df43ac Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Mon, 3 Jan 2022 10:59:57 +0100 Subject: [PATCH 13/14] address review --- .github/workflows/wheels.yml | 8 +++----- README.md | 7 +------ conan_install.bat | 4 ++++ setup.py | 25 +++++++++---------------- 4 files changed, 17 insertions(+), 27 deletions(-) create mode 100644 conan_install.bat diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 02f48b0..9aae975 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -59,7 +59,7 @@ jobs: - name: Set up Windows Python ${{ matrix.python_version }} uses: actions/setup-python@v2 - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-latest' && steps.cache-conan.outputs.cache-hit != 'true' with: python-version: ${{ matrix.python_version }} @@ -68,10 +68,8 @@ jobs: run: | pip install pip --upgrade pip install conan - conan profile new default --detect - conan profile update "settings.compiler=Visual Studio" default - conan profile update "settings.compiler.version=16" default - conan install --build=openssl --install-folder conan_build . + call .\conan_install.bat + shell: cmd - uses: pypa/cibuildwheel@v2.3.1 env: diff --git a/README.md b/README.md index 783299d..1f9cd68 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,9 @@ Building the source distributions on another OS requires: - `asio` headers installed - `openssl` & `crypto` libraries & headers installed -Optionally the dependencies can be installed with [`conan`](https://github.com/conan-io/conan): +Optionally the C++ dependencies can be installed with [`conan`](https://github.com/conan-io/conan): ```shell script conan install --build=openssl --install-folder conan_build . - -# note, on Windows you might have to execute the following before -conan profile new default --detect -conan profile update "settings.compiler=Visual Studio" default -conan profile update "settings.compiler.version=16" default ``` ## Basic usage diff --git a/conan_install.bat b/conan_install.bat new file mode 100644 index 0000000..1d5d91d --- /dev/null +++ b/conan_install.bat @@ -0,0 +1,4 @@ +conan profile new default --detect +conan profile update "settings.compiler=Visual Studio" default +conan profile update "settings.compiler.version=16" default +conan install --build=openssl --install-folder conan_build . diff --git a/setup.py b/setup.py index 06d2bd8..55313cb 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ import json +import logging import os import platform from pathlib import Path @@ -25,26 +26,18 @@ library_dirs = [] # try conan dependency resolution -conanfile = tuple(Path().rglob('conanbuildinfo.json')) +conanfile = tuple(Path(__file__).parent.resolve().rglob('conanbuildinfo.json')) if conanfile: - print("INFO: Using conan to resolve dependencies.") - with open(conanfile[0]) as f: + logging.info("Using conan to resolve dependencies.") + with conanfile[0].open() as f: conan_deps = json.load(f)['dependencies'] for dep in conan_deps: - include = dep['include_paths'] - libs = dep['libs'] - system_libs = dep['system_libs'] - libdirs = dep['lib_paths'] - - include_dirs.extend(include) - if libs: - libraries.extend(libs) - if system_libs: - libraries.extend(system_libs) - if libdirs: - library_dirs.extend(libdirs) + include_dirs.extend(dep['include_paths']) + libraries.extend(dep['libs']) + libraries.extend(dep['system_libs']) + library_dirs.extend(dep['lib_paths']) else: - print('WARN: Conan not installed and/or no conan build detected. Assuming dependencies are installed.') + logging.warning('Conan not installed and/or no conan build detected. Assuming dependencies are installed.') if platform.system() == "Darwin": # Homebrew puts include folders in weird places. From 5068b7f202b6aeec0d00328063ee5e95d5dd893b Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Mon, 3 Jan 2022 18:38:57 +0100 Subject: [PATCH 14/14] oops, update the yaml --- .github/workflows/wheels.yml | 19 +++++++++++-------- conan_install.bat | 4 ---- 2 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 conan_install.bat diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9aae975..75b781f 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -47,29 +47,32 @@ jobs: with: submodules: recursive - - name: Cache Conan dependencies + - name: Cache Conan id: cache-conan uses: actions/cache@v2 if: matrix.os == 'windows-latest' with: - path: - $USERPROFILE/.conan - conan-build - key: conan-${{ hashFiles('conanfile.txt') }}-v1.1 + path: | + conan_build + conan_data + key: conan-${{ matrix.os }}-${{ hashFiles('conanfile.txt') }} - name: Set up Windows Python ${{ matrix.python_version }} uses: actions/setup-python@v2 if: matrix.os == 'windows-latest' && steps.cache-conan.outputs.cache-hit != 'true' with: - python-version: ${{ matrix.python_version }} + python-version: '3.x' - name: Install conan for Windows if: matrix.os == 'windows-latest' && steps.cache-conan.outputs.cache-hit != 'true' run: | pip install pip --upgrade pip install conan - call .\conan_install.bat - shell: cmd + conan profile new default --detect + conan profile update "settings.compiler=Visual Studio" default + conan profile update "settings.compiler.version=16" default + conan config set "storage.path=$env:GITHUB_WORKSPACE/conan_data" + conan install --build=openssl --install-folder conan_build . - uses: pypa/cibuildwheel@v2.3.1 env: diff --git a/conan_install.bat b/conan_install.bat deleted file mode 100644 index 1d5d91d..0000000 --- a/conan_install.bat +++ /dev/null @@ -1,4 +0,0 @@ -conan profile new default --detect -conan profile update "settings.compiler=Visual Studio" default -conan profile update "settings.compiler.version=16" default -conan install --build=openssl --install-folder conan_build .