diff --git a/conans/client/rest_client_local_recipe_index.py b/conans/client/rest_client_local_recipe_index.py index 9285d7942fb..1da0de5fc1f 100644 --- a/conans/client/rest_client_local_recipe_index.py +++ b/conans/client/rest_client_local_recipe_index.py @@ -143,17 +143,16 @@ def _export_recipe(self, ref): sys.stderr = StringIO() try: global_conf = ConfDefinition() - new_ref, _ = cmd_export(self._app, global_conf, conanfile_path, - ref.name, str(ref.version), None, None) + new_ref, _ = cmd_export(self._app, global_conf, conanfile_path, ref.name, + str(ref.version), None, None, remotes=[self._remote]) except Exception as e: raise ConanException(f"Error while exporting recipe from remote: {self._remote.name}\n" f"{str(e)}") finally: - export_stderr = sys.stderr.getvalue() + export_err = sys.stderr.getvalue() sys.stderr = original_stderr - ConanOutput().debug(f"Internal export for {ref}:\n" - f"{textwrap.indent(export_stderr, ' ')}") - + ConanOutput(scope="local-recipes-index").debug(f"Internal export for {ref}:\n" + f"{textwrap.indent(export_err, ' ')}") return new_ref @staticmethod diff --git a/test/integration/remote/test_local_recipes_index.py b/test/integration/remote/test_local_recipes_index.py index 2b5114968cc..31103c0145b 100644 --- a/test/integration/remote/test_local_recipes_index.py +++ b/test/integration/remote/test_local_recipes_index.py @@ -331,3 +331,32 @@ class Zlib(ConanFile): c.run(f"remote add local '{folder}'") c.run("install --requires=zlib/[*] --build missing", assert_error=True) assert "NameError: name 'ConanFile' is not defined" in c.out + + +class TestPythonRequires: + @pytest.fixture(scope="class") + def c3i_pyrequires_folder(self): + folder = temp_folder() + recipes_folder = os.path.join(folder, "recipes") + config = textwrap.dedent(""" + versions: + "1.0": + folder: all + """) + pkg = str(GenConanfile("pkg").with_python_requires("pyreq/1.0")) + save_files(recipes_folder, + {"pkg/config.yml": config, + "pkg/all/conanfile.py": pkg, + "pyreq/config.yml": config, + "pyreq/all/conanfile.py": str(GenConanfile("pyreq", "1.0"))}) + return folder + + def test_install(self, c3i_pyrequires_folder): + c = TestClient(light=True) + c.run(f"remote add local '{c3i_pyrequires_folder}'") + c.run("list * -r=local") + assert "pyreq/1.0" in c.out + assert "pkg/1.0" in c.out + c.run("install --requires=pkg/1.0 --build missing -vvv") + assert "pyreq/1.0#a0d63ca853edefa33582a24a1bb3c75f - Downloaded (local)" in c.out + assert "pkg/1.0: Created package" in c.out