We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Consider turning off template directories in Git for conan config install
To help us debug your issue please explain:

- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

This is with Conan 1.6.0 on Windows 10.

To see this in progress, have a Git installation set up with automatic ctags generation akin to what's described in [Effortless Ctags with Git](https://tbaggery.com/2011/08/08/effortless-ctags-with-git.html).

When doing `conan config install` with a Git URL, I get error messages like this:

```
Traceback (most recent call last):
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\shutil.py", line 391, in _rmtree_unsafe
    os.rmdir(path)
OSError: [WinError 145] The directory is not empty: 'C:\\Users\\kam\\.conan\\tmp_config_install\\config\\.git\\hooks'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\site-packages\conans\client\command.py", line 1230, in run
    method(args[0][1:])
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\site-packages\conans\client\command.py", line 379, in config
    return self._conan.config_install(args.item, verify_ssl, args.type)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\site-packages\conans\client\conan_api.py", line 79, in wrapper
    return f(*args, **kwargs)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\site-packages\conans\client\conan_api.py", line 510, in config_install
    return configuration_install(item, self._client_cache, self._user_io.out, verify_ssl, config_type)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\site-packages\conans\client\conf\config_installer.py", line 135, in configuration_install
    rmdir(tmp_folder)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\site-packages\conans\util\files.py", line 202, in rmdir
    shutil.rmtree(path, onerror=_change_permissions)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\shutil.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\shutil.py", line 393, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "c:\users\kam\.virtualenvs\skel-hv6zqtfh\lib\site-packages\conans\util\files.py", line 197, in _change_permissions
    raise OSError("Cannot change permissions for {}! Exception info: {}".format(path, exc_info))
OSError: Cannot change permissions for C:\Users\kam\.conan\tmp_config_install\config\.git\hooks! Exception info: (<class 'OSError'>, OSError(41, 'The directory is not empty'), <traceback object at 0x0000016409078548>)

ERROR: Cannot change permissions for C:\Users\kam\.conan\tmp_config_install\config\.git\hooks! Exception info: (<class 'OSError'>, OSError(41, 'The directory is not empty'), <traceback object at 0x0000016409078548>)
```

The problem boils down to the way files are locked on Windows. It's not possible to delete open files. But the hook starts a background process which has the script files open, and the cleanup of the directory fails. Of course, a second later, the directory can be deleted as files are closed and unlocked.

I've since started reworking my Git template to not start background processes by default, and only run `ctags` in checkouts that I'm actually developing on. This fixes my problem with `conan config install`.

It may make sense, though, to add `-c init.templateDir=` to the `git` command line when working on temporary downloads. It's part of sanitizing the process against user configuration: In a hook, _anything_ can happen, and the errors are obscure and difficult to understand.

`conan config install` is mostly treating a Git repository as a sophisticated form of file archive, and probably doesn't want the user's hooks or other unusual setups from the template.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conans/client/conf/config_installer.py`
Content:
```
1 import os
2 import shutil
3 from six.moves.urllib.parse import urlparse
4 
5 from conans.tools import unzip
6 from conans.util.files import rmdir, mkdir
7 from conans.client.remote_registry import RemoteRegistry
8 from conans import tools
9 from conans.errors import ConanException
10 import subprocess
11 
12 
13 def _hide_password(resource):
14     """
15     Hide password from url/file path
16 
17     :param resource: string with url or file path
18     :return: resource with hidden password if present
19     """
20     password = urlparse(resource).password
21     return resource.replace(password, "<hidden>") if password else resource
22 
23 
24 def _handle_remotes(registry_path, remote_file, output):
25     registry = RemoteRegistry(registry_path, output)
26     new_registry = RemoteRegistry(remote_file, output)
27     registry.define_remotes(new_registry.remotes)
28 
29 
30 def _handle_profiles(source_folder, target_folder, output):
31     mkdir(target_folder)
32     for root, _, files in os.walk(source_folder):
33         relative_path = os.path.relpath(root, source_folder)
34         if relative_path == ".":
35             relative_path = ""
36         for f in files:
37             profile = os.path.join(relative_path, f)
38             output.info("    Installing profile %s" % profile)
39             shutil.copy(os.path.join(root, f), os.path.join(target_folder, profile))
40 
41 
42 def _process_git_repo(repo_url, client_cache, output, tmp_folder, verify_ssl):
43     output.info("Trying to clone repo  %s" % repo_url)
44 
45     with tools.chdir(tmp_folder):
46         try:
47             subprocess.check_output('git -c http.sslVerify=%s clone "%s" config' % (verify_ssl, repo_url),
48                                     shell=True)
49             output.info("Repo cloned")
50         except Exception as e:
51             raise ConanException("config install error. Can't clone repo: %s" % str(e))
52 
53     tmp_folder = os.path.join(tmp_folder, "config")
54     _process_folder(tmp_folder, client_cache, output)
55 
56 
57 def _process_zip_file(zippath, client_cache, output, tmp_folder, remove=False):
58     unzip(zippath, tmp_folder)
59     if remove:
60         os.unlink(zippath)
61     _process_folder(tmp_folder, client_cache, output)
62 
63 
64 def _handle_conan_conf(current_conan_conf, new_conan_conf_path):
65     current_conan_conf.read(new_conan_conf_path)
66     with open(current_conan_conf.filename, "w") as f:
67         current_conan_conf.write(f)
68 
69 
70 def _process_folder(folder, client_cache, output):
71     for root, dirs, files in os.walk(folder):
72         for f in files:
73             if f == "settings.yml":
74                 output.info("Installing settings.yml")
75                 settings_path = client_cache.settings_path
76                 shutil.copy(os.path.join(root, f), settings_path)
77             elif f == "conan.conf":
78                 output.info("Processing conan.conf")
79                 conan_conf = client_cache.conan_config
80                 _handle_conan_conf(conan_conf, os.path.join(root, f))
81             elif f == "remotes.txt":
82                 output.info("Defining remotes")
83                 registry_path = client_cache.registry
84                 _handle_remotes(registry_path, os.path.join(root, f), output)
85             else:
86                 relpath = os.path.relpath(root, folder)
87                 target_folder = os.path.join(client_cache.conan_folder, relpath)
88                 mkdir(target_folder)
89                 output.info("Copying file %s to %s" % (f, target_folder))
90                 shutil.copy(os.path.join(root, f), target_folder)
91         for d in dirs:
92             if d == "profiles":
93                 output.info("Installing profiles")
94                 profiles_path = client_cache.profiles_path
95                 _handle_profiles(os.path.join(root, d), profiles_path, output)
96                 break
97         dirs[:] = [d for d in dirs if d not in ("profiles", ".git")]
98 
99 
100 def _process_download(item, client_cache, output, tmp_folder, verify_ssl):
101     output.info("Trying to download  %s" % _hide_password(item))
102     zippath = os.path.join(tmp_folder, "config.zip")
103     try:
104         tools.download(item, zippath, out=output, verify=verify_ssl)
105         _process_zip_file(zippath, client_cache, output, tmp_folder, remove=True)
106     except Exception as e:
107         raise ConanException("Error while installing config from %s\n%s" % (item, str(e)))
108 
109 
110 def configuration_install(item, client_cache, output, verify_ssl, config_type=None):
111     tmp_folder = os.path.join(client_cache.conan_folder, "tmp_config_install")
112     # necessary for Mac OSX, where the temp folders in /var/ are symlinks to /private/var/
113     tmp_folder = os.path.realpath(tmp_folder)
114     mkdir(tmp_folder)
115     try:
116         if item is None:
117             try:
118                 item = client_cache.conan_config.get_item("general.config_install")
119             except ConanException:
120                 raise ConanException("Called config install without arguments and "
121                                      "'general.config_install' not defined in conan.conf")
122 
123         if item.endswith(".git") or config_type == "git":
124             _process_git_repo(item, client_cache, output, tmp_folder, verify_ssl)
125         elif os.path.exists(item):
126             # is a local file
127             _process_zip_file(item, client_cache, output, tmp_folder)
128         elif item.startswith("http"):
129             _process_download(item, client_cache, output, tmp_folder, verify_ssl)
130         else:
131             raise ConanException("I don't know how to process %s" % item)
132     finally:
133         if item:
134             client_cache.conan_config.set_item("general.config_install", item)
135         rmdir(tmp_folder)
136
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conans/client/conf/config_installer.py b/conans/client/conf/config_installer.py
--- a/conans/client/conf/config_installer.py
+++ b/conans/client/conf/config_installer.py
@@ -44,7 +44,7 @@
 
     with tools.chdir(tmp_folder):
         try:
-            subprocess.check_output('git -c http.sslVerify=%s clone "%s" config' % (verify_ssl, repo_url),
+            subprocess.check_output('git -c http.sslVerify=%s -c init.templateDir= clone "%s" config' % (verify_ssl, repo_url),
                                     shell=True)
             output.info("Repo cloned")
         except Exception as e:

{"golden_diff": "diff --git a/conans/client/conf/config_installer.py b/conans/client/conf/config_installer.py\n--- a/conans/client/conf/config_installer.py\n+++ b/conans/client/conf/config_installer.py\n@@ -44,7 +44,7 @@\n \n     with tools.chdir(tmp_folder):\n         try:\n-            subprocess.check_output('git -c http.sslVerify=%s clone \"%s\" config' % (verify_ssl, repo_url),\n+            subprocess.check_output('git -c http.sslVerify=%s -c init.templateDir= clone \"%s\" config' % (verify_ssl, repo_url),\n                                     shell=True)\n             output.info(\"Repo cloned\")\n         except Exception as e:\n", "issue": "Consider turning off template directories in Git for conan config install\nTo help us debug your issue please explain:\r\n\r\n- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).\r\n- [x] I've specified the Conan version, operating system version and any tool that can be relevant.\r\n- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.\r\n\r\nThis is with Conan 1.6.0 on Windows 10.\r\n\r\nTo see this in progress, have a Git installation set up with automatic ctags generation akin to what's described in [Effortless Ctags with Git](https://tbaggery.com/2011/08/08/effortless-ctags-with-git.html).\r\n\r\nWhen doing `conan config install` with a Git URL, I get error messages like this:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\shutil.py\", line 391, in _rmtree_unsafe\r\n    os.rmdir(path)\r\nOSError: [WinError 145] The directory is not empty: 'C:\\\\Users\\\\kam\\\\.conan\\\\tmp_config_install\\\\config\\\\.git\\\\hooks'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\site-packages\\conans\\client\\command.py\", line 1230, in run\r\n    method(args[0][1:])\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\site-packages\\conans\\client\\command.py\", line 379, in config\r\n    return self._conan.config_install(args.item, verify_ssl, args.type)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\site-packages\\conans\\client\\conan_api.py\", line 79, in wrapper\r\n    return f(*args, **kwargs)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\site-packages\\conans\\client\\conan_api.py\", line 510, in config_install\r\n    return configuration_install(item, self._client_cache, self._user_io.out, verify_ssl, config_type)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\site-packages\\conans\\client\\conf\\config_installer.py\", line 135, in configuration_install\r\n    rmdir(tmp_folder)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\site-packages\\conans\\util\\files.py\", line 202, in rmdir\r\n    shutil.rmtree(path, onerror=_change_permissions)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\shutil.py\", line 494, in rmtree\r\n    return _rmtree_unsafe(path, onerror)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\shutil.py\", line 384, in _rmtree_unsafe\r\n    _rmtree_unsafe(fullname, onerror)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\shutil.py\", line 384, in _rmtree_unsafe\r\n    _rmtree_unsafe(fullname, onerror)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\shutil.py\", line 384, in _rmtree_unsafe\r\n    _rmtree_unsafe(fullname, onerror)\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\shutil.py\", line 393, in _rmtree_unsafe\r\n    onerror(os.rmdir, path, sys.exc_info())\r\n  File \"c:\\users\\kam\\.virtualenvs\\skel-hv6zqtfh\\lib\\site-packages\\conans\\util\\files.py\", line 197, in _change_permissions\r\n    raise OSError(\"Cannot change permissions for {}! Exception info: {}\".format(path, exc_info))\r\nOSError: Cannot change permissions for C:\\Users\\kam\\.conan\\tmp_config_install\\config\\.git\\hooks! Exception info: (<class 'OSError'>, OSError(41, 'The directory is not empty'), <traceback object at 0x0000016409078548>)\r\n\r\nERROR: Cannot change permissions for C:\\Users\\kam\\.conan\\tmp_config_install\\config\\.git\\hooks! Exception info: (<class 'OSError'>, OSError(41, 'The directory is not empty'), <traceback object at 0x0000016409078548>)\r\n```\r\n\r\nThe problem boils down to the way files are locked on Windows. It's not possible to delete open files. But the hook starts a background process which has the script files open, and the cleanup of the directory fails. Of course, a second later, the directory can be deleted as files are closed and unlocked.\r\n\r\nI've since started reworking my Git template to not start background processes by default, and only run `ctags` in checkouts that I'm actually developing on. This fixes my problem with `conan config install`.\r\n\r\nIt may make sense, though, to add `-c init.templateDir=` to the `git` command line when working on temporary downloads. It's part of sanitizing the process against user configuration: In a hook, _anything_ can happen, and the errors are obscure and difficult to understand.\r\n\r\n`conan config install` is mostly treating a Git repository as a sophisticated form of file archive, and probably doesn't want the user's hooks or other unusual setups from the template.\r\n\n", "before_files": [{"content": "import os\nimport shutil\nfrom six.moves.urllib.parse import urlparse\n\nfrom conans.tools import unzip\nfrom conans.util.files import rmdir, mkdir\nfrom conans.client.remote_registry import RemoteRegistry\nfrom conans import tools\nfrom conans.errors import ConanException\nimport subprocess\n\n\ndef _hide_password(resource):\n    \"\"\"\n    Hide password from url/file path\n\n    :param resource: string with url or file path\n    :return: resource with hidden password if present\n    \"\"\"\n    password = urlparse(resource).password\n    return resource.replace(password, \"<hidden>\") if password else resource\n\n\ndef _handle_remotes(registry_path, remote_file, output):\n    registry = RemoteRegistry(registry_path, output)\n    new_registry = RemoteRegistry(remote_file, output)\n    registry.define_remotes(new_registry.remotes)\n\n\ndef _handle_profiles(source_folder, target_folder, output):\n    mkdir(target_folder)\n    for root, _, files in os.walk(source_folder):\n        relative_path = os.path.relpath(root, source_folder)\n        if relative_path == \".\":\n            relative_path = \"\"\n        for f in files:\n            profile = os.path.join(relative_path, f)\n            output.info(\"    Installing profile %s\" % profile)\n            shutil.copy(os.path.join(root, f), os.path.join(target_folder, profile))\n\n\ndef _process_git_repo(repo_url, client_cache, output, tmp_folder, verify_ssl):\n    output.info(\"Trying to clone repo  %s\" % repo_url)\n\n    with tools.chdir(tmp_folder):\n        try:\n            subprocess.check_output('git -c http.sslVerify=%s clone \"%s\" config' % (verify_ssl, repo_url),\n                                    shell=True)\n            output.info(\"Repo cloned\")\n        except Exception as e:\n            raise ConanException(\"config install error. Can't clone repo: %s\" % str(e))\n\n    tmp_folder = os.path.join(tmp_folder, \"config\")\n    _process_folder(tmp_folder, client_cache, output)\n\n\ndef _process_zip_file(zippath, client_cache, output, tmp_folder, remove=False):\n    unzip(zippath, tmp_folder)\n    if remove:\n        os.unlink(zippath)\n    _process_folder(tmp_folder, client_cache, output)\n\n\ndef _handle_conan_conf(current_conan_conf, new_conan_conf_path):\n    current_conan_conf.read(new_conan_conf_path)\n    with open(current_conan_conf.filename, \"w\") as f:\n        current_conan_conf.write(f)\n\n\ndef _process_folder(folder, client_cache, output):\n    for root, dirs, files in os.walk(folder):\n        for f in files:\n            if f == \"settings.yml\":\n                output.info(\"Installing settings.yml\")\n                settings_path = client_cache.settings_path\n                shutil.copy(os.path.join(root, f), settings_path)\n            elif f == \"conan.conf\":\n                output.info(\"Processing conan.conf\")\n                conan_conf = client_cache.conan_config\n                _handle_conan_conf(conan_conf, os.path.join(root, f))\n            elif f == \"remotes.txt\":\n                output.info(\"Defining remotes\")\n                registry_path = client_cache.registry\n                _handle_remotes(registry_path, os.path.join(root, f), output)\n            else:\n                relpath = os.path.relpath(root, folder)\n                target_folder = os.path.join(client_cache.conan_folder, relpath)\n                mkdir(target_folder)\n                output.info(\"Copying file %s to %s\" % (f, target_folder))\n                shutil.copy(os.path.join(root, f), target_folder)\n        for d in dirs:\n            if d == \"profiles\":\n                output.info(\"Installing profiles\")\n                profiles_path = client_cache.profiles_path\n                _handle_profiles(os.path.join(root, d), profiles_path, output)\n                break\n        dirs[:] = [d for d in dirs if d not in (\"profiles\", \".git\")]\n\n\ndef _process_download(item, client_cache, output, tmp_folder, verify_ssl):\n    output.info(\"Trying to download  %s\" % _hide_password(item))\n    zippath = os.path.join(tmp_folder, \"config.zip\")\n    try:\n        tools.download(item, zippath, out=output, verify=verify_ssl)\n        _process_zip_file(zippath, client_cache, output, tmp_folder, remove=True)\n    except Exception as e:\n        raise ConanException(\"Error while installing config from %s\\n%s\" % (item, str(e)))\n\n\ndef configuration_install(item, client_cache, output, verify_ssl, config_type=None):\n    tmp_folder = os.path.join(client_cache.conan_folder, \"tmp_config_install\")\n    # necessary for Mac OSX, where the temp folders in /var/ are symlinks to /private/var/\n    tmp_folder = os.path.realpath(tmp_folder)\n    mkdir(tmp_folder)\n    try:\n        if item is None:\n            try:\n                item = client_cache.conan_config.get_item(\"general.config_install\")\n            except ConanException:\n                raise ConanException(\"Called config install without arguments and \"\n                                     \"'general.config_install' not defined in conan.conf\")\n\n        if item.endswith(\".git\") or config_type == \"git\":\n            _process_git_repo(item, client_cache, output, tmp_folder, verify_ssl)\n        elif os.path.exists(item):\n            # is a local file\n            _process_zip_file(item, client_cache, output, tmp_folder)\n        elif item.startswith(\"http\"):\n            _process_download(item, client_cache, output, tmp_folder, verify_ssl)\n        else:\n            raise ConanException(\"I don't know how to process %s\" % item)\n    finally:\n        if item:\n            client_cache.conan_config.set_item(\"general.config_install\", item)\n        rmdir(tmp_folder)\n", "path": "conans/client/conf/config_installer.py"}], "after_files": [{"content": "import os\nimport shutil\nfrom six.moves.urllib.parse import urlparse\n\nfrom conans.tools import unzip\nfrom conans.util.files import rmdir, mkdir\nfrom conans.client.remote_registry import RemoteRegistry\nfrom conans import tools\nfrom conans.errors import ConanException\nimport subprocess\n\n\ndef _hide_password(resource):\n    \"\"\"\n    Hide password from url/file path\n\n    :param resource: string with url or file path\n    :return: resource with hidden password if present\n    \"\"\"\n    password = urlparse(resource).password\n    return resource.replace(password, \"<hidden>\") if password else resource\n\n\ndef _handle_remotes(registry_path, remote_file, output):\n    registry = RemoteRegistry(registry_path, output)\n    new_registry = RemoteRegistry(remote_file, output)\n    registry.define_remotes(new_registry.remotes)\n\n\ndef _handle_profiles(source_folder, target_folder, output):\n    mkdir(target_folder)\n    for root, _, files in os.walk(source_folder):\n        relative_path = os.path.relpath(root, source_folder)\n        if relative_path == \".\":\n            relative_path = \"\"\n        for f in files:\n            profile = os.path.join(relative_path, f)\n            output.info(\"    Installing profile %s\" % profile)\n            shutil.copy(os.path.join(root, f), os.path.join(target_folder, profile))\n\n\ndef _process_git_repo(repo_url, client_cache, output, tmp_folder, verify_ssl):\n    output.info(\"Trying to clone repo  %s\" % repo_url)\n\n    with tools.chdir(tmp_folder):\n        try:\n            subprocess.check_output('git -c http.sslVerify=%s -c init.templateDir= clone \"%s\" config' % (verify_ssl, repo_url),\n                                    shell=True)\n            output.info(\"Repo cloned\")\n        except Exception as e:\n            raise ConanException(\"config install error. Can't clone repo: %s\" % str(e))\n\n    tmp_folder = os.path.join(tmp_folder, \"config\")\n    _process_folder(tmp_folder, client_cache, output)\n\n\ndef _process_zip_file(zippath, client_cache, output, tmp_folder, remove=False):\n    unzip(zippath, tmp_folder)\n    if remove:\n        os.unlink(zippath)\n    _process_folder(tmp_folder, client_cache, output)\n\n\ndef _handle_conan_conf(current_conan_conf, new_conan_conf_path):\n    current_conan_conf.read(new_conan_conf_path)\n    with open(current_conan_conf.filename, \"w\") as f:\n        current_conan_conf.write(f)\n\n\ndef _process_folder(folder, client_cache, output):\n    for root, dirs, files in os.walk(folder):\n        for f in files:\n            if f == \"settings.yml\":\n                output.info(\"Installing settings.yml\")\n                settings_path = client_cache.settings_path\n                shutil.copy(os.path.join(root, f), settings_path)\n            elif f == \"conan.conf\":\n                output.info(\"Processing conan.conf\")\n                conan_conf = client_cache.conan_config\n                _handle_conan_conf(conan_conf, os.path.join(root, f))\n            elif f == \"remotes.txt\":\n                output.info(\"Defining remotes\")\n                registry_path = client_cache.registry\n                _handle_remotes(registry_path, os.path.join(root, f), output)\n            else:\n                relpath = os.path.relpath(root, folder)\n                target_folder = os.path.join(client_cache.conan_folder, relpath)\n                mkdir(target_folder)\n                output.info(\"Copying file %s to %s\" % (f, target_folder))\n                shutil.copy(os.path.join(root, f), target_folder)\n        for d in dirs:\n            if d == \"profiles\":\n                output.info(\"Installing profiles\")\n                profiles_path = client_cache.profiles_path\n                _handle_profiles(os.path.join(root, d), profiles_path, output)\n                break\n        dirs[:] = [d for d in dirs if d not in (\"profiles\", \".git\")]\n\n\ndef _process_download(item, client_cache, output, tmp_folder, verify_ssl):\n    output.info(\"Trying to download  %s\" % _hide_password(item))\n    zippath = os.path.join(tmp_folder, \"config.zip\")\n    try:\n        tools.download(item, zippath, out=output, verify=verify_ssl)\n        _process_zip_file(zippath, client_cache, output, tmp_folder, remove=True)\n    except Exception as e:\n        raise ConanException(\"Error while installing config from %s\\n%s\" % (item, str(e)))\n\n\ndef configuration_install(item, client_cache, output, verify_ssl, config_type=None):\n    tmp_folder = os.path.join(client_cache.conan_folder, \"tmp_config_install\")\n    # necessary for Mac OSX, where the temp folders in /var/ are symlinks to /private/var/\n    tmp_folder = os.path.realpath(tmp_folder)\n    mkdir(tmp_folder)\n    try:\n        if item is None:\n            try:\n                item = client_cache.conan_config.get_item(\"general.config_install\")\n            except ConanException:\n                raise ConanException(\"Called config install without arguments and \"\n                                     \"'general.config_install' not defined in conan.conf\")\n\n        if item.endswith(\".git\") or config_type == \"git\":\n            _process_git_repo(item, client_cache, output, tmp_folder, verify_ssl)\n        elif os.path.exists(item):\n            # is a local file\n            _process_zip_file(item, client_cache, output, tmp_folder)\n        elif item.startswith(\"http\"):\n            _process_download(item, client_cache, output, tmp_folder, verify_ssl)\n        else:\n            raise ConanException(\"I don't know how to process %s\" % item)\n    finally:\n        if item:\n            client_cache.conan_config.set_item(\"general.config_install\", item)\n        rmdir(tmp_folder)\n", "path": "conans/client/conf/config_installer.py"}]}