Archived
1
0
Fork 0

gnu: clang-python-bindings: Embed version string.

* gnu/packages/llvm.scm (clang-python-bindings)[arguments]: Embed the version
string in the generated setup.py.

Change-Id: If8764a483dd1a3786d4b3cab1f21846a18f3b07d
This commit is contained in:
Ricardo Wurmus 2023-10-24 10:43:15 +02:00
parent be223a9451
commit 7383d15641
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -3,7 +3,7 @@
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com> ;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com>
;;; Copyright © 2016, 2018, 2019, 2020, 2021 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2016, 2018, 2019, 2020, 2021, 2023 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017 Roel Janssen <roel@gnu.org> ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
;;; Copyright © 20182022 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 20182022 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
@ -1970,25 +1970,27 @@ requirements according to version 1.1 of the OpenCL specification.")
(build-system python-build-system) (build-system python-build-system)
(outputs '("out")) (outputs '("out"))
(arguments (arguments
'(#:phases (modify-phases %standard-phases (list
(add-before 'build 'change-directory #:phases #~(modify-phases %standard-phases
(lambda _ (add-before 'build 'change-directory
(chdir "bindings/python"))) (lambda _
(add-before 'build 'create-setup-py (chdir "bindings/python")))
(lambda _ (add-before 'build 'create-setup-py
;; Generate a basic "setup.py", enough so it can be (lambda _
;; built and installed. ;; Generate a basic "setup.py", enough so it can be
(with-output-to-file "setup.py" ;; built and installed.
(lambda () (with-output-to-file "setup.py"
(display "from setuptools import setup (lambda ()
setup(name=\"clang\", packages=[\"clang\"])\n"))))) (format #true "from setuptools import setup
(add-before 'build 'set-libclang-file-name setup(name=\"clang\", version=\"~a\", packages=[\"clang\"])\n"
(lambda* (#:key inputs #:allow-other-keys) #$(package-version this-package))))))
;; Record the absolute file name of libclang.so. (add-before 'build 'set-libclang-file-name
(let ((libclang (search-input-file inputs (lambda* (#:key inputs #:allow-other-keys)
"/lib/libclang.so"))) ;; Record the absolute file name of libclang.so.
(substitute* "clang/cindex.py" (let ((libclang (search-input-file inputs
(("libclang\\.so") libclang)))))))) "/lib/libclang.so")))
(substitute* "clang/cindex.py"
(("libclang\\.so") libclang))))))))
(inputs (list clang)) (inputs (list clang))
(synopsis "Python bindings to libclang"))) (synopsis "Python bindings to libclang")))