@@ -99,6 +99,7 @@ def __init__(
99
99
self , configuration : ProjectConfiguration , interface : Interface , pyproject_data : dict [str , Any ]
100
100
) -> None :
101
101
102
+ self ._enabled = False
102
103
self .configuration = configuration
103
104
104
105
if self .configuration .verbose :
@@ -125,47 +126,51 @@ def __init__(
125
126
interface .print ("Table [tool.cppython] is not defined" )
126
127
return
127
128
129
+ self ._enabled = True
130
+
128
131
self ._interface = interface
129
132
self ._generators = builder .create_generators (plugins , self .pyproject )
130
133
131
134
if self .configuration .verbose :
132
135
interface .print ("CPPython project initialized" )
133
136
134
- def download (self , path : Path ):
137
+ def download (self ):
135
138
"""
136
139
Download the generator tooling if required
137
140
"""
141
+ if self ._enabled :
142
+ path = self .pyproject .tool .cppython .install_path
138
143
139
- for generator in self ._generators :
144
+ for generator in self ._generators :
140
145
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" )
143
148
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" )
147
152
148
153
# API Contract
149
154
150
155
def install (self ) -> None :
151
- if self .pyproject . tool and self . pyproject . tool . cppython :
156
+ if self ._enabled :
152
157
if self .configuration .verbose :
153
158
self ._interface .print ("CPPython: Installing..." )
154
- self .download (self . pyproject . tool . cppython . install_path )
159
+ self .download ()
155
160
156
161
for generator in self ._generators :
157
162
generator .install ()
158
163
159
164
def update (self ) -> None :
160
- if self .pyproject . tool and self . pyproject . tool . cppython :
165
+ if self ._enabled :
161
166
if self .configuration .verbose :
162
167
self ._interface .print ("CPPython: Updating..." )
163
168
164
169
for generator in self ._generators :
165
170
generator .update ()
166
171
167
172
def build (self ) -> None :
168
- if self .pyproject . tool and self . pyproject . tool . cppython :
173
+ if self ._enabled :
169
174
if self .configuration .verbose :
170
175
self ._interface .print ("CPPython: Building..." )
171
176
0 commit comments