From af59de99cce04d7d8746bf5f4927adbe8281e5fc Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Mar 2022 11:47:30 -0400 Subject: [PATCH 1/6] Add PROGRAM* environment variables on windows to facilitate compiler discovery. Fixes #2382. --- src/tox/config/__init__.py | 5 +++++ tests/unit/config/test_config.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py index b155fd1cf..67a5fdeac 100644 --- a/src/tox/config/__init__.py +++ b/src/tox/config/__init__.py @@ -807,6 +807,11 @@ def passenv(testenv_config, value): passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine() passenv.add("USERPROFILE") # needed for `os.path.expanduser()` passenv.add("MSYSTEM") # fixes #429 + + # PROGRAM* required for compiler tool discovery #2382 + passenv.add("PROGRAMFILES") + passenv.add("PROGRAMFILES(X86)") + passenv.add("PROGRAMDATA") else: passenv.add("TMPDIR") diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index 6949bf938..3408de02a 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -1518,6 +1518,9 @@ def test_passenv_as_multiline_list(self, newconfig, monkeypatch, plat): assert "PROCESSOR_ARCHITECTURE" in envconfig.passenv assert "USERPROFILE" in envconfig.passenv assert "MSYSTEM" in envconfig.passenv + assert "PROGRAMFILES" in envconfig.passenv + assert "PROGRAMFILES(X86)" in envconfig.passenv + assert "PROGRAMDATA" in envconfig.passenv else: assert "TMPDIR" in envconfig.passenv if sys.platform != "win32": @@ -1562,6 +1565,9 @@ def test_passenv_as_space_separated_list(self, newconfig, monkeypatch, plat): assert "SYSTEMROOT" in envconfig.passenv assert "TEMP" in envconfig.passenv assert "TMP" in envconfig.passenv + assert "PROGRAMFILES" in envconfig.passenv + assert "PROGRAMFILES(X86)" in envconfig.passenv + assert "PROGRAMDATA" in envconfig.passenv else: assert "TMPDIR" in envconfig.passenv assert "PATH" in envconfig.passenv From 29c8dd4c65850836e2ee946ef5ccaf9385e6f533 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Mar 2022 11:52:55 -0400 Subject: [PATCH 2/6] Update docs and changelog. --- docs/changelog/2382.feature.rst | 1 + docs/config.rst | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/2382.feature.rst diff --git a/docs/changelog/2382.feature.rst b/docs/changelog/2382.feature.rst new file mode 100644 index 000000000..bce76904b --- /dev/null +++ b/docs/changelog/2382.feature.rst @@ -0,0 +1 @@ +On Windows, PROGRAMFILES, PROGRAMFILES(X86), and PROGRAMDATA environment variables are now passed through. diff --git a/docs/config.rst b/docs/config.rst index c579733eb..2ca82e3a8 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -469,7 +469,8 @@ Complete list of settings that you can put into ``testenv*`` sections: ``REQUESTS_CA_BUNDLE``, ``SSL_CERT_FILE``, ``HTTP_PROXY``, ``HTTPS_PROXY``, ``NO_PROXY`` * Windows: ``SYSTEMDRIVE``, ``SYSTEMROOT``, ``PATHEXT``, ``TEMP``, ``TMP`` - ``NUMBER_OF_PROCESSORS``, ``USERPROFILE``, ``MSYSTEM`` + ``NUMBER_OF_PROCESSORS``, ``USERPROFILE``, ``MSYSTEM``, + ``PROGRAMFILES``, ``PROGRAMFILES(X86)``, ``PROGRAMDATA`` * Others (e.g. UNIX, macOS): ``TMPDIR`` You can override these variables with the ``setenv`` option. From e444d47a7f2db9b4e2eab5a4dbaac298d5cb172a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Mar 2022 11:54:21 -0400 Subject: [PATCH 3/6] Add self to contributors. --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f3fc34074..15f585975 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -55,6 +55,7 @@ Isaac Pedisich Itxaka Serrano Jake Windle Jannis Leidel +Jason R. Coombs Jesse Schwartzentruber Joachim Brandon LeBlanc Johannes Christ From 3eff20c77e5ffc229b48c9b3677c6404636ac3f5 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Mar 2022 17:15:03 -0400 Subject: [PATCH 4/6] Extend the changelog to include 'why' with the 'what'. --- docs/changelog/2382.feature.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/2382.feature.rst b/docs/changelog/2382.feature.rst index bce76904b..4c79914bd 100644 --- a/docs/changelog/2382.feature.rst +++ b/docs/changelog/2382.feature.rst @@ -1 +1 @@ -On Windows, PROGRAMFILES, PROGRAMFILES(X86), and PROGRAMDATA environment variables are now passed through. +On Windows, PROGRAMFILES, PROGRAMFILES(X86), and PROGRAMDATA environment variables are now passed through, unmasking system values necessary to locate resources such as a C compiler. From aa94f9d9409d6babcdb881924b7d5857c1fdfb54 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Mar 2022 17:20:20 -0400 Subject: [PATCH 5/6] Remove extra newline. Let the reader figure it out. --- src/tox/config/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tox/config/__init__.py b/src/tox/config/__init__.py index 67a5fdeac..b49c06f6d 100644 --- a/src/tox/config/__init__.py +++ b/src/tox/config/__init__.py @@ -807,7 +807,6 @@ def passenv(testenv_config, value): passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine() passenv.add("USERPROFILE") # needed for `os.path.expanduser()` passenv.add("MSYSTEM") # fixes #429 - # PROGRAM* required for compiler tool discovery #2382 passenv.add("PROGRAMFILES") passenv.add("PROGRAMFILES(X86)") From 2518407575b0d71e68915ac60a467d2fc66ae93a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Mar 2022 19:01:42 -0400 Subject: [PATCH 6/6] Update changelog per direction --- docs/changelog/2382.feature.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog/2382.feature.rst b/docs/changelog/2382.feature.rst index 4c79914bd..59a758529 100644 --- a/docs/changelog/2382.feature.rst +++ b/docs/changelog/2382.feature.rst @@ -1 +1 @@ -On Windows, PROGRAMFILES, PROGRAMFILES(X86), and PROGRAMDATA environment variables are now passed through, unmasking system values necessary to locate resources such as a C compiler. +On Windows ``PROGRAMFILES``, ``PROGRAMFILES(X86)``, and ``PROGRAMDATA`` environment variables are now passed through, unmasking system values necessary to locate resources such as a C compiler.