diff --git a/gazelle/python/configure.go b/gazelle/python/configure.go index ed6e2e102c..4ae4c23b3f 100644 --- a/gazelle/python/configure.go +++ b/gazelle/python/configure.go @@ -90,11 +90,11 @@ func (py *Configurer) Configure(c *config.Config, rel string, f *rule.File) { configs := c.Exts[languageName].(pythonconfig.Configs) - config, exists := configs[rel] + config, exists := configs[filepath.FromSlash(rel)] if !exists { parent := configs.ParentForPackage(rel) config = parent.NewChild() - configs[rel] = config + configs[filepath.FromSlash(rel)] = config } if f == nil { diff --git a/gazelle/python/generate.go b/gazelle/python/generate.go index 1937831c44..786baf3ce9 100644 --- a/gazelle/python/generate.go +++ b/gazelle/python/generate.go @@ -70,7 +70,7 @@ func matchesAnyGlob(s string, globs []string) bool { // in depth-first post-order. func (py *Python) GenerateRules(args language.GenerateArgs) language.GenerateResult { cfgs := args.Config.Exts[languageName].(pythonconfig.Configs) - cfg := cfgs[args.Rel] + cfg := cfgs[filepath.FromSlash(args.Rel)] if !cfg.ExtensionEnabled() { return language.GenerateResult{} diff --git a/gazelle/python/resolve.go b/gazelle/python/resolve.go index f019a64c1a..63372213f8 100644 --- a/gazelle/python/resolve.go +++ b/gazelle/python/resolve.go @@ -56,7 +56,7 @@ func (*Resolver) Name() string { return languageName } // returned, including an empty slice, the rule will be indexed. func (py *Resolver) Imports(c *config.Config, r *rule.Rule, f *rule.File) []resolve.ImportSpec { cfgs := c.Exts[languageName].(pythonconfig.Configs) - cfg := cfgs[f.Pkg] + cfg := cfgs[filepath.FromSlash(f.Pkg)] srcs := r.AttrStrings("srcs") provides := make([]resolve.ImportSpec, 0, len(srcs)+1) for _, src := range srcs { @@ -143,7 +143,7 @@ func (py *Resolver) Resolve( deps := treeset.NewWith(godsutils.StringComparator) if modulesRaw != nil { cfgs := c.Exts[languageName].(pythonconfig.Configs) - cfg := cfgs[from.Pkg] + cfg := cfgs[filepath.FromSlash(from.Pkg)] pythonProjectRoot := cfg.PythonProjectRoot() modules := modulesRaw.(*treeset.Set) it := modules.Iterator()