11module languages.scripting.python.core.handler ;
22
3- import std.stdio ;
43import std.file ;
54import std.path ;
65import std.algorithm ;
@@ -79,25 +78,25 @@ class PythonHandler : BaseLanguageHandler
7978 LanguageBuildResult result;
8079
8180 if (pyConfig.installDeps && ! installDependencies(pyConfig, config.root, pythonCmd))
82- {
83- result.error = " Failed to install dependencies" ;
84- return result;
85- }
86-
81+ {
82+ result.error = " Failed to install dependencies" ;
83+ return result;
84+ }
85+
8786 if (pyConfig.autoFormat && pyConfig.formatter != PyFormatter.None)
8887 {
8988 Logger.info(" Auto-formatting code" );
9089 auto fmtResult = Formatter.format(target.sources, pyConfig.formatter, pythonCmd, false );
9190 if (! fmtResult.success)
9291 Logger.warning(" Formatting failed, continuing anyway" );
9392 }
94-
93+
9594 if (pyConfig.autoLint && pyConfig.linter != PyLinter.None)
9695 {
9796 Logger.info(" Auto-linting code" );
9897 lintWithCaching(target.sources, pyConfig, target.name, pythonCmd);
9998 }
100-
99+
101100 if (pyConfig.typeCheck.enabled)
102101 {
103102 Logger.info(" Running type checking" );
@@ -109,14 +108,14 @@ class PythonHandler : BaseLanguageHandler
109108 return result;
110109 }
111110 }
112-
111+
113112 auto validationResult = PyValidator.validate(target.sources);
114113 if (! validationResult.success)
115114 {
116115 result.error = validationResult.firstError();
117116 return result;
118117 }
119-
118+
120119 auto outputs = getOutputs(target, config);
121120 if (! outputs.empty && ! target.sources.empty)
122121 {
@@ -164,10 +163,10 @@ class PythonHandler : BaseLanguageHandler
164163 return result;
165164 }
166165 }
167-
166+
168167 if (pyConfig.compileBytecode)
169168 compileToBytecodeWithCaching(target.sources, pyConfig, target.name, pythonCmd);
170-
169+
171170 result.success = true ;
172171 result.outputs = outputs;
173172 result.outputHash = FastHash.hashStrings(target.sources);
@@ -281,10 +280,7 @@ class PythonHandler : BaseLanguageHandler
281280 string venvPath = VirtualEnv.ensureVenv(config.venv, projectRoot, pythonCmd);
282281
283282 if (! venvPath.empty)
284- {
285283 pythonCmd = VirtualEnv.getVenvPython(venvPath);
286- Logger.debugLog(" Using virtual environment: " ~ venvPath);
287- }
288284 }
289285
290286 return pythonCmd;
0 commit comments