From 6171ca401f013ff1f8b4cbcf963489ad97dd5fc6 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Tue, 16 Oct 2007 17:31:46 +0000 Subject: [PATCH] A more trustworthy way of generating Galaxy's base path in util/__init__.py. This is used to open builds.txt, ucsc_build_sites.txt, and gbrowse_build_sites.txt. Some tools are importing galaxy.tools.validation which eventually imports util/__init__.py, which was opening files with paths based upon the working directory. --- lib/galaxy/util/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index 932cb9129fc..a4e03dd5e3b 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -3,7 +3,7 @@ Utility functions used systemwide. """ import logging -import threading, sets, random, string, md5, re, binascii, pickle, time, datetime, math, re +import threading, sets, random, string, md5, re, binascii, pickle, time, datetime, math, re, os import pkg_resources @@ -305,9 +305,10 @@ def read_build_sites(filename): print "ERROR: Unable to read builds for site file %s" %filename return build_sites -dbnames = read_dbnames("static/ucsc/builds.txt") #this list is used in edit attributes and the upload tool -ucsc_build_sites = read_build_sites("static/ucsc/ucsc_build_sites.txt") #this list is used in history.tmpl -gbrowse_build_sites = read_build_sites("static/gbrowse/gbrowse_build_sites.txt") #this list is used in history.tmpl +galaxy_root_path = os.path.join(__path__[0], "..","..","..") +dbnames = read_dbnames(os.path.join(galaxy_root_path,"static","ucsc","builds.txt")) #this list is used in edit attributes and the upload tool +ucsc_build_sites = read_build_sites(os.path.join(galaxy_root_path,"static","ucsc","ucsc_build_sites.txt")) #this list is used in history.tmpl +gbrowse_build_sites = read_build_sites(os.path.join(galaxy_root_path,"static","gbrowse","gbrowse_build_sites.txt")) #this list is used in history.tmpl if __name__ == '__main__': import doctest, sys