From 6656a7896c3e3c8ed954cffda7aca10f00080e53 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Sun, 30 Nov 2025 16:32:54 +0100 Subject: [PATCH] gnu: python-msal: Update to 1.34.0. * gnu/packages/python-web.scm (python-msal): Update to 1.34.0. [build-system]: Switch to pyproject-build-system. [arguments]<#:tests?>: Run them. <#:test-flags>: Ignoring failing tests. <#:phases>: Add phases 'set-cryptography-version and 'configure-tests. [native-inputs]: Add nss-certs-for-test, python-pytest, python-setuptools. Change-Id: I73e6ea369df191bdd0a0df670867acd527382319 Signed-off-by: Sharlatan Hellseher --- gnu/local.mk | 1 + .../patches/python-msal-requests.patch | 36 +++++++++++++ gnu/packages/python-web.scm | 53 ++++++++++++++----- 3 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 gnu/packages/patches/python-msal-requests.patch diff --git a/gnu/local.mk b/gnu/local.mk index afc9b1fa1de59cb574b04c7f523ab2f769260d2c..7ee7a4635eb8bed49ac0964a26e75388db4afd0e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2049,6 +2049,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-louvain-fix-test.patch \ %D%/packages/patches/python-matplotlib-fix-legend-loc-best-test.patch \ %D%/packages/patches/python-mohawk-pytest.patch \ + %D%/packages/patches/python-msal-requests.patch \ %D%/packages/patches/python-norns-nose.patch \ %D%/packages/patches/python-numpy-gcc-14.patch \ %D%/packages/patches/python-random2-getrandbits-test.patch \ diff --git a/gnu/packages/patches/python-msal-requests.patch b/gnu/packages/patches/python-msal-requests.patch new file mode 100644 index 0000000000000000000000000000000000000000..cc12984c775a3620420216f01a18ff9fd81ca909 --- /dev/null +++ b/gnu/packages/patches/python-msal-requests.patch @@ -0,0 +1,36 @@ +From 74cda7c7ce34b34b1a378b5e3be02f44bbea09d6 Mon Sep 17 00:00:00 2001 +Message-ID: <74cda7c7ce34b34b1a378b5e3be02f44bbea09d6.1764515163.git.ngraves@ngraves.fr> +From: Nicolas Graves +Date: Sun, 30 Nov 2025 16:05:39 +0100 +Subject: [PATCH] Replace requests.get by a placeholder + +--- + tests/test_cryptography.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/tests/test_cryptography.py b/tests/test_cryptography.py +index b119e59..8948ab0 100644 +--- a/tests/test_cryptography.py ++++ b/tests/test_cryptography.py +@@ -3,7 +3,6 @@ import os + import re + from unittest import TestCase + import warnings +-import xml.etree.ElementTree as ET + + import requests + +@@ -11,9 +10,7 @@ from msal.application import ( + _str2bytes, _load_private_key_from_pem_str, _parse_pfx) + + +-latest_cryptography_version = ET.fromstring( +- requests.get("https://pypi.org/rss/project/cryptography/releases.xml").text +- ).findall("./channel/item/title")[0].text ++latest_cryptography_version = @version@ + + + def get_current_ceiling(): +-- +2.51.2 + diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm index bae930d11247ec45bbddac026c2b684321eb6f0e..7e8ee741e3bf98dcfaa5af9ffab2f92d9af49c61 100644 --- a/gnu/packages/python-web.scm +++ b/gnu/packages/python-web.scm @@ -6761,23 +6761,48 @@ authorization scheme.") (define-public python-msal (package (name "python-msal") - (version "1.31.1") + (version "1.34.0") (home-page "https://github.com/AzureAD/microsoft-authentication-library-for-python") - (source (origin - (method git-fetch) - ;; Pypi does not have tests. - (uri (git-reference (url home-page) (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "18dg1j2az5ywk6klfd3kp36fxa4cmmf9yvma4li0a2nz2jgc1gdd")))) - (build-system python-build-system) + (source + (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1xcyiv742ihnzypjw7syamnhqffdy6wsvvv0f5jcl3pap0apbk0z")) + (patches (search-patches "python-msal-requests.patch")))) + (build-system pyproject-build-system) (arguments - ;; Tests (all?) rely on network access and only some can be disabled by - ;; setting the environment variable TRAVIS_TAG. - (list #:tests? #f)) - (native-inputs (list python-mock)) + (list + #:test-flags + #~(list + "--ignore=tests/test_benchmark.py" + ;; XXX: Ignoring cryptography version scheme tests. + "-k" + "not test_ceiling_should_be_latest_cryptography_version_plus_three" + ;; XXX: These tests try to access the network. + "--ignore=tests/test_application.py" + "--ignore=tests/test_ccs.py" + ;; XXX: These tests assume they are run on Windows. + "--ignore=tests/test_mi.py") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'set-cryptography-version + (lambda _ + (substitute* "tests/test_cryptography.py" + (("^latest_cryptography_version = @version@") + (format #f "latest_cryptography_version = ~s" + #$(package-version + (this-package-input "python-cryptography"))))))) + (add-before 'check 'configure-tests + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (setenv "TRAVIS_TAG" "1"))))))) + (native-inputs + (list nss-certs-for-test python-mock python-pytest python-setuptools)) (propagated-inputs (list python-cryptography python-pyjwt python-requests)) (synopsis "Microsoft Authentication Library (MSAL) for Python") (description