refactor: call a function to define internal pypi flags instead of listcomp (#2011)

This is updated so tooling can more automatically process the files. In
particular, it helps tools, like buildozer, process the files, which
makes it easier to import the code into Google. This is because there is
a named target that buildozer can be told to process, whereas, with a
list comprehension, it's an arbitrary chunk of code that has to be
patched, without an identifiable label.
diff --git a/python/config_settings/BUILD.bazel b/python/config_settings/BUILD.bazel
index f6f46db..f2383d6 100644
--- a/python/config_settings/BUILD.bazel
+++ b/python/config_settings/BUILD.bazel
@@ -10,10 +10,10 @@
 )
 load(
     "//python/private/pypi:flags.bzl",
-    "INTERNAL_FLAGS",
     "UniversalWhlFlag",
     "UseWhlFlag",
     "WhlLibcFlag",
+    "define_pypi_internal_flags",
 )
 load(":config_settings.bzl", "construct_config_settings")
 
@@ -163,14 +163,6 @@
     visibility = ["//visibility:public"],
 )
 
-# private pip whl related flags. Their values cannot be changed and they
-# are an implementation detail of how `pip_config_settings` work.
-[
-    string_flag(
-        name = "_internal_pip_" + flag,
-        build_setting_default = "",
-        values = [""],
-        visibility = ["//visibility:public"],
-    )
-    for flag in INTERNAL_FLAGS
-]
+define_pypi_internal_flags(
+    name = "define_pypi_internal_flags",
+)
diff --git a/python/private/pypi/BUILD.bazel b/python/private/pypi/BUILD.bazel
index e7ae735..0960b6a 100644
--- a/python/private/pypi/BUILD.bazel
+++ b/python/private/pypi/BUILD.bazel
@@ -92,7 +92,10 @@
 bzl_library(
     name = "flags_bzl",
     srcs = ["flags.bzl"],
-    deps = ["//python/private:enum_bzl"],
+    deps = [
+        "//python/private:enum_bzl",
+        "@bazel_skylib//rules:common_settings",
+    ],
 )
 
 bzl_library(
diff --git a/python/private/pypi/flags.bzl b/python/private/pypi/flags.bzl
index d834be8..1e38062 100644
--- a/python/private/pypi/flags.bzl
+++ b/python/private/pypi/flags.bzl
@@ -18,6 +18,7 @@
 unnecessary files when all that are needed are flag definitions.
 """
 
+load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
 load("//python/private:enum.bzl", "enum")
 
 # Determines if we should use whls for third party
@@ -68,3 +69,12 @@
     "whl_pycp3x_abi3",
     "whl_pycp3x_abicp",
 ]
+
+def define_pypi_internal_flags(name):
+    for flag in INTERNAL_FLAGS:
+        string_flag(
+            name = "_internal_pip_" + flag,
+            build_setting_default = "",
+            values = [""],
+            visibility = ["//visibility:public"],
+        )