grim/hgkeeper

Parents 5b6ad1b98031
Children 7e5e43563b1f
user mercurial.templater as a better way to find the templates directory
  • +3 -3
    hg/hgweb.go
  • --- a/hg/hgweb.go Wed Mar 23 13:41:00 2022 -0500
    +++ b/hg/hgweb.go Wed Mar 23 16:01:28 2022 -0500
    @@ -3,7 +3,6 @@
    import (
    "fmt"
    "os/exec"
    - "path/filepath"
    "strings"
    log "github.com/sirupsen/logrus"
    @@ -21,13 +20,14 @@
    "/usr/bin/env",
    "python3",
    "-c",
    - "import mercurial;print(mercurial.__path__[0])",
    + "from mercurial import templater; print(templater.templatedir().decode('UTF-8'))",
    }
    cmd := exec.Command(args[0], args[1:]...)
    raw, err := cmd.CombinedOutput()
    if err != nil {
    + log.Debugf("raw: %#v\n", string(raw))
    return "", err
    }
    @@ -36,7 +36,7 @@
    return "", fmt.Errorf("failed to find the templates directory")
    }
    - templatesDir = filepath.Join(templatesDir, "templates")
    + log.Infof("using %s as the templates directory\n", templatesDir)
    }
    return templatesDir, nil