Skip to content

Commit 0f86d13

Browse files
committed
Fix Tests
1 parent 910ce17 commit 0f86d13

File tree

6 files changed

+108
-6
lines changed

6 files changed

+108
-6
lines changed

cppython/plugins/conan/plugin.py

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,83 @@
11
"""_summary_"""
22

3-
from cppython.core.plugin_schema.provider import Provider
3+
from pathlib import Path
4+
from typing import Any
5+
6+
from cppython.core.plugin_schema.generator import SyncConsumer
7+
from cppython.core.plugin_schema.provider import Provider, ProviderPluginGroupData, SupportedProviderFeatures
8+
from cppython.core.schema import CorePluginData, Information, SyncData
9+
from cppython.plugins.cmake.plugin import CMakeGenerator
10+
from cppython.plugins.cmake.schema import CMakeSyncData
11+
from cppython.plugins.conan.resolution import resolve_conan_data
12+
from cppython.plugins.conan.schema import ConanData
13+
from cppython.utility.exception import NotSupportedError
14+
from cppython.utility.utility import TypeName
415

516

617
class ConanProvider(Provider):
718
"""Conan Provider"""
19+
20+
def __init__(
21+
self, group_data: ProviderPluginGroupData, core_data: CorePluginData, configuration_data: dict[str, Any]
22+
) -> None:
23+
"""Initializes the provider"""
24+
self.group_data: ProviderPluginGroupData = group_data
25+
self.core_data: CorePluginData = core_data
26+
self.data: ConanData = resolve_conan_data(configuration_data, core_data)
27+
28+
@staticmethod
29+
def features(directory: Path) -> SupportedProviderFeatures:
30+
"""Queries conan support
31+
32+
Args:
33+
directory: The directory to query
34+
35+
Returns:
36+
Supported features
37+
"""
38+
return SupportedProviderFeatures()
39+
40+
@staticmethod
41+
def information() -> Information:
42+
"""Returns plugin information
43+
44+
Returns:
45+
Plugin information
46+
"""
47+
return Information()
48+
49+
def install(self) -> None:
50+
"""Installs the provider"""
51+
pass
52+
53+
def update(self) -> None:
54+
"""Updates the provider"""
55+
pass
56+
57+
@staticmethod
58+
def supported_sync_type(sync_type: type[SyncData]) -> bool:
59+
"""_summary_
60+
61+
Args:
62+
sync_type: _description_
63+
64+
Returns:
65+
_description_
66+
"""
67+
return sync_type in CMakeGenerator.sync_types()
68+
69+
@staticmethod
70+
def sync_data(consumer: SyncConsumer) -> SyncData:
71+
"""_summary_
72+
73+
Args:
74+
consumer: _description_
75+
76+
Returns:
77+
_description_
78+
"""
79+
for sync_type in consumer.sync_types():
80+
if sync_type == CMakeSyncData:
81+
return CMakeSyncData(provider_name=TypeName('conan'), top_level_includes=Path('test'))
82+
83+
raise NotSupportedError('OOF')
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""_summary_"""
2+
3+
from typing import Any
4+
5+
from cppython.core.schema import CorePluginData
6+
from cppython.plugins.conan.schema import ConanData
7+
8+
9+
def resolve_conan_data(data: dict[str, Any], core_data: CorePluginData) -> ConanData:
10+
"""Resolves the conan data
11+
12+
Args:
13+
data: The data to resolve
14+
core_data: The core plugin data
15+
16+
Returns:
17+
The resolved conan data
18+
"""
19+
return ConanData()

cppython/plugins/conan/schema.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""TODO"""
2+
3+
from cppython.core.schema import CPPythonModel
4+
5+
6+
class ConanData(CPPythonModel):
7+
"""Resolved conan data"""

cppython/plugins/vcpkg/plugin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def sync_data(consumer: SyncConsumer) -> SyncData:
9999
"""
100100
for sync_type in consumer.sync_types():
101101
if sync_type == CMakeSyncData:
102-
# toolchain_file = self.core_data.cppython_data.install_path / "scripts/buildsystems/vcpkg.cmake"
103102
return CMakeSyncData(provider_name=TypeName('vcpkg'), top_level_includes=Path('test'))
104103

105104
raise NotSupportedError('OOF')

pdm.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ git = "cppython.plugins.git.plugin:GitSCM"
4444
cmake = "cppython.plugins.cmake.plugin:CMakeGenerator"
4545

4646
[project.entry-points."cppython.provider"]
47+
conan = "cppython.plugins.conan.plugin:ConanProvider"
4748
vcpkg = "cppython.plugins.vcpkg.plugin:VcpkgProvider"
4849

4950
[project.entry-points.pdm]

0 commit comments

Comments
 (0)