diff --git a/scripts/api/common.py b/scripts/api/common.py index 1380b7fe31b..9767baf633a 100644 --- a/scripts/api/common.py +++ b/scripts/api/common.py @@ -7,13 +7,6 @@ import os import sys import urllib2 -new_path = [ os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, 'lib' ) ] -new_path.extend( sys.path[1:] ) -sys.path = new_path - -from galaxy import eggs -eggs.require( "pycrypto" ) - from Crypto.Cipher import Blowfish log = logging.getLogger( __name__ ) diff --git a/scripts/check_galaxy.py b/scripts/check_galaxy.py index 20ba2ae4627..16d51d18a32 100755 --- a/scripts/check_galaxy.py +++ b/scripts/check_galaxy.py @@ -97,8 +97,6 @@ If the user does not exist, check_galaxy will create it for you.""" % login_file # find/import twill lib_dir = os.path.join( scripts_dir, os.pardir, "lib" ) sys.path.insert( 1, lib_dir ) -from galaxy import eggs -eggs.require( "twill" ) import twill import twill.commands as tc diff --git a/scripts/cleanup_datasets/admin_cleanup_datasets.py b/scripts/cleanup_datasets/admin_cleanup_datasets.py index c66016f37dc..0d9f3b8da49 100755 --- a/scripts/cleanup_datasets/admin_cleanup_datasets.py +++ b/scripts/cleanup_datasets/admin_cleanup_datasets.py @@ -49,11 +49,8 @@ from time import strftime from cleanup_datasets import CleanupDatasetsApplication -from galaxy import eggs -eggs.require('SQLAlchemy') import sqlalchemy as sa from sqlalchemy import and_, false -eggs.require("Mako") from mako.template import Template import galaxy.config diff --git a/scripts/cleanup_datasets/cleanup_datasets.py b/scripts/cleanup_datasets/cleanup_datasets.py index e189ef11ca2..3eee234bc88 100755 --- a/scripts/cleanup_datasets/cleanup_datasets.py +++ b/scripts/cleanup_datasets/cleanup_datasets.py @@ -10,16 +10,14 @@ from datetime import datetime, timedelta from optparse import OptionParser from time import strftime -new_path = [ os.path.join( os.getcwd(), "lib" ) ] -new_path.extend( sys.path[1:] ) # remove scripts/ from the path -sys.path = new_path - -from galaxy import eggs -eggs.require('SQLAlchemy') import sqlalchemy as sa from sqlalchemy import and_, false, null, true from sqlalchemy.orm import eagerload +new_path = [ os.path.join( os.getcwd(), "lib" ) ] +new_path.extend( sys.path[1:] ) # remove scripts/ from the path +sys.path = new_path + import galaxy.config import galaxy.model.mapping from galaxy.exceptions import ObjectNotFound diff --git a/scripts/cleanup_datasets/pgcleanup.py b/scripts/cleanup_datasets/pgcleanup.py index 780d984a23c..7dfa428368e 100755 --- a/scripts/cleanup_datasets/pgcleanup.py +++ b/scripts/cleanup_datasets/pgcleanup.py @@ -17,10 +17,7 @@ from optparse import OptionParser galaxy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) sys.path.insert(0, os.path.join(galaxy_root, 'lib')) -from galaxy import eggs -eggs.require('psycopg2') import psycopg2 -eggs.require('SQLAlchemy') from sqlalchemy.engine.url import make_url import galaxy.config diff --git a/scripts/data_libraries/build_lucene_index.py b/scripts/data_libraries/build_lucene_index.py index 902cfcf445e..a49ea5689ee 100644 --- a/scripts/data_libraries/build_lucene_index.py +++ b/scripts/data_libraries/build_lucene_index.py @@ -20,11 +20,8 @@ new_path = [ os.path.join( os.getcwd(), "lib" ) ] new_path.extend( sys.path[1:] ) # remove scripts/ from the path sys.path = new_path -from galaxy import eggs import galaxy.model.mapping from galaxy import config, model -import pkg_resources -pkg_resources.require( "SQLAlchemy >= 0.4" ) def main( ini_file ): sa_session, gconfig = get_sa_session( ini_file ) diff --git a/scripts/data_libraries/build_whoosh_index.py b/scripts/data_libraries/build_whoosh_index.py index f04fc8d3ffd..bcc395534b7 100644 --- a/scripts/data_libraries/build_whoosh_index.py +++ b/scripts/data_libraries/build_whoosh_index.py @@ -14,12 +14,9 @@ new_path = [ os.path.join( os.getcwd(), "lib" ) ] new_path.extend( sys.path[1:] ) # remove scripts/ from the path sys.path = new_path -from galaxy import eggs # Whoosh is compatible with Python 2.5+ Try to import Whoosh and set flag to indicate whether search is enabled. try: - eggs.require( "Whoosh" ) - from whoosh.filedb.filestore import FileStorage from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT from whoosh.index import Index diff --git a/scripts/db_shell.py b/scripts/db_shell.py index 2bb25101ae2..5e3d8c5e0a9 100644 --- a/scripts/db_shell.py +++ b/scripts/db_shell.py @@ -22,10 +22,6 @@ sys.path = new_path from galaxy.model.orm.scripts import get_config -from galaxy import eggs -eggs.require( "decorator" ) -eggs.require( "Tempita" ) -eggs.require( "SQLAlchemy" ) db_url = get_config( sys.argv )['db_url'] diff --git a/scripts/drmaa_external_killer.py b/scripts/drmaa_external_killer.py index 02419bc34c1..6c74a0cfaab 100755 --- a/scripts/drmaa_external_killer.py +++ b/scripts/drmaa_external_killer.py @@ -9,12 +9,6 @@ import os import pwd import sys -new_path = [ os.path.join( os.getcwd(), "lib" ) ] -new_path.extend( sys.path[1:] ) # remove scripts/ from the path -sys.path = new_path - -from galaxy import eggs -eggs.require("drmaa") import drmaa diff --git a/scripts/drmaa_external_runner.py b/scripts/drmaa_external_runner.py index 6b4d04c8403..a1474feb418 100755 --- a/scripts/drmaa_external_runner.py +++ b/scripts/drmaa_external_runner.py @@ -12,12 +12,6 @@ import os import pwd import sys -new_path = [ os.path.join( os.getcwd(), "lib" ) ] -new_path.extend( sys.path[1:] ) # remove scripts/ from the path -sys.path = new_path - -from galaxy import eggs -eggs.require("drmaa") import drmaa DRMAA_jobTemplate_attributes = [ 'args', 'remoteCommand', 'outputPath', 'errorPath', 'nativeSpecification', diff --git a/scripts/egg_packager_template.py b/scripts/egg_packager_template.py deleted file mode 100644 index 478b92b569d..00000000000 --- a/scripts/egg_packager_template.py +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/env python - -# Configure stdout logging - -import glob -import HTMLParser -import logging -import os -import re -import shutil -import sys -import urllib -import urllib2 -import zipfile - -log = logging.getLogger() -log.setLevel( 10 ) -log.addHandler( logging.StreamHandler( sys.stdout ) ) - -# Fake pkg_resources - -macosVersionString = re.compile(r"macosx-(\d+)\.(\d+)-(.*)") -darwinVersionString = re.compile(r"darwin-(\d+)\.(\d+)\.(\d+)-(.*)") -solarisVersionString = re.compile(r"solaris-(\d)\.(\d+)-(.*)") - - -def compatible_platforms(provided, required): - """Can code for the `provided` platform run on the `required` platform? - - Returns true if either platform is ``None``, or the platforms are equal. - - XXX Needs compatibility checks for Linux and other unixy OSes. - """ - if provided is None or required is None or provided == required: - return True # easy case - - # Mac OS X special cases - reqMac = macosVersionString.match(required) - if reqMac: - provMac = macosVersionString.match(provided) - - # is this a Mac package? - if not provMac: - # this is backwards compatibility for packages built before - # setuptools 0.6. All packages built after this point will - # use the new macosx designation. - provDarwin = darwinVersionString.match(provided) - if provDarwin: - dversion = int(provDarwin.group(1)) - macosversion = "%s.%s" % (reqMac.group(1), reqMac.group(2)) - if dversion == 7 and macosversion >= "10.3" or \ - dversion == 8 and macosversion >= "10.4": - - # import warnings - # warnings.warn("Mac eggs should be rebuilt to " - # "use the macosx designation instead of darwin.", - # category=DeprecationWarning) - return True - return False # egg isn't macosx or legacy darwin - - # are they the same major version and machine type? - if provMac.group(1) != reqMac.group(1) or \ - provMac.group(3) != reqMac.group(3): - return False - - # is the required OS major update >= the provided one? - if int(provMac.group(2)) > int(reqMac.group(2)): - return False - - return True - - # Solaris' special cases - reqSol = solarisVersionString.match(required) - if reqSol: - provSol = solarisVersionString.match(provided) - if not provSol: - return False - if provSol.group(1) != reqSol.group(1) or \ - provSol.group(3) != reqSol.group(3): - return False - if int(provSol.group(2)) > int(reqSol.group(2)): - return False - return True - - # XXX Linux and other platforms' special cases should go here - return False - -EGG_NAME = re.compile( - r"(?P[^-]+)" - r"( -(?P[^-]+) (-py(?P[^-]+) (-(?P.+))? )? )?", - re.VERBOSE | re.IGNORECASE -).match - - -class Distribution( object ): - def __init__( self, egg_name, project_name, version, py_version, platform ): - self._egg_name = egg_name - self.project_name = project_name - if project_name is not None: - self.project_name = project_name.replace( '-', '_' ) - self.version = version - if version is not None: - self.version = version.replace( '-', '_' ) - self.py_version = py_version - self.platform = platform - self.location = os.path.join( tmpd, egg_name ) + '.egg' - - def egg_name( self ): - return self._egg_name - - @classmethod - def from_filename( cls, basename ): - project_name, version, py_version, platform = [None] * 4 - basename, ext = os.path.splitext(basename) - if ext.lower() == '.egg': - match = EGG_NAME( basename ) - if match: - project_name, version, py_version, platform = match.group( 'name', 'ver', 'pyver', 'plat' ) - return cls( basename, project_name, version, py_version, platform ) - - -class pkg_resources( object ): - pass - -pkg_resources.Distribution = Distribution - -# Fake galaxy.eggs - -env = None - - -def get_env(): - return None - - -class URLRetriever( urllib.FancyURLopener ): - def http_error_default( *args ): - urllib.URLopener.http_error_default( *args ) - - -class Egg( object ): - def __init__( self, distribution ): - self.url = url + '/' + distribution.project_name.replace( '-', '_' ) - self.dir = tmpd - self.distribution = distribution - - def set_distribution( self ): - pass - - def unpack_if_needed( self ): - pass - - def remove_doppelgangers( self ): - pass - - def fetch( self, requirement ): - """ - fetch() serves as the install method to pkg_resources.working_set.resolve() - """ - def find_alternative(): - """ - Some platforms (e.g. Solaris) support eggs compiled on older platforms - """ - class LinkParser( HTMLParser.HTMLParser ): - """ - Finds links in what should be an Apache-style directory index - """ - def __init__( self ): - HTMLParser.HTMLParser.__init__( self ) - self.links = [] - - def handle_starttag( self, tag, attrs ): - if tag == 'a' and 'href' in dict( attrs ): - self.links.append( dict( attrs )['href'] ) - parser = LinkParser() - try: - parser.feed( urllib2.urlopen( self.url + '/' ).read() ) - except urllib2.HTTPError, e: - if e.code == 404: - return None - parser.close() - for link in parser.links: - file = urllib.unquote( link ).rsplit( '/', 1 )[-1] - tmp_dist = pkg_resources.Distribution.from_filename( file ) - if tmp_dist.platform is not None and \ - self.distribution.project_name == tmp_dist.project_name and \ - self.distribution.version == tmp_dist.version and \ - self.distribution.py_version == tmp_dist.py_version and \ - compatible_platforms( tmp_dist.platform, self.distribution.platform ): - return file - return None - if self.url is None: - return None - alternative = None - try: - url = self.url + '/' + self.distribution.egg_name() + '.egg' - URLRetriever().retrieve( url, self.distribution.location ) - log.debug( "Fetched %s" % url ) - except IOError, e: - if e[1] == 404 and self.distribution.platform != py: - alternative = find_alternative() - if alternative is None: - return None - else: - return None - if alternative is not None: - try: - url = '/'.join( ( self.url, alternative ) ) - URLRetriever().retrieve( url, os.path.join( self.dir, alternative ) ) - log.debug( "Fetched %s" % url ) - except IOError, e: - return None - self.platform = alternative.split( '-', 2 )[-1].rsplit( '.egg', 1 )[0] - self.set_distribution() - self.unpack_if_needed() - self.remove_doppelgangers() - global env - env = get_env() # reset the global Environment object now that we've obtained a new egg - return self.distribution - - -def create_zip(): - fname = 'galaxy_eggs-%s.zip' % platform - z = zipfile.ZipFile( fname, 'w', zipfile.ZIP_STORED ) - for egg in glob.glob( os.path.join( tmpd, '*.egg' ) ): - z.write( egg, 'eggs/' + os.path.basename( egg ) ) - z.close() - print 'Egg package is in %s' % fname - print "To install the eggs, please copy this file to your Galaxy installation's root" - print "directory and unpack with:" - print " unzip %s" % fname - - -def clean(): - shutil.rmtree( tmpd ) - -import tempfile -tmpd = tempfile.mkdtemp() - -failures = [] -platform = None -py = None -url = None - -# Automatically generated egg definitions follow diff --git a/scripts/functional_tests.py b/scripts/functional_tests.py index e25a885ddbd..f698e9fe2d7 100644 --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -16,20 +16,8 @@ sys.path = new_path from base.test_logging import logging_config_file from base.tool_shed_util import parse_tool_panel_config -from galaxy import eggs from galaxy.util.properties import load_app_properties -eggs.require( "nose" ) -eggs.require( "NoseHTML" ) -eggs.require( "NoseTestDiff" ) -eggs.require( "Paste" ) -eggs.require( "PasteDeploy" ) -eggs.require( "Cheetah" ) - -# this should not be required, but it is under certain conditions, thanks to this bug: -# http://code.google.com/p/python-nose/issues/detail?id=284 -eggs.require( "pysqlite" ) - import logging import os.path import time diff --git a/scripts/manage_db.py b/scripts/manage_db.py index 98e504927fa..bce683b8e31 100644 --- a/scripts/manage_db.py +++ b/scripts/manage_db.py @@ -8,15 +8,6 @@ new_path = [ os.path.join( os.getcwd(), "lib" ) ] new_path.extend( sys.path[1:] ) # remove scripts/ from the path sys.path = new_path -from galaxy import eggs - -eggs.require( "decorator" ) -eggs.require( "Tempita" ) -eggs.require( "SQLAlchemy" ) -eggs.require( "six" ) # Required by sqlalchemy-migrate -eggs.require( "sqlparse" ) # Required by sqlalchemy-migrate -eggs.require( "sqlalchemy_migrate" ) - from migrate.versioning.shell import main from galaxy.model.orm.scripts import get_config diff --git a/scripts/manage_tools.py b/scripts/manage_tools.py index 46ca456415f..b6776eb8a0a 100644 --- a/scripts/manage_tools.py +++ b/scripts/manage_tools.py @@ -6,19 +6,9 @@ new_path = [ os.path.join( os.getcwd(), "lib" ) ] new_path.extend( sys.path[1:] ) # remove scripts/ from the path sys.path = new_path -from galaxy import eggs - -eggs.require( "SQLAlchemy" ) -eggs.require( "decorator" ) -eggs.require( "Tempita " ) -eggs.require( "six" ) # Required by sqlalchemy-migrate -eggs.require( "sqlparse" ) # Required by sqlalchemy-migrate -eggs.require( "sqlalchemy-migrate" ) - from migrate.versioning.shell import main from ConfigParser import SafeConfigParser -from galaxy.model.orm.scripts import require_dialect_egg from galaxy.model.orm.scripts import read_config_file_arg from galaxy.util.properties import load_app_properties @@ -46,6 +36,4 @@ elif "database_file" in properties: else: db_url = "sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE" -require_dialect_egg( db_url ) - main( repository=repo, url=db_url ) diff --git a/scripts/nosetests.py b/scripts/nosetests.py index 41f5e8b10e0..1ffebd70343 100755 --- a/scripts/nosetests.py +++ b/scripts/nosetests.py @@ -4,14 +4,6 @@ import os import sys -new_path = [ os.path.join( os.getcwd(), "lib" ) ] -new_path.extend( sys.path[1:] ) -sys.path = new_path - -from galaxy import eggs -eggs.require( 'nose' ) -eggs.require( 'NoseHTML' ) - from pkg_resources import load_entry_point assert sys.version_info[:2] >= ( 2, 4 ) diff --git a/scripts/others/incorrect_gops_jobs.py b/scripts/others/incorrect_gops_jobs.py index 7553778b3f1..da0782d268e 100755 --- a/scripts/others/incorrect_gops_jobs.py +++ b/scripts/others/incorrect_gops_jobs.py @@ -4,13 +4,10 @@ Fetch jobs using gops_intersect, gops_merge, gops_subtract, gops_complement, gop wherein the second dataset doesn't have chr, start and end in standard columns 1, 2 and 3. """ -from galaxy import eggs import sys, os, ConfigParser, tempfile import galaxy.app import galaxy.model.mapping -import pkg_resources - -pkg_resources.require( "SQLAlchemy >= 0.4" ) + import sqlalchemy as sa assert sys.version_info[:2] >= ( 2, 4 ) diff --git a/scripts/others/incorrect_gops_join_jobs.py b/scripts/others/incorrect_gops_join_jobs.py index 88c0779f8df..8290cf9894e 100644 --- a/scripts/others/incorrect_gops_join_jobs.py +++ b/scripts/others/incorrect_gops_join_jobs.py @@ -3,13 +3,10 @@ Fetch gops_join wherein the use specified minimum coverage is not 1. """ -from galaxy import eggs import sys, os, ConfigParser, tempfile import galaxy.app import galaxy.model.mapping -import pkg_resources - -pkg_resources.require( "SQLAlchemy >= 0.4" ) + import sqlalchemy as sa assert sys.version_info[:2] >= ( 2, 4 ) diff --git a/scripts/paster.py b/scripts/paster.py index 9e7dd96ede7..85bb3ef3421 100755 --- a/scripts/paster.py +++ b/scripts/paster.py @@ -19,14 +19,9 @@ new_path = [ os.path.join( os.getcwd(), "lib" ) ] new_path.extend( sys.path[1:] ) # remove scripts/ from the path sys.path = new_path -from galaxy import eggs - if 'LOG_TEMPFILES' in os.environ: from log_tempfile import TempFile _log_tempfile = TempFile() -eggs.require( "Paste" ) -eggs.require( "PasteDeploy" ) - from galaxy.util.pastescript import serve serve.run() diff --git a/scripts/summarize_timings.py b/scripts/summarize_timings.py index d5b768babc1..5ff7359c467 100644 --- a/scripts/summarize_timings.py +++ b/scripts/summarize_timings.py @@ -3,21 +3,12 @@ from __future__ import print_function import os import sys -new_path = [ os.path.join( os.path.dirname(__file__), os.pardir, "lib" ) ] -new_path.extend( sys.path[1:] ) # remove scripts/ from the path -sys.path = new_path - try: from argparse import ArgumentParser except ImportError: ArgumentParser = None import re -try: - from galaxy import eggs - eggs.require("numpy") -except ImportError: - pass import numpy diff --git a/scripts/tool_shed/build_ts_whoosh_index.py b/scripts/tool_shed/build_ts_whoosh_index.py index 776ad310a2b..d523cd24aa0 100644 --- a/scripts/tool_shed/build_ts_whoosh_index.py +++ b/scripts/tool_shed/build_ts_whoosh_index.py @@ -26,9 +26,6 @@ from galaxy.webapps.tool_shed import config from galaxy.webapps.tool_shed import model from galaxy.tools.loader_directory import load_tool_elements_from_path -from galaxy import eggs -eggs.require( "SQLAlchemy" ) -eggs.require( "Whoosh" ) from whoosh.filedb.filestore import FileStorage from whoosh.fields import Schema, STORED, TEXT diff --git a/scripts/tool_shed/migrate_tools_to_repositories.py b/scripts/tool_shed/migrate_tools_to_repositories.py index b1a51698877..d10e359d391 100644 --- a/scripts/tool_shed/migrate_tools_to_repositories.py +++ b/scripts/tool_shed/migrate_tools_to_repositories.py @@ -27,9 +27,6 @@ new_path = [ os.path.join( os.getcwd(), "lib" ) ] new_path.extend( sys.path[1:] ) # remove scripts/ from the path sys.path = new_path -from galaxy import eggs -import pkg_resources -pkg_resources.require( "psycopg2" ) import psycopg2 import galaxy.webapps.tool_shed.app diff --git a/scripts/tools/maf/check_loc_file.py b/scripts/tools/maf/check_loc_file.py index 1c41c3a314d..96514962db6 100644 --- a/scripts/tools/maf/check_loc_file.py +++ b/scripts/tools/maf/check_loc_file.py @@ -1,8 +1,6 @@ #Dan Blankenberg #This script checks maf_index.loc file for inconsistencies between what is listed as available and what is really available. #Make sure that required dependencies (e.g. galaxy_root/lib and galaxy_root/eggs) are included in your PYTHONPATH -from galaxy import eggs -import pkg_resources; pkg_resources.require( "bx-python" ) import bx.align.maf from galaxy.tools.util import maf_utilities import sys diff --git a/scripts/transfer.py b/scripts/transfer.py index 7074b1b81dc..e194d2bd7fa 100644 --- a/scripts/transfer.py +++ b/scripts/transfer.py @@ -9,24 +9,18 @@ import os, sys, optparse, ConfigParser, socket, SocketServer, threading, logging galaxy_root = os.path.abspath( os.path.join( os.path.dirname( __file__ ), os.pardir ) ) sys.path.insert( 0, os.path.abspath( os.path.join( galaxy_root, 'lib' ) ) ) -from galaxy import eggs - try: import pexpect except ImportError: pexpect = None -eggs.require( "SQLAlchemy >= 0.4" ) - from sqlalchemy import * from sqlalchemy.orm import * -from galaxy.model.mapping import load_egg_for_url +from daemon import DaemonContext import galaxy.model from galaxy.util import json, bunch -eggs.require( 'python_daemon' ) -from daemon import DaemonContext PEXPECT_IMPORT_MESSAGE = ('The Python pexpect package is required to use this ' 'feature, please install it') @@ -88,7 +82,6 @@ class GalaxyApp( object ): dburl = self.config.get( 'app:main', 'database_connection' ) except ConfigParser.NoOptionError: dburl = default_dburl - load_egg_for_url( dburl ) engine = create_engine( dburl ) metadata = MetaData( engine ) self.sa_session = scoped_session( sessionmaker( bind=engine, autoflush=False, autocommit=True ) ) diff --git a/scripts/update_shed_config_path.py b/scripts/update_shed_config_path.py index a840b3b2c4f..895a75fd8d4 100644 --- a/scripts/update_shed_config_path.py +++ b/scripts/update_shed_config_path.py @@ -6,8 +6,6 @@ new_path = [ os.path.join( os.getcwd(), "lib" ) ] new_path.extend( sys.path[1:] ) sys.path = new_path -from galaxy import eggs -eggs.require('SQLAlchemy') from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import scoped_session, sessionmaker @@ -41,25 +39,6 @@ def create_database( config_file ): exit(1) '''Initialize the database file.''' - dialect_to_egg = { - "sqlite" : "pysqlite>=2", - "postgres" : "psycopg2", - "postgresql" : "psycopg2", - "mysql" : "MySQL_python" - } - dialect = ( database_connection.split( ':', 1 ) )[0] - try: - egg = dialect_to_egg[ dialect ] - try: - eggs.require( egg ) - print( "%s egg successfully loaded for %s dialect" % ( egg, dialect ) ) - except: - # If the module is in the path elsewhere (i.e. non-egg), it'll still load. - print( "%s egg not found, but an attempt will be made to use %s anyway" % ( egg, dialect ) ) - except KeyError: - # Let this go, it could possibly work with db's we don't support. - print( "database_connection contains an unknown SQLAlchemy database dialect: %s" % dialect ) - # Initialize the database connection. engine = create_engine( database_connection ) MetaData( bind=engine )