55from importlib import metadata
66from typing import Callable , Optional , Type , TypeVar
77
8- from cppython .exceptions import ConfigError
9- from cppython .schema import API , Generator , Interface , Plugin , PyProject
8+ from cppython_core .exceptions import ConfigError
9+ from cppython_core .schema import API , Generator , Interface , Plugin , PyProject
1010
1111
1212class Project (API ):
@@ -16,11 +16,16 @@ class Project(API):
1616
1717 def __init__ (self , interface : Interface , pyproject : PyProject ) -> None :
1818
19- self .enabled = pyproject . cppython is not None
19+ self .enabled = False
2020
21- if not self . enabled :
21+ if pyproject . tool is None :
2222 return
2323
24+ if pyproject .tool .cppython is None :
25+ return
26+
27+ self .enabled = True
28+
2429 self ._interface = interface
2530
2631 PluginType = TypeVar ("PluginType" , bound = Type [Plugin ])
@@ -40,10 +45,10 @@ def find_plugin_type(plugin_type: PluginType, condition: Callable[[str], bool])
4045
4146 return None
4247
43- plugin_type = find_plugin_type (Generator , lambda name : name == pyproject .cppython .generator )
48+ plugin_type = find_plugin_type (Generator , lambda name : name == pyproject .tool . cppython .generator )
4449
4550 if plugin_type is None :
46- raise ConfigError (f"No generator plugin with the name '{ pyproject .cppython .generator } ' was found." )
51+ raise ConfigError (f"No generator plugin with the name '{ pyproject .tool . cppython .generator } ' was found." )
4752
4853 generator_data = interface .read_generator_data (plugin_type .data_type ())
4954 self ._generator = plugin_type (pyproject , generator_data )
@@ -52,11 +57,11 @@ def download(self):
5257 """
5358 Download the generator tooling if required
5459 """
55- if not self ._generator .downloaded ():
60+ if not self ._generator .generator_downloaded ():
5661 self ._interface .print (f"Downloading the { self ._generator .name ()} tool" )
5762
5863 # TODO: Make async with progress bar
59- self ._generator .download ()
64+ self ._generator .download_generator ()
6065 self ._interface .print ("Download complete" )
6166
6267 # API Contract
0 commit comments