Skip to content

Commit

Permalink
Drop support for Conan v1
Browse files Browse the repository at this point in the history
  • Loading branch information
dean0x7d committed Nov 11, 2024
1 parent 2e205a5 commit 8ce942e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 105 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,26 @@ jobs:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
embedded-py: [3.11.5, 3.12.4]
conan:
- version: 1
args: lumicks/testing --build=missing
- version: 2
args: --user=lumicks --channel=testing --build=missing
name: "${{ matrix.os }}, ${{ matrix.embedded-py }}, v${{ matrix.conan.version }}"
name: "${{ matrix.os }}, ${{ matrix.embedded-py }}"
env:
create_pck: conan create . ${{ matrix.conan.args }} -o embedded_python-core/*:version=${{ matrix.embedded-py }}
create_pck: conan create . -o embedded_python-core/*:version=${{ matrix.embedded-py }} --build=missing
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- if: runner.os == 'macOS'
name: Set up CC/CXX env
run: |
echo CC=/usr/bin/clang >> $GITHUB_ENV
echo CXX=/usr/bin/clang++ >> $GITHUB_ENV
- if: matrix.conan.version == '1'
name: Install Conan v1
run: |
python -m pip install conan==1.64.1
conan profile new default --detect
- if: matrix.conan.version == '2'
name: Install Conan v2
- name: Install Conan
run: |
python -m pip install conan==2.4.1
python -m pip install conan==2.9.2
conan profile detect
- name: Test core
run: conan create ./core ${{ matrix.conan.args }} -o embedded_python-core/*:version=${{ matrix.embedded-py }}
run: cd core && ${{ env.create_pck }}
- name: Test baseline
run: ${{ env.create_pck }}
- name: Test with numpy env
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.10.0 | TBD

- Dropped support for Conan v1.

## v1.9.1 | 2024-06-17

- Fixed an issue where calling CMake with `-DPython_EXECUTABLE=<system_python>` created conflicts with the embedded Python (either a loud version error, or silently passing the wrong library paths). Some IDEs would pass this flag implicitly and it would hijack the `find_package(Python)` call used internally by this recipe. Now, we specifically protect against this since there should be no traces of system Python in a project that wishes to embed it.
Expand Down
9 changes: 3 additions & 6 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from conan import ConanFile
from conan.tools import files, scm

required_conan_version = ">=1.59.0"
required_conan_version = ">=2.5.0"


# noinspection PyUnresolvedReferences
class EmbeddedPython(ConanFile):
name = "embedded_python"
version = "1.9.1" # of the Conan package, `embedded_python-core:version` is the Python version
version = "1.10.0" # of the Conan package, `embedded_python-core:version` is the Python version
license = "PSFL"
description = "Embedded distribution of Python"
topics = "embedded", "python"
Expand All @@ -31,11 +31,10 @@ class EmbeddedPython(ConanFile):
"setuptools_version": "69.5.1",
"wheel_version": "0.43.0",
}
short_paths = True # some of the pip packages go over the 260 char path limit on Windows
exports_sources = "embedded_python.cmake"

def requirements(self):
self.requires(f"embedded_python-core/1.3.1@{self.user}/{self.channel}")
self.requires(f"embedded_python-core/1.4.0@{self.user}/{self.channel}")

@property
def pyversion(self):
Expand Down Expand Up @@ -202,9 +201,7 @@ def package(self):
self._gather_packages(license_folder)

def package_info(self):
self.env_info.PYTHONPATH.append(self.package_folder)
self.cpp_info.set_property("cmake_build_modules", ["embedded_python.cmake"])
self.cpp_info.build_modules = ["embedded_python.cmake"]
self.cpp_info.includedirs = []
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
9 changes: 3 additions & 6 deletions core/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from conan.errors import ConanInvalidConfiguration
from conan.tools import files, scm

required_conan_version = ">=1.59.0"
required_conan_version = ">=2.5"


# noinspection PyUnresolvedReferences
class EmbeddedPythonCore(ConanFile):
name = "embedded_python-core"
version = "1.3.1" # of the Conan package, `options.version` is the Python version
version = "1.4.0" # of the Conan package, `options.version` is the Python version
license = "PSFL"
description = "The core embedded Python (no extra pip packages)"
topics = "embedded", "python"
Expand All @@ -27,7 +27,7 @@ class EmbeddedPythonCore(ConanFile):
default_options = {
"zip_stdlib": "stored",
}
exports_sources = "embedded_python_tools.py", "embedded_python*.cmake"
exports_sources = "embedded_python*.cmake"
package_type = "shared-library"

def validate(self):
Expand Down Expand Up @@ -279,7 +279,6 @@ def package(self):
src = self.build_folder
dst = pathlib.Path(self.package_folder, "embedded_python")
files.copy(self, "embedded_python*.cmake", src, dst=self.package_folder)
files.copy(self, "embedded_python_tools.py", src, dst=self.package_folder)
license_folder = pathlib.Path(self.package_folder, "licenses")

if self.settings.os == "Windows":
Expand Down Expand Up @@ -321,11 +320,9 @@ def package(self):
self._zip_stdlib(dst)

def package_info(self):
self.env_info.PYTHONPATH.append(self.package_folder)
self.cpp_info.set_property(
"cmake_build_modules", ["embedded_python-core.cmake", "embedded_python-tools.cmake"]
)
self.cpp_info.build_modules = ["embedded_python-core.cmake", "embedded_python-tools.cmake"]
prefix = pathlib.Path(self.package_folder) / "embedded_python"
self.cpp_info.includedirs = [str(prefix / "include")]
if self.settings.os == "Windows":
Expand Down
62 changes: 0 additions & 62 deletions core/embedded_python_tools.py

This file was deleted.

6 changes: 1 addition & 5 deletions core/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import pathlib
import subprocess
import conan
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout

Expand Down Expand Up @@ -33,10 +32,7 @@ def build(self):

@property
def _core_package_path(self):
if conan.__version__.startswith("2"):
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)
else:
return pathlib.Path(self.deps_cpp_info["embedded_python-core"].rootpath)
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)

@property
def _py_exe(self):
Expand Down
11 changes: 2 additions & 9 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import pathlib
import subprocess
import conan
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout

Expand All @@ -27,17 +26,11 @@ class TestEmbeddedPython(ConanFile):

@property
def _core_package_path(self):
if conan.__version__.startswith("2"):
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)
else:
return pathlib.Path(self.deps_cpp_info["embedded_python-core"].rootpath)
return pathlib.Path(self.dependencies["embedded_python-core"].package_folder)

@property
def _package_path(self):
if conan.__version__.startswith("2"):
return pathlib.Path(self.dependencies["embedded_python"].package_folder)
else:
return pathlib.Path(self.deps_cpp_info["embedded_python"].rootpath)
return pathlib.Path(self.dependencies["embedded_python"].package_folder)

@property
def _py_exe(self):
Expand Down

0 comments on commit 8ce942e

Please sign in to comment.