diff options
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/patches/python-execnet-read-only-fix.patch | 77 | ||||
-rw-r--r-- | gnu/packages/python-xyz.scm | 85 |
3 files changed, 55 insertions, 108 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index dd4b0e890e..419a699308 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1753,7 +1753,6 @@ dist_patch_DATA = \ %D%/packages/patches/python-dateutil-pytest-compat.patch \ %D%/packages/patches/python-debugpy-unbundle-pydevd.patch \ %D%/packages/patches/python-docopt-pytest6-compat.patch \ - %D%/packages/patches/python-execnet-read-only-fix.patch \ %D%/packages/patches/python-fixtures-remove-monkeypatch-test.patch \ %D%/packages/patches/python-hiredis-fix-header.patch \ %D%/packages/patches/python-hiredis-use-system-hiredis.patch \ diff --git a/gnu/packages/patches/python-execnet-read-only-fix.patch b/gnu/packages/patches/python-execnet-read-only-fix.patch deleted file mode 100644 index 58a4b129a7..0000000000 --- a/gnu/packages/patches/python-execnet-read-only-fix.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0d6562a20b0610c5a83d1c66ac879223b84a2746 Mon Sep 17 00:00:00 2001 -From: Maxim Cournoyer <maxim.cournoyer@gmail.com> -Date: Thu, 26 Aug 2021 00:43:26 -0400 -Subject: [PATCH] rsync_remote: Fix a problem when receiving read-only - directories. - -Before this change, when the source directories hierarchy was -read-only, the read-only mode would be preserved at the destination, -preventing child directories to be recreated by a normal user (a -permission denied error, EACCES would be raised). - -* execnet/rsync_remote.py (serve_rsync.receive_directory_structure): -Bitwise OR to ensure the write bit is set on received directories. -* testing/test_rsync.py (TestRSync) -<test_read_only_directories>: New test. ---- - execnet/rsync_remote.py | 8 ++++++-- - testing/test_rsync.py | 17 +++++++++++++++++ - 2 files changed, 23 insertions(+), 2 deletions(-) - -diff --git a/execnet/rsync_remote.py b/execnet/rsync_remote.py -index cd5e765..55d154c 100644 ---- a/execnet/rsync_remote.py -+++ b/execnet/rsync_remote.py -@@ -35,7 +35,11 @@ def serve_rsync(channel): - os.makedirs(path) - mode = msg.pop(0) - if mode: -- os.chmod(path, mode) -+ # Ensure directories are writable, otherwise a -+ # permission denied error (EACCES) would be raised -+ # when attempting to receive read-only directory -+ # structures. -+ os.chmod(path, mode | 0o700) - entrynames = {} - for entryname in msg: - destpath = os.path.join(path, entryname) -@@ -59,7 +63,7 @@ def serve_rsync(channel): - checksum = md5(f.read()).digest() - f.close() - elif msg_mode and msg_mode != st.st_mode: -- os.chmod(path, msg_mode) -+ os.chmod(path, msg_mode | 0o700) - return - else: - return # already fine -diff --git a/testing/test_rsync.py b/testing/test_rsync.py -index 995f229..1d6c30c 100644 ---- a/testing/test_rsync.py -+++ b/testing/test_rsync.py -@@ -157,6 +157,23 @@ class TestRSync: - mode = destdir.stat().mode - assert mode & 511 == 504 - -+ @py.test.mark.skipif("sys.platform == 'win32' or getattr(os, '_name', '') == 'nt'") -+ def test_read_only_directories(self, dirs, gw1): -+ source = dirs.source -+ dest = dirs.dest1 -+ source.ensure("sub", "subsub", dir=True) -+ source.join("sub").chmod(0o500) -+ source.join("sub", "subsub").chmod(0o500) -+ -+ # The destination directories should be created with the write -+ # permission forced, to avoid raising an EACCES error. -+ rsync = RSync(source) -+ rsync.add_target(gw1, dest) -+ rsync.send() -+ -+ assert dest.join("sub").stat().mode & 0o700 -+ assert dest.join("sub").join("subsub").stat().mode & 0o700 -+ - @needssymlink - def test_symlink_rsync(self, dirs, gw1): - source = dirs.source --- -2.32.0 - diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 7a1edd82fd..923c3c859b 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -15082,34 +15082,59 @@ pure Python module that works on virtually all Python versions.") (license license:expat))) (define-public python-execnet - (package - (name "python-execnet") - (version "1.9.0") - (source (origin - (method url-fetch) - (uri (pypi-uri "execnet" version)) - (sha256 - (base32 - "1ia7dvrh0gvzzpi758mx55f9flr16bzdqlmi12swm4ncm4xlyscg")) - (patches (search-patches "python-execnet-read-only-fix.patch")))) - (build-system python-build-system) - (arguments - `(#:phases - (modify-phases %standard-phases - (replace 'check - (lambda* (#:key inputs outputs tests? #:allow-other-keys) - (when tests? - ;; Unset PYTHONDONTWRITEBYTECODE to match the - ;; expectations of a test in - ;; 'testing/test_gateway.py'. - (unsetenv "PYTHONDONTWRITEBYTECODE") - - (add-installed-pythonpath inputs outputs) - (invoke "pytest" "-vv"))))))) - (native-inputs - (list python-pytest python-setuptools-scm)) - (synopsis "Rapid multi-Python deployment") - (description "Execnet provides a share-nothing model with + ;; The latest release (1.9.0) is old and lacks support for Pytest 7.2. + (let ((commit "d6aa1a56773c2e887515d63e50b1d08338cb78a7") + (revision "1")) + (package + (name "python-execnet") + (version (git-version "1.9.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pytest-dev/execnet") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0s60jggcjiw38b7xsh1q2lnnr4c4kaki7c5zsv7xyj7df8ngbbsm")))) + (build-system pyproject-build-system) + (arguments + (list + ;; ;; This test hasn't been updated for the latest Pytest yet: + ;; #:test-flags #~(list "--ignore" "testing/test_rsync.py") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'adjust-for-pytest-7.2+ + (lambda _ + ;; This test fails with an error because @py.test has been + ;; deprecated for @pytest in recent Pytest. + (substitute* "testing/test_rsync.py" + (("@py.test") + "@pytest")))) + (add-before 'build 'pretend-version + ;; The version string is usually derived via setuptools-scm, but + ;; without the git metadata available this fails. + (lambda _ + ;; hatch-vcs uses setuptools under the hood. + (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" + ;; Massage the version string to a PEP-0440 compatible + ;; one. + #$(car (string-split version #\-))))) + (add-before 'check 'prepare-for-tests + (lambda _ + ;; Unset PYTHONDONTWRITEBYTECODE to match the + ;; expectations of a test in + ;; 'testing/test_gateway.py'. + (unsetenv "PYTHONDONTWRITEBYTECODE")))))) + (native-inputs + (list python-hatchling + python-hatch-vcs + python-py + python-pytest + python-pytest-timeout + python-setuptools-scm)) + (synopsis "Rapid multi-Python deployment") + (description "Execnet provides a share-nothing model with channel-send/receive communication for distributing execution across many Python interpreters across version, platform and network barriers. It has a minimal and fast API targeting the following uses: @@ -15118,8 +15143,8 @@ minimal and fast API targeting the following uses: @item write and deploy hybrid multi-process applications @item write scripts to administer multiple environments @end enumerate") - (home-page "https://codespeak.net/execnet/") - (license license:expat))) + (home-page "https://codespeak.net/execnet/") + (license license:expat)))) (define-public python-icalendar (package |