- def run_setup_script(self, *args, **kwargs):
- """ Run the Nominatim setup script with the given arguments.
- """
- self.run_nominatim_script('setup', *args, **kwargs)
-
- def run_update_script(self, *args, **kwargs):
- """ Run the Nominatim update script with the given arguments.
- """
- self.run_nominatim_script('update', *args, **kwargs)
-
- def run_nominatim_script(self, script, *args, **kwargs):
- """ Run one of the Nominatim utility scripts with the given arguments.
- """
- cmd = ['/usr/bin/env', 'php', '-Cq']
- cmd.append((Path(self.src_dir) / 'lib-php' / 'admin' / '{}.php'.format(script)).resolve())
- cmd.extend(['--' + x for x in args])
- for k, v in kwargs.items():
- cmd.extend(('--' + k.replace('_', '-'), str(v)))
-
- if self.website_dir is not None:
- cwd = self.website_dir.name
- else:
- cwd = None
-
- run_script(cmd, cwd=cwd, env=self.test_env)