Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trying abs path for config install #14183

Merged
merged 4 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions conan/internal/cache/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ def __init__(self, base_folder, db_filename):
def _create_path(self, relative_path, remove_contents=True):
path = self._full_path(relative_path)
if os.path.exists(path) and remove_contents:
self._remove_path(relative_path)
rmdir(path)
os.makedirs(path, exist_ok=True)

def _remove_path(self, relative_path):
rmdir(self._full_path(relative_path))

def _full_path(self, relative_path):
# This one is used only for rmdir and mkdir operations, not returned to user
# or stored in DB
Expand Down
2 changes: 1 addition & 1 deletion conans/client/conf/config_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _hide_password(resource):
def tmp_config_install_folder(cache):
tmp_folder = os.path.join(cache.cache_folder, "tmp_config_install")
# necessary for Mac OSX, where the temp folders in /var/ are symlinks to /private/var/
tmp_folder = os.path.realpath(tmp_folder)
tmp_folder = os.path.abspath(tmp_folder)
rmdir(tmp_folder)
mkdir(tmp_folder)
try:
Expand Down
24 changes: 24 additions & 0 deletions conans/test/functional/command/test_custom_symlink_home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import platform

import pytest

from conans.test.utils.scm import create_local_git_repo
from conans.test.utils.test_files import temp_folder
from conans.test.utils.tools import TestClient
from conans.util.files import save


@pytest.mark.skipif(platform.system() == "Windows", reason="Uses symlinks")
def test_custom_symlinked_home_config_install():
base_cache = temp_folder()
real_cache = os.path.join(base_cache, "real_cache")
os.makedirs(real_cache)
symlink_cache = os.path.join(base_cache, "symlink_cache")
os.symlink(real_cache, symlink_cache)
origin_folder = temp_folder()
save(os.path.join(origin_folder, "myfile.txt"), "some contents")
create_local_git_repo(folder=origin_folder)
c = TestClient(cache_folder=symlink_cache)
c.run(f'config install "{origin_folder}" --type=git')
assert "Copying file myfile.txt to" in c.out