mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-19 10:51:34 +08:00
Consolidate dialect_to_egg to a single location.
This commit is contained in:
@@ -12,16 +12,13 @@ from sqlalchemy import *
|
||||
from sqlalchemy.exc import NoSuchTableError
|
||||
from migrate.versioning import repository, schema
|
||||
|
||||
from galaxy.model.mapping import dialect_to_egg
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
# path relative to galaxy
|
||||
migrate_repository_directory = os.path.dirname( __file__ ).replace( os.getcwd() + os.path.sep, '', 1 )
|
||||
migrate_repository = repository.Repository( migrate_repository_directory )
|
||||
dialect_to_egg = {
|
||||
"sqlite" : "pysqlite>=2",
|
||||
"postgres" : "psycopg2",
|
||||
"mysql" : "MySQL_python"
|
||||
}
|
||||
|
||||
def create_or_verify_database( url, galaxy_config_file, engine_options={}, app=None ):
|
||||
"""
|
||||
|
||||
@@ -12,6 +12,7 @@ from galaxy.webapps.tool_shed.model import *
|
||||
from galaxy.model.orm import *
|
||||
from galaxy.model.custom_types import *
|
||||
from galaxy.util.bunch import Bunch
|
||||
from galaxy.model.mapping import dialect_to_egg
|
||||
import galaxy.webapps.tool_shed.util.shed_statistics as shed_statistics
|
||||
import galaxy.webapps.tool_shed.util.hgweb_config
|
||||
from galaxy.webapps.tool_shed.security import CommunityRBACAgent
|
||||
@@ -22,12 +23,6 @@ context = Session = scoped_session( sessionmaker( autoflush=False, autocommit=Tr
|
||||
# For backward compatibility with "context.current"
|
||||
context.current = Session
|
||||
|
||||
dialect_to_egg = {
|
||||
"sqlite" : "pysqlite>=2",
|
||||
"postgres" : "psycopg2",
|
||||
"mysql" : "MySQL_python"
|
||||
}
|
||||
|
||||
# NOTE REGARDING TIMESTAMPS:
|
||||
# It is currently difficult to have the timestamps calculated by the
|
||||
# database in a portable way, so we're doing it in the client. This
|
||||
|
||||
@@ -8,20 +8,18 @@ pkg_resources.require( "decorator" )
|
||||
pkg_resources.require( "sqlalchemy-migrate" )
|
||||
pkg_resources.require( "Tempita" )
|
||||
|
||||
|
||||
from migrate.versioning import repository, schema
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.exc import NoSuchTableError
|
||||
|
||||
from galaxy.model.mapping import dialect_to_egg
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
# path relative to galaxy
|
||||
migrate_repository_directory = os.path.dirname( __file__ ).replace( os.getcwd() + os.path.sep, '', 1 )
|
||||
migrate_repository = repository.Repository( migrate_repository_directory )
|
||||
dialect_to_egg = {
|
||||
"sqlite" : "pysqlite>=2",
|
||||
"postgres" : "psycopg2",
|
||||
"mysql" : "MySQL_python"
|
||||
}
|
||||
|
||||
def create_or_verify_database( url, engine_options={} ):
|
||||
"""
|
||||
|
||||
@@ -9,6 +9,7 @@ pkg_resources.require( "sqlalchemy-migrate" )
|
||||
from migrate.versioning import repository, schema
|
||||
from sqlalchemy import *
|
||||
from galaxy.util.odict import odict
|
||||
from galaxy.model.mapping import dialect_to_egg
|
||||
from tool_shed.util import common_util
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
@@ -16,11 +17,6 @@ log = logging.getLogger( __name__ )
|
||||
# Path relative to galaxy
|
||||
migrate_repository_directory = os.path.dirname( __file__ ).replace( os.getcwd() + os.path.sep, '', 1 )
|
||||
migrate_repository = repository.Repository( migrate_repository_directory )
|
||||
dialect_to_egg = {
|
||||
"sqlite" : "pysqlite>=2",
|
||||
"postgres" : "psycopg2",
|
||||
"mysql" : "MySQL_python"
|
||||
}
|
||||
|
||||
def verify_tools( app, url, galaxy_config_file, engine_options={} ):
|
||||
# Check the value in the migrate_tools.version database table column to verify that the number is in
|
||||
|
||||
+2
-5
@@ -26,6 +26,8 @@ pkg_resources.require( "SQLAlchemy" )
|
||||
|
||||
from ConfigParser import SafeConfigParser
|
||||
|
||||
from galaxy.model.mapping import dialect_to_egg
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
if sys.argv[-1] in [ 'tool_shed' ]:
|
||||
@@ -56,11 +58,6 @@ elif cp.has_option( "app:main", "database_file" ):
|
||||
else:
|
||||
db_url = "sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE"
|
||||
|
||||
dialect_to_egg = {
|
||||
"sqlite" : "pysqlite>=2",
|
||||
"postgres" : "psycopg2",
|
||||
"mysql" : "MySQL_python"
|
||||
}
|
||||
dialect = ( db_url.split( ':', 1 ) )[0]
|
||||
try:
|
||||
egg = dialect_to_egg[dialect]
|
||||
|
||||
@@ -14,6 +14,8 @@ eggs.require( "sqlalchemy_migrate" )
|
||||
from migrate.versioning.shell import main
|
||||
from ConfigParser import SafeConfigParser
|
||||
|
||||
from galaxy.model.mapping import dialect_to_egg
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
if sys.argv[-1] in [ 'tool_shed' ]:
|
||||
@@ -44,11 +46,6 @@ elif cp.has_option( "app:main", "database_file" ):
|
||||
else:
|
||||
db_url = "sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE"
|
||||
|
||||
dialect_to_egg = {
|
||||
"sqlite" : "pysqlite>=2",
|
||||
"postgres" : "psycopg2",
|
||||
"mysql" : "MySQL_python"
|
||||
}
|
||||
dialect = ( db_url.split( ':', 1 ) )[0]
|
||||
try:
|
||||
egg = dialect_to_egg[dialect]
|
||||
|
||||
@@ -15,6 +15,8 @@ pkg_resources.require( "sqlalchemy-migrate" )
|
||||
from migrate.versioning.shell import main
|
||||
from ConfigParser import SafeConfigParser
|
||||
|
||||
from galaxy.model.mapping import dialect_to_egg
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
config_file = 'universe_wsgi.ini'
|
||||
@@ -40,11 +42,6 @@ elif cp.has_option( "app:main", "database_file" ):
|
||||
else:
|
||||
db_url = "sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE"
|
||||
|
||||
dialect_to_egg = {
|
||||
"sqlite" : "pysqlite>=2",
|
||||
"postgres" : "psycopg2",
|
||||
"mysql" : "MySQL_python"
|
||||
}
|
||||
dialect = ( db_url.split( ':', 1 ) )[0]
|
||||
try:
|
||||
egg = dialect_to_egg[dialect]
|
||||
|
||||
Reference in New Issue
Block a user