diff -Nru setuptools-68.1.2/debian/changelog setuptools-68.1.2/debian/changelog
--- setuptools-68.1.2/debian/changelog	2023-10-04 10:28:14.000000000 +0200
+++ setuptools-68.1.2/debian/changelog	2024-05-22 05:22:53.000000000 +0200
@@ -1,3 +1,11 @@
+setuptools (68.1.2-3) UNRELEASED; urgency=medium
+
+  * d/p/install-layout.diff:
+    - Honour the --prefix option if explicitly used (Closes: #1071601.
+      LP: #2066339)
+
+ -- Marco Trevisan (Treviño) <marco@ubuntu.com>  Wed, 22 May 2024 05:22:53 +0200
+
 setuptools (68.1.2-2) unstable; urgency=medium
 
   * Don't run dh_auto_clean, just remove the .pybuild directory manually.
diff -Nru setuptools-68.1.2/debian/patches/install-layout.diff setuptools-68.1.2/debian/patches/install-layout.diff
--- setuptools-68.1.2/debian/patches/install-layout.diff	2023-08-24 20:56:38.000000000 +0200
+++ setuptools-68.1.2/debian/patches/install-layout.diff	2024-05-22 05:22:53.000000000 +0200
@@ -1,6 +1,6 @@
 --- a/setuptools/command/easy_install.py
 +++ b/setuptools/command/easy_install.py
-@@ -142,6 +142,8 @@ class easy_install(Command):
+@@ -142,6 +142,8 @@
          ('allow-hosts=', 'H', "pattern(s) that hostnames must match"),
          ('local-snapshots-ok', 'l', "allow building eggs from local checkouts"),
          ('version', None, "print version information and exit"),
@@ -9,7 +9,7 @@
          (
              'no-find-links',
              None,
-@@ -156,7 +158,7 @@ class easy_install(Command):
+@@ -156,7 +158,7 @@
          'upgrade',
          'always-copy',
          'editable',
@@ -18,7 +18,7 @@
          'local-snapshots-ok',
          'version',
          'user',
-@@ -199,6 +201,10 @@ class easy_install(Command):
+@@ -199,6 +201,10 @@
          self.pth_file = self.always_copy_from = None
          self.site_dirs = None
          self.installed_projects = {}
@@ -29,7 +29,7 @@
          # Always read easy_install options, even if we are subclassed, or have
          # an independent instance created.  This ensures that defaults will
          # always come from the standard configuration file(s)' "easy_install"
-@@ -287,6 +293,11 @@ class easy_install(Command):
+@@ -287,6 +293,11 @@
          self.expand_basedirs()
          self.expand_dirs()
  
@@ -41,7 +41,7 @@
          self._expand(
              'install_dir',
              'script_dir',
-@@ -311,6 +322,15 @@ class easy_install(Command):
+@@ -311,6 +322,15 @@
          if self.user and self.install_purelib:
              self.install_dir = self.install_purelib
              self.script_dir = self.install_scripts
@@ -57,7 +57,7 @@
          # default --record from the install command
          self.set_undefined_options('install', ('record', 'record'))
          self.all_site_dirs = get_site_dirs()
-@@ -1373,11 +1393,28 @@ class easy_install(Command):
+@@ -1373,11 +1393,28 @@
                  self.debug_print("os.makedirs('%s', 0o700)" % path)
                  os.makedirs(path, 0o700)
  
@@ -86,7 +86,7 @@
      )
  
      DEFAULT_SCHEME = dict(
-@@ -1388,11 +1425,18 @@ class easy_install(Command):
+@@ -1388,11 +1425,18 @@
      def _expand(self, *attrs):
          config_vars = self.get_finalized_command('install').config_vars
  
@@ -107,7 +107,7 @@
              for attr, val in scheme.items():
                  if getattr(self, attr, None) is None:
                      setattr(self, attr, val)
-@@ -1437,9 +1481,15 @@ def get_site_dirs():
+@@ -1437,9 +1481,15 @@
                  [
                      os.path.join(
                          prefix,
@@ -133,7 +133,7 @@
  
  from setuptools import Command
  from setuptools import namespaces
-@@ -18,11 +18,28 @@ class install_egg_info(namespaces.Instal
+@@ -18,11 +18,28 @@
  
      def initialize_options(self):
          self.install_dir = None
@@ -162,3 +162,40 @@
          self.source = ei_cmd.egg_info
          self.target = os.path.join(self.install_dir, basename)
          self.outputs = []
+--- a/setuptools/_distutils/command/install.py
++++ b/setuptools/_distutils/command/install.py
+@@ -128,7 +128,7 @@
+ 
+ 
+ def _select_scheme(ob, name):
+-    scheme = _inject_headers(name, _load_scheme(_resolve_scheme(name)))
++    scheme = _inject_headers(name, _load_scheme(_resolve_scheme(ob, name)))
+     vars(ob).update(_remove_set(ob, _scheme_attrs(scheme)))
+ 
+ 
+@@ -139,7 +139,24 @@
+     return {key: value for key, value in attrs.items() if getattr(ob, key) is None}
+ 
+ 
+-def _resolve_scheme(name):
++def _resolve_scheme(ob, name):
++    # In debian, as per the logic defined in _distutils_system_mod.py install
++    # override, the scheme name is normally `posix_local`, unless a prefix is
++    # explicitly provided as parameter, in such case it's `posix_prefix`.
++    # However, again, the debian definition of sysconfig.get_preferred_scheme()
++    # can be either deb_system (when building debian packages) or posix_local
++    # (otherwise) and since such function can only take "prefix", "home" or
++    # "user" as key, we can't really change its behavior there (e.g. by passing
++    # "local" to it). Thus, in case the posix prefix is requested and the
++    # install prefix is explicitly set, just return it instead of getting the
++    # preferred scheme, since that would be resloved in `posix_local`, making
++    # us to install in ${PREFIX}/local and not in ${PREFIX}.
++    if (name == 'posix_prefix' and
++        ob.prefix_option and
++        os.path.normpath(ob.prefix) != '/usr/local' and
++        os.environ.get('DEB_PYTHON_INSTALL_LAYOUT') not in ('deb', 'deb_system')):
++        return name
++
+     os_name, sep, key = name.partition('_')
+     try:
+         resolved = sysconfig.get_preferred_scheme(key)
