From 944905898b688e9a6fde4dc70031bbdc803141ae Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 10 Feb 2015 09:50:13 -0500 Subject: [PATCH 1/2] Add major version to Galaxy, expose via API. I suspect there are better ways to do this - but I thought I would put something out there we can argue about and hopefully get something in before the next release. --- lib/galaxy/config.py | 3 ++- lib/galaxy/version.py | 1 + lib/galaxy/webapps/galaxy/api/configuration.py | 5 +++++ lib/galaxy/webapps/galaxy/buildapp.py | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 lib/galaxy/version.py diff --git a/lib/galaxy/config.py b/lib/galaxy/config.py index 54591391c53..9103f0cc927 100644 --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -19,7 +19,7 @@ from galaxy.util import listify from galaxy.util import string_as_bool from galaxy.util.dbkeys import GenomeBuilds from galaxy.web.formatting import expand_pretty_datetime_format - +from .version import VERSION_MAJOR log = logging.getLogger( __name__ ) @@ -63,6 +63,7 @@ class Configuration( object ): # This is not a uwsgi process, or something went horribly wrong. pass + self.version_major = VERSION_MAJOR # Database related configuration self.database = resolve_path( kwargs.get( "database_file", "database/universe.sqlite" ), self.root ) self.database_connection = kwargs.get( "database_connection", False ) diff --git a/lib/galaxy/version.py b/lib/galaxy/version.py new file mode 100644 index 00000000000..373d9d5c4fd --- /dev/null +++ b/lib/galaxy/version.py @@ -0,0 +1 @@ +VERSION_MAJOR = "2015.03" diff --git a/lib/galaxy/webapps/galaxy/api/configuration.py b/lib/galaxy/webapps/galaxy/api/configuration.py index 6d1d17e5fdc..a14bc6d49af 100644 --- a/lib/galaxy/webapps/galaxy/api/configuration.py +++ b/lib/galaxy/webapps/galaxy/api/configuration.py @@ -31,6 +31,10 @@ class ConfigurationController( BaseAPIController ): serialization_params = self._parse_serialization_params( kwd, 'all' ) return self.get_config_dict( trans, is_admin, **serialization_params ) + @expose_api_anonymous + def version( self, trans, **kwds ): + return {"version_major": self.app.config.version_major } + def get_config_dict( self, trans, return_admin=False, view=None, keys=None, default_view='all' ): """ Return a dictionary with (a subset of) current Galaxy settings. @@ -97,6 +101,7 @@ class ConfigSerializer( base.ModelSerializer ): 'nginx_upload_path' : _defaults_to( self.url_for( controller='api', action='tools' ) ), 'ftp_upload_dir' : _defaults_to( None ), 'ftp_upload_site' : _defaults_to( None ), + 'version_major' : _defaults_to( None ), } diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index d367c4fcd51..3605de8bfb3 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -222,6 +222,9 @@ def populate_api_routes( webapp, app ): webapp.mapper.resource_with_deleted( 'history', 'histories', path_prefix='/api' ) webapp.mapper.connect( '/api/histories/{history_id}/citations', action='citations', controller="histories" ) webapp.mapper.resource( 'configuration', 'configuration', path_prefix='/api' ) + webapp.mapper.connect( "configuration_version", + "/api/version", controller="configuration", + action="version", conditions=dict( method=[ "GET" ] ) ) webapp.mapper.resource( 'datatype', 'datatypes', path_prefix='/api', From 585068363465dbf483afda1271a1d94484983255 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 10 Feb 2015 10:04:19 -0500 Subject: [PATCH 2/2] Change version format to YY.MM. --- lib/galaxy/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/version.py b/lib/galaxy/version.py index 373d9d5c4fd..392319a9342 100644 --- a/lib/galaxy/version.py +++ b/lib/galaxy/version.py @@ -1 +1 @@ -VERSION_MAJOR = "2015.03" +VERSION_MAJOR = "15.03"