@@ -99,6 +99,7 @@ def __init__(
9999 self , configuration : ProjectConfiguration , interface : Interface , pyproject_data : dict [str , Any ]
100100 ) -> None :
101101
102+ self ._enabled = False
102103 self .configuration = configuration
103104
104105 if self .configuration .verbose :
@@ -125,47 +126,51 @@ def __init__(
125126 interface .print ("Table [tool.cppython] is not defined" )
126127 return
127128
129+ self ._enabled = True
130+
128131 self ._interface = interface
129132 self ._generators = builder .create_generators (plugins , self .pyproject )
130133
131134 if self .configuration .verbose :
132135 interface .print ("CPPython project initialized" )
133136
134- def download (self , path : Path ):
137+ def download (self ):
135138 """
136139 Download the generator tooling if required
137140 """
141+ if self ._enabled :
142+ path = self .pyproject .tool .cppython .install_path
138143
139- for generator in self ._generators :
144+ for generator in self ._generators :
140145
141- if not generator .generator_downloaded (path ):
142- self ._interface .print (f"Downloading the { generator .name ()} tool" )
146+ if not generator .generator_downloaded (path ):
147+ self ._interface .print (f"Downloading the { generator .name ()} tool" )
143148
144- # TODO: Make async with progress bar
145- generator .download_generator (path )
146- self ._interface .print ("Download complete" )
149+ # TODO: Make async with progress bar
150+ generator .download_generator (path )
151+ self ._interface .print ("Download complete" )
147152
148153 # API Contract
149154
150155 def install (self ) -> None :
151- if self .pyproject . tool and self . pyproject . tool . cppython :
156+ if self ._enabled :
152157 if self .configuration .verbose :
153158 self ._interface .print ("CPPython: Installing..." )
154- self .download (self . pyproject . tool . cppython . install_path )
159+ self .download ()
155160
156161 for generator in self ._generators :
157162 generator .install ()
158163
159164 def update (self ) -> None :
160- if self .pyproject . tool and self . pyproject . tool . cppython :
165+ if self ._enabled :
161166 if self .configuration .verbose :
162167 self ._interface .print ("CPPython: Updating..." )
163168
164169 for generator in self ._generators :
165170 generator .update ()
166171
167172 def build (self ) -> None :
168- if self .pyproject . tool and self . pyproject . tool . cppython :
173+ if self ._enabled :
169174 if self .configuration .verbose :
170175 self ._interface .print ("CPPython: Building..." )
171176
0 commit comments