Skip to content

Commit

Permalink
Remove duplicate version option
Browse files Browse the repository at this point in the history
  • Loading branch information
dean0x7d committed Feb 26, 2024
1 parent e8b4dab commit 257901f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
os: [windows-latest, ubuntu-latest, macos-latest]
embedded-py: [3.9.8, 3.11.5]
env:
create_pck: conan create . lumicks/testing -o embedded_python:version=${{ matrix.embedded-py }} --build=missing
create_pck: conan create . lumicks/testing -o embedded_python-core:version=${{ matrix.embedded-py }} --build=missing
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
12 changes: 4 additions & 8 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
# noinspection PyUnresolvedReferences
class EmbeddedPython(ConanFile):
name = "embedded_python"
version = "1.9.0" # of the Conan package, `options.version` is the Python version
version = "1.9.0" # of the Conan package, `embedded_python-core:version` is the Python version
license = "PSFL"
description = "Embedded distribution of Python"
topics = "embedded", "python"
homepage = "https://www.python.org/"
url = "https://github.com/lumicks/embedded_python"
settings = "os", "arch"
options = {
"version": ["ANY"],
"packages": [None, "ANY"],
"pip_version": ["ANY"],
"pip_licenses_version": ["ANY"],
Expand All @@ -38,23 +37,20 @@ class EmbeddedPython(ConanFile):
def requirements(self):
self.requires(f"embedded_python-core/1.2.2@{self.user}/{self.channel}")

def configure(self):
self.options["embedded_python-core"].version = self.options.version

@property
def pyversion(self):
"""Full Python version that we want to package, e.g. 3.11.3"""
return scm.Version(self.options.version)
return scm.Version(self.dependencies["embedded_python-core"].options.version)

@property
def short_pyversion(self):
"""The first two components of the version number, e.g. 3.11"""
return scm.Version(".".join(str(self.options.version).split(".")[:2]))
return scm.Version(".".join(str(self.pyversion).split(".")[:2]))

@property
def int_pyversion(self):
"""The first two components of the version number in integer form, e.g. 311"""
return scm.Version("".join(str(self.options.version).split(".")[:2]))
return scm.Version("".join(str(self.pyversion).split(".")[:2]))

@property
def core_pkg(self):
Expand Down
2 changes: 1 addition & 1 deletion test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestEmbeddedPython(ConanFile):
options = {"env": [None, "ANY"]}
default_options = {
"env": None,
"embedded_python:version": "3.11.5",
"embedded_python-core:version": "3.11.5",
}

def configure(self):
Expand Down

0 comments on commit 257901f

Please sign in to comment.