mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-19 10:51:34 +08:00
Enhancements to the tool shed api to enable the curretnly most important updates for repository_metadata records.
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
PUT/update script to update appropriate values in a repository_metadata table record in the Tool Shed.
|
||||
|
||||
usage: tool_shed_repository_revision_update.py key url key1=value1 key2=value2 ...
|
||||
"""
|
||||
|
||||
import os, sys
|
||||
sys.path.insert( 0, os.path.dirname( __file__ ) )
|
||||
from common import update
|
||||
|
||||
import pkg_resources
|
||||
pkg_resources.require( "simplejson" )
|
||||
|
||||
import simplejson
|
||||
|
||||
to_json_string = simplejson.dumps
|
||||
from_json_string = simplejson.loads
|
||||
|
||||
data = {}
|
||||
for key, value in [ kwarg.split( '=', 1 ) for kwarg in sys.argv[ 3: ] ]:
|
||||
"""
|
||||
This example script will properly handle updating the value of one or more of the following RepositoryMetadata attributes:
|
||||
tools_functionally_correct, do_not_test, tool_test_errors
|
||||
"""
|
||||
if key in [ 'tools_functionally_correct', 'do_not_test' ]:
|
||||
if str( value ).lower() in [ 'true', 'yes', 'on' ]:
|
||||
new_value = True
|
||||
else:
|
||||
new_value = False
|
||||
elif key in [ 'tool_test_errors' ]:
|
||||
new_value = from_json_string( value )
|
||||
else:
|
||||
new_value = str( value )
|
||||
data[ key ] = new_value
|
||||
|
||||
update( sys.argv[ 1 ], sys.argv[ 2 ], data )
|
||||
Reference in New Issue
Block a user