From a3d123aff16f438acd754513d097ba8ed0225166 Mon Sep 17 00:00:00 2001 From: Bartek Sokorski Date: Sun, 28 Jan 2024 02:49:08 +0100 Subject: [PATCH] Remove special case for MacOS config directory --- src/poetry/locations.py | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/poetry/locations.py b/src/poetry/locations.py index 0b8c0826d97..87ff1a94a92 100644 --- a/src/poetry/locations.py +++ b/src/poetry/locations.py @@ -1,8 +1,6 @@ from __future__ import annotations -import logging import os -import sys from pathlib import Path @@ -11,8 +9,6 @@ from platformdirs import user_data_path -logger = logging.getLogger(__name__) - _APP_NAME = "pypoetry" DEFAULT_CACHE_DIR = user_cache_path(_APP_NAME, appauthor=False) @@ -21,33 +17,9 @@ or user_config_path(_APP_NAME, appauthor=False, roaming=True) ) -# platformdirs 2.0.0 corrected the OSX/macOS config directory from -# /Users//Library/Application Support/ to -# /Users//Library/Preferences/. -# -# Then platformdirs 3.0.0 corrected it back again! -# -# Treat Preferences as deprecated, and hope that this is finally decided. -if sys.platform == "darwin": - _LEGACY_CONFIG_DIR = CONFIG_DIR.parent.parent / "Preferences" / _APP_NAME - config_toml = _LEGACY_CONFIG_DIR / "config.toml" - auth_toml = _LEGACY_CONFIG_DIR / "auth.toml" - - if any(file.exists() for file in (auth_toml, config_toml)): - logger.warning( - "Configuration file exists at %s, reusing this" - " directory.\n\nConsider moving TOML configuration files to %s, as" - " support for the legacy directory will be removed in an upcoming" - " release.", - _LEGACY_CONFIG_DIR, - CONFIG_DIR, - ) - CONFIG_DIR = _LEGACY_CONFIG_DIR - def data_dir() -> Path: - poetry_home = os.getenv("POETRY_HOME") - if poetry_home: + if poetry_home := os.getenv("POETRY_HOME"): return Path(poetry_home).expanduser() return user_data_path(_APP_NAME, appauthor=False, roaming=True)