(use-modules ((guix licenses) #:select (bsd-3 gpl3+ psfl lgpl2.1+)) (guix packages) (guix download) (guix git-download) (guix gexp) (guix build-system cmake) (guix build-system trivial) (guix build-system python) (guix build-system gnu) (gnu packages python) (gnu packages xml) (gnu packages tls) (gnu packages emacs) (gnu packages package-management) (gnu packages zip) (gnu packages swig) (gnu packages compression) (gnu packages guile)) (define libsolv (package (name "libsolv") (version "0.6.22") (source (origin (method url-fetch) (uri (string-append "https://github.com/openSUSE/libsolv/archive/" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (modules '((guix build utils))) (sha256 (base32 "0zl7dlqmib05y5f2wkbz66n68bmqk2fxhvph1dfr071v7jnzc6gf")) (snippet '(substitute* '("bindings/python/CMakeLists.txt") (("EXECUTE_PROCESS.*") "") (("libsolv ") "libsolv python2.7 ") )))) (build-system cmake-build-system) (inputs `(("expat" ,expat) ("zlib" ,zlib) ("python" ,python-2.7) ("swig" ,swig))) (arguments '(#:configure-flags (list (string-append "-DPYTHON_INSTALL_DIR=" (assoc-ref %outputs "out") "/lib/python2.7/site-packages") "-DENABLE_PYTHON=1" (string-append ; uses lib64 by default "-DLIB=lib") (string-append "-DCMAKE_INSTALL_RPATH=" (assoc-ref %outputs "out") "/lib")))) ;(assoc-ref %outputs "out") "/lib:" ;(assoc-ref %outputs "out") "/lib64")))) (home-page "https://github.com/openSUSE/libsolv") (synopsis "libsolv") (description "") (license bsd-3))) (define pyguile (package (name "pyguile") (version "0.3.1") (source (origin (method git-fetch) (uri (git-reference (url "http://git.cbaines.net/pyguile") (commit "e37142e8aaa903920d4f13a5ef66a352618e65c6"))) (sha256 (base32 "037w1bf58yn4kfy5jydd1jzfi7dpg0m2w8p1sd2wnr6py03hybwq")))) ;(source (origin ; (method url-fetch) ; (uri (string-append "https://github.com/cbaines/pyguile/archive/v" ; version ".tar.gz")) ; (file-name (string-append name "-" version ".tar.gz")) ; (modules '((guix build utils))) ; (sha256 ; (base32 ; "0ds5pnm4dc0vyfa5wlyw9dvzl6dyiizh4q8s153byyn8jkiimb5c")))) (build-system cmake-build-system) (inputs `(("python" ,python-2.7) ("guile" ,guile-2.0))) (arguments '(;#:tests? #f ; no tests ;#:make-flags (list "CC=gcc" ; (string-append "PREFIX=" %output)) #:phases (modify-phases %standard-phases (delete 'configure) (delete 'check) (replace 'build (lambda* (#:key outputs #:allow-other-keys) ;(chdir "..") (display "CWD ")(display (getcwd))(display "\n") (let ((out (assoc-ref outputs "out"))) (zero? (system* "make" "CC=gcc"))))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (guild (string-append (assoc-ref %build-inputs "guile") "/bin/guild")) (scm-dir (string-append out "/share/guile/site/2.0/")) (scm-path (string-append scm-dir "pyguile.scm")) (lib-dir (string-append out "/lib/")) (lib-path (string-append lib-dir "libpyguile.so"))) (mkdir-p scm-dir) (mkdir-p lib-dir) (copy-file "pyguile.scm" scm-path) (copy-file "libpyguile.so" lib-path) (substitute* scm-path (("libpyguile") (string-append lib-dir "libpyguile"))) (setenv "GUILE_AUTO_COMPILE" "0") (unless (zero? (system* guild "compile" scm-path "-o" (string-append scm-dir "pyguile.go"))) (error "failed to compile")) #t)))))) (home-page "https://github.com/tddpirate/pyguile") (synopsis "pyguile") (description "") (license lgpl2.1+))) (define python-packaging (package (name "python-packaging") (version "16.7") (source (origin (method url-fetch) (uri (string-append "https://pypi.python.org/packages/28/ad/4e6601d14b11bb300719a8bb6247f6ef5861467a692523c978a4e9e3981a/packaging-" version ".tar.gz")) (sha256 (base32 "07h18mrpqs0lv2x4fl43pqi0xj6hdrmrnm6v9q634yliagg6q91f")))) (build-system python-build-system) (inputs `(("python-setuptools" ,python-setuptools))) (propagated-inputs `(("python-pyparsing" ,python-pyparsing) ("python-six" ,python-six))) (home-page "https://github.com/pypa/packaging") (synopsis "Core utilities for Python packages") (description "Core utilities for Python packages") (license #f))) (define python2-packaging (package-with-python2 python-packaging)) (define python-setuptools (package (name "python-setuptools") (version "20.10.1") (source (origin (method url-fetch) (uri "https://pypi.python.org/packages/d3/16/21cf5dc6974280197e42d57bf7d372380562ec69aef9bb796b5e2dbbed6e/setuptools-20.10.1.tar.gz") (sha256 (base32 "1pdm34rjixkdyp5j2yp774ri1da7ncqy8s34h4qxdl4yy22whn9y")))) (build-system python-build-system) ;; FIXME: Tests require pytest, which itself relies on setuptools. ;; One could bootstrap with an internal untested setuptools. (arguments `(#:tests? #f)) (home-page "https://pypi.python.org/pypi/setuptools") (synopsis "Library designed to facilitate packaging Python projects") (description "Setuptools is a fully-featured, stable library designed to facilitate packaging Python projects, where packaging includes: Python package and module definitions, distribution package metadata, test hooks, project installation, platform-specific details, Python 3 support.") (license psfl))) (define python2-setuptools (package-with-python2 python-setuptools)) (define guix-pypi-utils (package (name "guix-pypi-utils") (version "0.1") ;(source (local-file "../guix-pypi-utils" #:recursive? #t)) (source (origin (method git-fetch) (uri (git-reference (url "http://git.cbaines.net/guix-pypi-utils") (commit "86de22b526313a68e5c8bb8a361d5904c30d8b51"))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "1n0f3cgxinxgfsf48vgvj6ggn5m8is7hrinx8bzmxiy4rlzaq5db")))) (build-system trivial-build-system) (arguments `(#:modules ((guix build utils) (ice-9 match)) #:builder (begin (use-modules (guix build utils) (ice-9 match)) (let* ((out (assoc-ref %outputs "out")) (module-dir (string-append out "/share/guile/site/2.0")) (source (assoc-ref %build-inputs "source")) (guild (string-append (assoc-ref %build-inputs "guile") "/bin/guild"))) (mkdir-p (string-append module-dir "/pypi")) (copy-recursively (string-append source "/pypi") (string-append module-dir "/pypi")) (mkdir-p (string-append module-dir "/solver")) (install-file (string-append source "/solver/__init__.py") (string-append module-dir "/solver")) (display "pythonpath\n") (display (getenv "PYTHONPATH")) (substitute* (string-append module-dir "/pypi/dependency-solver.scm") (("\\(define %solver-location \"\"\\)") (string-append "(define %solver-location \"" module-dir "\")"))) (setenv "GUILE_AUTO_COMPILE" "0") ;(for-each (lambda (file) ; (let ((scm-file ; (string-append module-dir file)) ; (go-file (match (string-split file #\.) ; ((base _) ; (string-append module-dir "/" ; base ".go"))))) ; ;; Install compiled module. ; (unless (zero? (system* guild "compile" ; "-L" source ; "-o" go-file ; scm-file)) ; (error (format #f "Failed to compile ~s to ~s!" ; scm-file go-file))))) ; (map ; (lambda (file) ; (substring ; file ; (string-length module-dir))) ; (find-files (string-append ; module-dir ; "/pypi") ; ".*\\.scm$"))) #t)))) (inputs `(("unzip" ,unzip) ("guile" ,guile-2.0))) (propagated-inputs `(("guix" ,guix-0.11.0) ("guile-lib" ,guile-lib) ("guile-json" ,guile-json) ("pyguile" ,pyguile) ("libsolv" ,libsolv) ("python" ,python-2.7) ("python2-setuptools" ,python2-setuptools) ("python2-packaging" ,python2-packaging))) (home-page "https://example.com") (synopsis "guix-pypi-utils") (description "") (license gpl3+))) (define guix-python-integration-project (package (name "guix-python-integration-project") (version "0.1") (source (local-file "." #:recursive? #t)) (build-system trivial-build-system) (arguments `(#:modules ((guix build utils) (ice-9 match)) #:builder (begin (use-modules (guix build utils) (ice-9 match)) (let* ((out (assoc-ref %outputs "out")) (module-dir (string-append out "/share/guile/site/2.0")) (source (assoc-ref %build-inputs "source")) (scm-files (find-files "." ".*\\.scm$")) (guild (string-append (assoc-ref %build-inputs "guile") "/bin/guild"))) ;; Make installation directories. (mkdir-p (string-append module-dir "/guix-python-integration-project")) (setenv "GUILE_AUTO_COMPILE" "0") (for-each (lambda (file) (let* ((dest-file (string-append module-dir "/" file)) (go-file (match (string-split file #\.) ((base _) (string-append module-dir "/" base ".go"))))) ;; Install source module. (copy-file file dest-file) ;; Install compiled module. (unless (zero? (system* guild "compile" "-L" source "-o" go-file file)) (error (format #f "Failed to compile ~s to ~s!" file go-file))))) (map (lambda (file) (display file)(display "\n") (display (substring file (string-length module-dir))) (display "\n") (substring file (string-length module-dir))) scm-files)) #t)))) (propagated-inputs `(("guix" ,guix-0.11.0) ("guile" ,guile-2.0) ("guix-pypi-utils" ,guix-pypi-utils))) (home-page "https://example.com") (synopsis "guix-pypi-utils") (description "") (license gpl3+))) guix-python-integration-project