fix: normalize stub_path in repl.bzl (#3104)

When a REPL target is run from an external Bazel module, the `stub_path`
can have path components in it (e.g. "/..") which get rejected by the
`Rlocation()` function in `runfiles.py` for not being normalized. This
commit normalizes the path before it's passed to `Rlocation()`.

Fixes #3101

---------

Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 74a4409..5ad48be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -93,6 +93,8 @@
   ([#3099](https://github.com/bazel-contrib/rules_python/issues/3099)).
 * (pypi) Expose pypi packages only common to all Python versions in `all_requirements`
   ([#2921](https://github.com/bazel-contrib/rules_python/issues/2921)).
+* (repl) Normalize the path for the `REPL` stub to make it possible to use the
+  default stub template from outside `rules_python` ({gh-issue}`3101`).
 
 {#v0-0-0-added}
 ### Added
diff --git a/python/private/repl_template.py b/python/private/repl_template.py
index 37f4529..dd8beb9 100644
--- a/python/private/repl_template.py
+++ b/python/private/repl_template.py
@@ -5,7 +5,9 @@
 
 from python.runfiles import runfiles
 
-STUB_PATH = "%stub_path%"
+# runfiles.py will reject paths which aren't normalized, which can happen when the REPL rules are
+# used from a remote module.
+STUB_PATH = os.path.normpath("%stub_path%")
 
 
 def start_repl():