tox-dev/pyproject-fmt

Deletes second platform dependency

Closed this issue · 1 comments

Given config like this, which is meant to install a dependency on macOS and Windows, but not Linux:

[project]
name = "testing"
classifiers = [
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.8",
  "Programming Language :: Python :: 3.9",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
]
dependencies = [
  'pyperclip; platform_system == "Darwin"',
  'pyperclip; platform_system == "Windows"',
]

pyproject-fmt 2.1.3 deletes the first dependency:

❯ pyproject-fmt pyproject.toml
--- pyproject.toml

+++ pyproject.toml

@@ -9,6 +9,5 @@

   "Programming Language :: Python :: 3.12",
 ]
 dependencies = [
-  'pyperclip; platform_system == "Darwin"',
-  'pyperclip; platform_system == "Windows"',
+  "pyperclip; platform_system=='Windows'",
 ]

If I switch them so Windows is first instead, it deletes the Windows one.

I guess it thinks they're duplicates, without considering the platform_system?

PR welcome 🤗