From 398759fae8ccf4354e751cc3405e0a486bf39439 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 26 Jul 2020 15:21:30 +0300 Subject: A running genenetwork --- gn/packages/genenetwork.scm | 9 ++++--- gn/packages/python24.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++ gn/packages/web.scm | 13 +++++----- gn/services/genenetwork.scm | 35 +++++++++++++++++---------- 4 files changed, 92 insertions(+), 24 deletions(-) diff --git a/gn/packages/genenetwork.scm b/gn/packages/genenetwork.scm index 214f040..36975bd 100644 --- a/gn/packages/genenetwork.scm +++ b/gn/packages/genenetwork.scm @@ -694,10 +694,9 @@ written in C") (base32 "1s735dj8kf98gf5w58p10zzyc5766gn27j4j5yh07ksadg7h1kdi")))) (build-system gnu-build-system) - (propagated-inputs + (native-inputs `(("ghostscript" ,ghostscript) ("graphviz" ,graphviz-2.26) - ("httpd" ,httpd22-mod-python-24) ("python24" ,python-2.4) ("python-piddle" ,python24-piddle) ("wget" ,wget))) @@ -708,8 +707,9 @@ written in C") (delete 'configure) (delete 'build) (add-after 'patch-generated-file-shebangs 'patch-more-files - (lambda* (#:key inputs #:allow-other-keys) - (let ((piddle (assoc-ref inputs "python-piddle"))) + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((piddle (assoc-ref inputs "python-piddle")) + (out (assoc-ref outputs "out"))) (substitute* "web/webqtl/networkGraph/networkGraphUtils.py" (("/usr/local/bin/neato") (which "neato")) (("/usr/local/bin/circo") (which "circo")) @@ -730,6 +730,7 @@ written in C") (("/usr/bin/python") (which "python")) (("/usr/bin/env python") (which "python"))) (substitute* "web/webqtl/base/webqtlConfigLocal.py" + (("/gnshare/gn") out) (("PythonPath.*") (string-append "PythonPath = '" (which "python") "'\n")) (("PIDDLE_FONT_PATH.*/lib") diff --git a/gn/packages/python24.scm b/gn/packages/python24.scm index bae5304..916c33c 100644 --- a/gn/packages/python24.scm +++ b/gn/packages/python24.scm @@ -3,10 +3,12 @@ #:use-module (guix utils) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix build-system python) #:use-module (gn packages python) #:use-module (past packages python) #:use-module (gnu packages compression) + #:use-module (gnu packages databases) #:use-module (gnu packages maths) #:use-module (gnu packages python-xyz) #:use-module (srfi srfi-1)) @@ -435,3 +437,60 @@ clusters (computers connected via network).") (synopsis "") (description "") (license license:bsd-3))) + +(define-public python24-mysqlclient + (package + (name "python24-mysqlclient") + (version "1.2.5") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/PyMySQL/mysqlclient-python") + (commit "MySQLdb-1.2.5"))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "193h09afkmz9nw2jlwfdikx1xj9sybswd2705k8jy48h1ks6fnbj")))) + (build-system python-build-system) + (arguments + `(#:python ,python-2.4 + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'dont-create-release-file + (lambda _ + (substitute* "setup_common.py" + (("MySQLdb/release.py") + (string-append (getcwd) "/release.py"))) + #t)) + (add-before 'check 'pre-check + (lambda _ + (call-with-output-file "/tmp/my.cnf" + (lambda (p) + (format p + "[mysqld]~@ + datadir=/tmp~@ + socket=/tmp/mysql.sock~%"))) + (system* "mysqld" "--defaults-file=/tmp/my.cnf" "--bootstrap") + ;(invoke "mysql" "-S" "/tmp/mysql.sock" + ; "-e" "'create database mysqldb_test charset utf8;'") + #t))) + #:tests? #f)) ; TODO: Run the test suite + (native-inputs + `(("mariadb" ,mariadb "dev") + ("mariadb:bin" ,mariadb) + ("python-nose" ,python24-nose) + ("python-setuptools" ,python24-setuptools))) + (inputs + `(("zlib" ,zlib))) + (home-page "http://mysql-python.sourceforge.net/") + (synopsis "Python interface to MySQL") + (description "MySQLdb is an interface to the popular MySQL database server +for Python. The design goals are: +@itemize +@item with Python database API version 2.0 +@item Thread-safety +@item Thread-friendliness (threads will not block each other) +@item Compatibility with MySQL-3.23 and later +@end itemize") + (license license:gpl2+))) diff --git a/gn/packages/web.scm b/gn/packages/web.scm index a6ce42f..a9ec973 100644 --- a/gn/packages/web.scm +++ b/gn/packages/web.scm @@ -370,10 +370,6 @@ connections and other data between hits and access to Apache internals.") (lambda _ ;; Make sure we're in the correct folder (chdir "../mod_python-3.3.1") - ;; We can't import cPickle because we don't wrap with Python. - (substitute* (find-files "." "\\.py$") - (("import cPickle") - "try:\n import cPickle\nexcept:\n import pickle as cPickle")) #t)) (add-after 'change-directory 'bootstrap-mod-python (lambda* (#:key inputs #:allow-other-keys) @@ -383,12 +379,15 @@ connections and other data between hits and access to Apache internals.") (tcl-version ,(version-major+minor (package-version tcl)))) (substitute* "configure.in" (("PY_LIBS=.*") - (string-append "PY_LIBS=-L" python "/lib/python" py-version "\n")) - (("PY_LDFLAGS=.*") - (string-append "PY_LDFLAGS=\"-lpython" py-version + (string-append "PY_LIBS=\"" python + "/lib/libpython" py-version ".so " + " -lpthread -ldl -lutil -lm" ; LIB[SMC] + " -lpython" py-version " -lreadline -lssl -lcrypto" " -ltk" tcl-version " -ltcl" tcl-version " -lgdbm -ltirpc -lnsl -lz\"\n")) + (("PY_LDFLAGS=.*") + (string-append "PY_LDFLAGS=\"-Wl,-rpath=" python "/lib -Wl,-rpath=" python "/lib/python" py-version "/lib-dynload\"\n")) (("PY_INCLUDES=.*") (string-append "PY_INCLUDES=-I" python "/include/python" py-version "\n"))) (invoke "autoreconf" "-vfi")))) diff --git a/gn/services/genenetwork.scm b/gn/services/genenetwork.scm index bf09270..8f5bfc4 100644 --- a/gn/services/genenetwork.scm +++ b/gn/services/genenetwork.scm @@ -9,12 +9,6 @@ (use-service-modules web) (use-package-modules python) -(define %python-path - "/lib/python2.4/site-packages") - -(define %mod-python-path - (file-append httpd22-mod-python-24 %python-path)) - (define %default-httpd22-modules (map (match-lambda ((name file) @@ -85,7 +79,10 @@ python24-qtlreaper python24-htmlgen-GN1 python24-json-GN1 + python24-mysqlclient ; MySQLdb + python24-numarray python24-piddle + python24-pp-GN1 python24-pyx-GN1 python24-pyxlwriter python24-svg-GN1 @@ -97,13 +94,13 @@ (config (httpd-config-file (server-name "www.genenetwork.org") - ;; Defaults to httpd, largely irrelevant. + ;; Defaults to httpd, should be same as 'package' above. (server-root httpd22-mod-python-24) (user "nobody") (group "root") + ;; Only while debugging (pid-file "/tmp/httpd-genenetwork1") (error-log "/tmp/httpd-genenetwork1-error-log") - (document-root (file-append genenetwork1 "/web")) (listen '("8042")) (modules (cons* (httpd-module @@ -111,20 +108,32 @@ (file "modules/mod_python.so")) %default-httpd22-modules)) (extra-config (list "\ -TypesConfig etc/httpd/mime.types +TypesConfig " httpd22-mod-python-24 "/etc/httpd/mime.types DefaultType application/octet-stream -#DocumentRoot MUST NOT be in the PythonPath -PythonPath \"['/run/current-system/profile/lib/python2.4', '" httpd22-mod-python-24 "/lib/python2.4/site-packages']\" +# DocumentRoot MUST NOT be in the PythonPath. Because genenetwork1 must be in PythonPath we leave the document-root keyword above unset. +PythonPath \"['/run/current-system/profile/lib/python2.4', '/run/current-system/profile/lib/python2.4/site-packages', '" httpd22-mod-python-24 "/lib/python2.4/site-packages', '" genenetwork1 "/web/webqtl']\" +# same as 'listen' above +NameVirtualHost *:8042 + + DocumentRoot "genenetwork1 "/web + + PythonOption session FileSession + #what is the difference between these two? #AddHandler mod_python .py SetHandler python-program + #publisher has more debug information + PythonHandler " genenetwork1 "/web/webqtl/main.py #PythonHandler mod_python.publisher - PythonHandler mod_python.cgihandler - #PythonAutoReload Off + #PythonHandler mod_python.cgihandler # only while debugging: PythonDebug On +# only while debugging: SetHandler python-program PythonHandler mod_python.testhandler "))))))))) + +;; guix system container -L /path/to/guix-past/modules/ -L /path/to/guix-bioinformatics/ /path/to/guix-bioinformatics/gn/services/genenetwork.scm --network +;; xdg-open http://localhost:8042 -- cgit v1.2.3