gnu: python-pydevd: Improve package style.

* gnu/packages/python-xyz.scm (python-pydevd): Indent properly.

Change-Id: Ieb031894f4f3494bf3dacd2086adde44507a27e1
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Nicolas Graves 2024-11-28 22:13:02 +00:00 committed by Sharlatan Hellseher
parent efa604c171
commit 6d3f2b8e08
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -17614,114 +17614,114 @@ developed separately, both serve the same purpose: provide Python bindings for
libmagic."))) libmagic.")))
(define-public python-pydevd (define-public python-pydevd
(package (package
(name "python-pydevd") (name "python-pydevd")
(version "3.2.3") (version "3.2.3")
(source (source
(origin (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/fabioz/PyDev.Debugger") (url "https://github.com/fabioz/PyDev.Debugger")
(commit (string-append (commit (string-append
"pydev_debugger_" "pydev_debugger_"
(string-join (string-split version #\.) "_"))))) (string-join (string-split version #\.) "_")))))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet '(begin (snippet '(begin
;; Delete pre-built binaries. ;; Delete pre-built binaries.
(for-each delete-file (find-files "." "\\.(so|dylib|dll)")) (for-each delete-file (find-files "." "\\.(so|dylib|dll)"))
;; This source is generated via Cython. ;; This source is generated via Cython.
(delete-file "_pydevd_bundle/pydevd_cython.c"))) (delete-file "_pydevd_bundle/pydevd_cython.c")))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"0a40574f0rx23gissxmrpjq9cimhjxqsq9wbv5l7620h3blb5510")))) "0a40574f0rx23gissxmrpjq9cimhjxqsq9wbv5l7620h3blb5510"))))
(build-system pyproject-build-system) (build-system pyproject-build-system)
(arguments (arguments
(list (list
#:test-flags #:test-flags
#~(list "-n" "0" ; fails: (number->string (parallel-job-count)) #~(list "-n" "0" ; fails: (number->string (parallel-job-count))
"-k" "-k"
(string-append (string-append
;; The two "break_01" tests have been failing on ;; The two "break_01" tests have been failing on
;; Python 3.10: ;; Python 3.10:
;; <https://github.com/fabioz/PyDev.Debugger/issues/222>. ;; <https://github.com/fabioz/PyDev.Debugger/issues/222>.
"not test_set_pydevd_break_01 " "not test_set_pydevd_break_01 "
;; the GUI event loop requires an X server. ;; the GUI event loop requires an X server.
"and not test_gui_event_loop_custom " "and not test_gui_event_loop_custom "
;; This test validates that 'pydevd' is not in the ;; This test validates that 'pydevd' is not in the
;; exception message, but it is due to being part ;; exception message, but it is due to being part
;; of the build file name present in the message. ;; of the build file name present in the message.
"and not test_evaluate_exception_trace " "and not test_evaluate_exception_trace "
;; This test fail with TimeoutError, no message on stderr. ;; This test fail with TimeoutError, no message on stderr.
"and not test_soft_terminate ")) "and not test_soft_terminate "))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'fix-tests (add-after 'unpack 'fix-tests
(lambda _ (lambda _
(substitute* "tests_python/test_convert_utilities.py" (substitute* "tests_python/test_convert_utilities.py"
;; Add missing trailing '/'. ;; Add missing trailing '/'.
(("\"\\\\\\\\usr\\\\\\\\bin\\\\\\\\\") == \"/usr/bin" all) (("\"\\\\\\\\usr\\\\\\\\bin\\\\\\\\\") == \"/usr/bin" all)
(string-append all "/"))) (string-append all "/")))
;; pytest-xdist's parallel tests would fail that test. ;; pytest-xdist's parallel tests would fail that test.
;; So we disabled parallel tests. ;; So we disabled parallel tests.
;(delete-file "tests_python/test_utilities.py") ; test_is_main_thread ;(delete-file "tests_python/test_utilities.py") ; test_is_main_thread
;; TODO: fix. ;; TODO: fix.
(delete-file "tests_python/test_debugger_json.py"))) ; test_soft_terminate timeout (delete-file "tests_python/test_debugger_json.py"))) ; test_soft_terminate timeout
(add-after 'unpack 'patch-command-paths (add-after 'unpack 'patch-command-paths
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(substitute* "_pydevd_bundle/pydevd_api.py" (substitute* "_pydevd_bundle/pydevd_api.py"
(("'kill'") (("'kill'")
(format #f "~s" (search-input-file inputs "bin/kill"))) (format #f "~s" (search-input-file inputs "bin/kill")))
(("'pgrep'") (("'pgrep'")
(format #f "~s" (search-input-file inputs "bin/pgrep")))))) (format #f "~s" (search-input-file inputs "bin/pgrep"))))))
(add-after 'unpack 'generate-sources (add-after 'unpack 'generate-sources
(lambda _ (lambda _
(setenv "PYTHONPATH" (getcwd)) (setenv "PYTHONPATH" (getcwd))
(invoke "python" "build_tools/build.py"))) (invoke "python" "build_tools/build.py")))
(add-after 'unpack 'adjust-attach-binary-name (add-after 'unpack 'adjust-attach-binary-name
(lambda _ (lambda _
(substitute* (substitute*
'("pydevd_tracing.py" '("pydevd_tracing.py"
"pydevd_attach_to_process/add_code_to_python_process.py") "pydevd_attach_to_process/add_code_to_python_process.py")
(("def get_(target|python_helper_lib)_filename.*" all) (("def get_(target|python_helper_lib)_filename.*" all)
(format #f "~a return ~s~%" all (format #f "~a return ~s~%" all
(string-append #$output "/lib/attach.so")))))) (string-append #$output "/lib/attach.so"))))))
(add-after 'unpack 'patch-gdb (add-after 'unpack 'patch-gdb
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(substitute* (substitute*
"pydevd_attach_to_process/add_code_to_python_process.py" "pydevd_attach_to_process/add_code_to_python_process.py"
(("'gdb',") (("'gdb',")
(format #f "~s," (search-input-file inputs "bin/gdb")))))) (format #f "~s," (search-input-file inputs "bin/gdb"))))))
(add-after 'build 'build-attach-linux-binary (add-after 'build 'build-attach-linux-binary
(lambda _ (lambda _
(invoke #+(cxx-for-target) "-shared" "-o" "attach.so" (invoke #+(cxx-for-target) "-shared" "-o" "attach.so"
"-fPIC" "-nostartfiles" "-fPIC" "-nostartfiles"
"pydevd_attach_to_process/linux_and_mac/attach.cpp"))) "pydevd_attach_to_process/linux_and_mac/attach.cpp")))
(add-before 'check 'pre-check (add-before 'check 'pre-check
(lambda* (#:key tests? #:allow-other-keys) (lambda* (#:key tests? #:allow-other-keys)
(when tests? (when tests?
(setenv "PYDEVD_USE_CYTHON" "YES")))) (setenv "PYDEVD_USE_CYTHON" "YES"))))
(add-after 'install 'install-attach-binary (add-after 'install 'install-attach-binary
(lambda _ (lambda _
(install-file "attach.so" (install-file "attach.so"
(string-append #$output "/lib")))) (string-append #$output "/lib"))))
;; Some modules aren't designed to be loadable by themselves, such ;; Some modules aren't designed to be loadable by themselves, such
;; as 'pydev_app_engine_debug_startup' and fail. ;; as 'pydev_app_engine_debug_startup' and fail.
(delete 'sanity-check)))) (delete 'sanity-check))))
(native-inputs (native-inputs
(list python-cython (list python-cython
python-numpy python-numpy
python-psutil python-psutil
python-pytest python-pytest
python-pytest-xdist python-pytest-xdist
python-trio python-trio
python-untangle)) python-untangle))
(inputs (list coreutils gdb/pinned procps)) (inputs (list coreutils gdb/pinned procps))
(home-page "https://github.com/fabioz/PyDev.Debugger/") (home-page "https://github.com/fabioz/PyDev.Debugger/")
(synopsis "Python debugger") (synopsis "Python debugger")
(description "PyDev.Debugger is a capable Python debugger used in PyDev (description "PyDev.Debugger is a capable Python debugger used in PyDev
and other @acronym{IDEs, Integrated Development Environments}.") and other @acronym{IDEs, Integrated Development Environments}.")
(license license:epl1.0))) (license license:epl1.0)))
(define-public python-debugpy (define-public python-debugpy
(package (package