mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
fixes python module path detection
This commit is contained in:
@@ -123,7 +123,9 @@ public class UnixAutoConfigurator implements AutoConfigurator {
|
||||
int end = line.indexOf(")");
|
||||
Path modulePath = Paths.get(line.substring(start + 1, end));
|
||||
if (Files.exists(modulePath)) {
|
||||
return Optional.of(modulePath);
|
||||
// installed modules contains the path to the mercurial module,
|
||||
// but we need the parent for the python path
|
||||
return Optional.of(modulePath.getParent());
|
||||
} else {
|
||||
LOG.warn("could not find module path at {}", modulePath);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,14 @@ public class HgRepositoryHandler
|
||||
if (autoConfigurator.isPresent()) {
|
||||
config = autoConfigurator.get().configure();
|
||||
}
|
||||
doAutoConfiguration(config != null ? config : new HgConfig());
|
||||
|
||||
if (config != null && config.isValid()) {
|
||||
this.config = config;
|
||||
storeConfig();
|
||||
} else {
|
||||
// do the old configuration
|
||||
doAutoConfiguration(config != null ? config : new HgConfig());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,12 +144,15 @@ class UnixAutoConfiguratorTest {
|
||||
Path modules = directory.resolve("modules");
|
||||
Files.createDirectories(modules);
|
||||
|
||||
Path mercurialModule = modules.resolve("mercurial");
|
||||
Files.createDirectories(mercurialModule);
|
||||
|
||||
UnixAutoConfigurator configurator = create(directory);
|
||||
configurator.setExecutor((Path binary, String... args) -> {
|
||||
String content = String.join("\n",
|
||||
"checking Python executable (/python3.8)",
|
||||
"checking Python lib (/python3.8)...",
|
||||
"checking installed modules (" + modules.toString() + ")...",
|
||||
"checking installed modules (" + mercurialModule.toString() + ")...",
|
||||
"checking templates (/mercurial/templates)...",
|
||||
"checking default template (/mercurial/templates/map-cmdline.default))"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user