1- use crate :: gis:: { check_gis_setup, GISError } ;
21use djls_ipc:: v1:: * ;
32use djls_ipc:: IpcCommand ;
43use djls_ipc:: { ProcessError , PythonProcess , TransportError } ;
@@ -24,16 +23,24 @@ impl DjangoProject {
2423 pub fn setup ( mut python : PythonProcess ) -> Result < Self , ProjectError > {
2524 let py = Python :: setup ( & mut python) ?;
2625
27- if !check_gis_setup ( & mut python) ? {
28- eprintln ! ( "Warning: GeoDjango detected but GDAL is not available." ) ;
29- eprintln ! ( "Django initialization will be skipped. Some features may be limited." ) ;
30- eprintln ! ( "To enable full functionality, please install GDAL and other GeoDjango prerequisites." ) ;
26+ match check:: GeoDjangoPrereqsRequest :: execute ( & mut python) ?. result {
27+ Some ( messages:: response:: Result :: CheckGeodjangoPrereqs ( response) ) => {
28+ if !response. passed {
29+ eprintln ! ( "Warning: GeoDjango detected but GDAL is not available." ) ;
30+ eprintln ! (
31+ "Django initialization will be skipped. Some features may be limited."
32+ ) ;
33+ eprintln ! ( "To enable full functionality, please install GDAL and other GeoDjango prerequisites." ) ;
3134
32- return Ok ( Self {
33- py,
34- python,
35- version : String :: new ( ) ,
36- } ) ;
35+ return Ok ( Self {
36+ py,
37+ python,
38+ version : String :: new ( ) ,
39+ } ) ;
40+ }
41+ }
42+ Some ( messages:: response:: Result :: Error ( e) ) => Err ( ProcessError :: Health ( e. message ) ) ?,
43+ _ => Err ( ProcessError :: Response ) ?,
3744 }
3845
3946 let response = django:: GetProjectInfoRequest :: execute ( & mut python) ?;
@@ -77,8 +84,6 @@ pub enum ProjectError {
7784 DjangoNotFound ,
7885 #[ error( "IO error: {0}" ) ]
7986 Io ( #[ from] std:: io:: Error ) ,
80- #[ error( "GIS error: {0}" ) ]
81- Gis ( #[ from] GISError ) ,
8287 #[ error( "JSON parsing error: {0}" ) ]
8388 Json ( #[ from] serde_json:: Error ) ,
8489 #[ error( transparent) ]
0 commit comments