aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2017-05-31 07:12:28 +0000
committerPjotr Prins2017-05-31 07:12:28 +0000
commit755b9aaa31c73cc5fe8c1a75d74846f1d8594419 (patch)
tree72981d86a63942e2f2a85127089e6b015af6c07a
parent9d4cb56608ca5de3495ede9149443e772a25d706 (diff)
downloadgenenetwork2-755b9aaa31c73cc5fe8c1a75d74846f1d8594419.tar.gz
JS module handling
-rw-r--r--VERSION2
-rwxr-xr-xbin/genenetwork22
-rw-r--r--doc/development.org20
-rw-r--r--etc/default_settings.py2
-rw-r--r--wqflask/utility/tools.py37
-rw-r--r--wqflask/wqflask/views.py6
6 files changed, 55 insertions, 14 deletions
diff --git a/VERSION b/VERSION
index 144b089a..3e0b7cab 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.10-pre1
+2.10-pre4
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index df688989..b3190f1e 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -68,7 +68,7 @@ else
export PATH=$GN2_PROFILE/bin:$PATH
export PYTHONPATH=$GN2_PROFILE/lib/python2.7/site-packages
export R_LIBS_SITE=$GN2_PROFILE/site-library
- export GUIX_JS_PATH=$GN2_PROFILE/share/genenetwork2/javascript
+ export JS_GUIX_PATH=$GN2_PROFILE/share/genenetwork2/javascript
export GUIX_GTK3_PATH="$GN2_PROFILE/lib/gtk-3.0"
export GI_TYPELIB_PATH="$GN2_PROFILE/lib/girepository-1.0"
export XDG_DATA_DIRS="$GN2_PROFILE/share"
diff --git a/doc/development.org b/doc/development.org
index bbb6084f..5e6e318b 100644
--- a/doc/development.org
+++ b/doc/development.org
@@ -1,5 +1,7 @@
* Development
+** Using GN2_PROFILE
+
After cloning the git source tree you can run the contained GN2 using
an existing GN2_PROFILE, i.e., use a profile that was create to run a
binary installation of GN2. This profile may be found by typing
@@ -21,3 +23,21 @@ and use that instead.
Note that the genenetwork2 script sets up the environment for running
the webserver. This includes path to R modules and python modules. These
are output on startup. To make sure there is no environment pollution you can
+
+** Javascript modules
+
+As of release 2.10-pre4 we Javascript modules are installed in three places:
+
+1. JS_GUIX_PATH: the Guix store - these are Guix pre-packaged modules
+2. The git source tree (./wqflask/wqflask/static/packages/)
+3. JS_GN_PATH: a local directory containing (temporary) development modules
+
+Packages currently in git (2) will move to JS_GUIX_PATH (1) over
+time. This is to keep better track of origin updates. Putting packages
+in git (2) is actively discouraged(!), unless there are GN2 specific
+adaptations to the original Javascript modules.
+
+JS_GN_PATH (3) is for development purposes. By default is is set to
+$HOME/genenetwork/javascript. Say you are working on an updated
+version of a JS module not yet in (1) you can simply check out that
+module in that path and it should show up.
diff --git a/etc/default_settings.py b/etc/default_settings.py
index 4f3a6f5c..1c5b10b4 100644
--- a/etc/default_settings.py
+++ b/etc/default_settings.py
@@ -61,7 +61,7 @@ HOME = os.environ['HOME']
# PRIVATE_FILES = HOME+"/gn2_private_data" # private static data files (unused)
# ---- Local path to JS libraries - for development modules (only)
-# GN2_JS_PATH = os.environ['HOME']+"/genenetwork/javascript" (unused)
+JS_GN_PATH = os.environ['HOME']+"/genenetwork/javascript"
# ---- GN2 Executables (overwrite for testing only)
# PYLMM_COMMAND = str.strip(os.popen("which pylmm_redis").read())
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index d46a84ba..c1c6fd36 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -13,6 +13,11 @@ logger = logging.getLogger(__name__ )
OVERRIDES = {}
+def app_set(command_id, value):
+ """Set application wide value"""
+ app.config.setdefault(command_id,value)
+ value
+
def get_setting(command_id,guess=None):
"""Resolve a setting from the environment or the global settings in
app.config, with valid_path is a function checking whether the
@@ -40,6 +45,7 @@ def get_setting(command_id,guess=None):
def value(command):
if command:
# sys.stderr.write("Found "+command+"\n")
+ app_set(command_id,command)
return command
else:
return None
@@ -89,6 +95,18 @@ def valid_path(dir):
return dir
return None
+def js_path(module=None):
+ """
+ Find the JS module in the two paths
+ """
+ try_gn = get_setting("JS_GN_PATH")+"/"+module
+ if valid_path(try_gn):
+ return try_gn
+ try_guix = get_setting("JS_GUIX_PATH")+"/"+module
+ if valid_path(try_guix):
+ return try_guix
+ raise "No JS path found for "+module+" (check JS_GN_PATH)"
+
def pylmm_command(guess=None):
return valid_bin(get_setting("PYLMM_COMMAND",guess))
@@ -212,16 +230,19 @@ USE_REDIS = get_setting_bool('USE_REDIS')
USE_GN_SERVER = get_setting_bool('USE_GN_SERVER')
GENENETWORK_FILES = get_setting('GENENETWORK_FILES')
-GUIX_JS_PATH = get_setting('GUIX_JS_PATH')
-assert_dir(GUIX_JS_PATH)
-
-PYLMM_COMMAND = pylmm_command()
-GEMMA_COMMAND = gemma_command()
-PLINK_COMMAND = plink_command()
+JS_GUIX_PATH = get_setting('JS_GUIX_PATH')
+assert_dir(JS_GUIX_PATH)
+JS_GN_PATH = get_setting('JS_GN_PATH')
+assert_dir(JS_GN_PATH)
+
+PYLMM_COMMAND = app_set("PYLMM_COMMAND",pylmm_command())
+GEMMA_COMMAND = app_set("GEMMA_COMMAND",gemma_command())
+PLINK_COMMAND = app_set("PLINK_COMMAND",plink_command())
TEMPDIR = tempdir() # defaults to UNIX TMPDIR
-TWITTER_POST_FETCHER_JS_PATH = GUIX_JS_PATH + "/Twitter-Post-Fetcher"
-assert_dir(TWITTER_POST_FETCHER_JS_PATH)
+# ---- Handle specific JS modules
+JS_TWITTER_POST_FETCHER_PATH = get_setting("JS_TWITTER_POST_FETCHER_PATH",js_path("Twitter-Post-Fetcher"))
+assert_dir(JS_TWITTER_POST_FETCHER_PATH)
from six import string_types
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 3882e60a..07151425 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -53,7 +53,7 @@ from wqflask.ctl import ctl_analysis
#from wqflask.trait_submission import submit_trait
from utility import temp_data
-from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION,TWITTER_POST_FETCHER_JS_PATH
+from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL,GN_VERSION,JS_TWITTER_POST_FETCHER_PATH
from utility.helper_functions import get_species_groups
from base import webqtlFormData
@@ -147,8 +147,8 @@ def tmp_page(img_path):
img_base64 = bytesarray )
@app.route("/twitter/<path:filename>")
-def bd_files(filename):
- return send_from_directory(TWITTER_POST_FETCHER_JS_PATH, filename)
+def twitter(filename):
+ return send_from_directory(JS_TWITTER_POST_FETCHER_PATH, filename)
#@app.route("/data_sharing")
#def data_sharing_page():