File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,14 +94,18 @@ class ReplicationServerMock:
9494 return min (self .state_infos [- 1 ].sequence , start_id + numdiffs - 1 )
9595
9696# Replication module is optional
97- _repfl_spec = importlib .util .spec_from_loader (
98- 'osm2pgsql_replication' ,
99- SourceFileLoader ('osm2pgsql_replication' ,
100- str (Path (__file__ , '..' , 'osm2pgsql-replication' ).resolve ())))
97+ _replication_path = Path (__file__ , '..' , 'osm2pgsql-replication' ).resolve ()
98+
99+ if _replication_path .is_file ():
100+ _repfl_spec = importlib .util .spec_from_loader (
101+ 'osm2pgsql_replication' ,
102+ SourceFileLoader ('osm2pgsql_replication' , str (_replication_path )))
101103
102- if _repfl_spec :
103104 osm2pgsql_replication = importlib .util .module_from_spec (_repfl_spec )
104- _repfl_spec .loader .exec_module (osm2pgsql_replication )
105+ try :
106+ _repfl_spec .loader .exec_module (osm2pgsql_replication )
107+ except Exception as e :
108+ raise RuntimeError (f"osm2pgsql_replication script found but not readable." )
105109
106110 from osmium .replication .server import OsmosisState
107111else :
You can’t perform that action at this time.
0 commit comments