annotate data_manager/data_manager_manual.py @ 1:6524e573d9c2 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9e376934d399042eabcd4129e23beda60917273d
author iuc
date Mon, 15 Jan 2018 12:03:01 -0500
parents 81ed42c0721a
children 1c1e228884d3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
1 #!/usr/bin/env python
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
2 # Dan Blankenberg
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
3
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
4 import json
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
5 import logging
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
6 import optparse
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
7 import os
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
8 import shutil
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
9 import tempfile
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
10 import urllib2
1
6524e573d9c2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9e376934d399042eabcd4129e23beda60917273d
iuc
parents: 0
diff changeset
11 from xml.etree.ElementTree import tostring
0
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
12
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
13 try:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
14 # For Python 3.0 and later
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
15 from shutil import unpack_archive
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
16 except ImportError:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
17 # Fall back to Python 2 import
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
18 from setuptools.archive_util import unpack_archive
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
19
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
20 try:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
21 # For Python 3.0 and later
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
22 from urllib.request import urlretrieve
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
23 except ImportError:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
24 # Fall back to Python 2 imports
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
25 from urllib import urlretrieve
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
26
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
27 _log_name = __name__
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
28 if _log_name == '__builtin__':
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
29 _log_name = 'toolshed.installed.manual.data.manager'
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
30 log = logging.getLogger( _log_name )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
31
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
32
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
33 # --- These methods are called by/within the Galaxy Application
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
34 def exec_before_job( app, inp_data, out_data, param_dict, tool=None, **kwd ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
35 # Look for any data tables that haven't been defined for this data manager before and dynamically add them to Galaxy
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
36 param_dict = dict( **param_dict )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
37 data_tables_param = param_dict.get( 'data_tables', [] )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
38 if not isinstance( data_tables_param, list ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
39 data_tables_param = [data_tables_param]
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
40 if tool:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
41 tool_shed_repository = tool.tool_shed_repository
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
42 else:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
43 tool_shed_repository = None
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
44 tdtm = None
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
45 data_manager = app.data_managers.get_manager( tool.data_manager_id, None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
46 for data_table_param in data_tables_param:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
47 data_table_name = data_table_param.get( 'data_table_name', None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
48 if data_table_name:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
49 # get data table managed by this data Manager
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
50 data_table = app.tool_data_tables.get_tables().get( str( data_table_name ), None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
51 if data_table:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
52 data_table_filename = data_table.get_filename_for_source( data_manager, None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
53 if not data_table_filename:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
54 if tdtm is None:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
55 from tool_shed.tools import data_table_manager
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
56 tdtm = data_table_manager.ToolDataTableManager( app )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
57 target_dir, tool_path, relative_target_dir = tdtm.get_target_install_dir( tool_shed_repository )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
58 # Dynamically add this data table
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
59 log.debug( "Attempting to dynamically create a missing Tool Data Table named %s." % data_table_name )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
60 repo_info = tdtm.generate_repository_info_elem_from_repository( tool_shed_repository, parent_elem=None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
61 if repo_info is not None:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
62 repo_info = tostring( repo_info )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
63 tmp_file = tempfile.NamedTemporaryFile()
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
64 tmp_file.write( __get_new_xml_definition( app, data_table, data_manager, repo_info, target_dir ) )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
65 tmp_file.flush()
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
66 app.tool_data_tables.add_new_entries_from_config_file( tmp_file.name, None, app.config.shed_tool_data_table_config, persist=True )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
67 tmp_file.close()
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
68
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
69
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
70 def __get_new_xml_definition( app, data_table, data_manager, repo_info=None, location_file_dir=None ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
71 sub_dict = { 'table_name': data_table.name, 'comment_char': '', 'columns': '', 'file_path': '' }
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
72 sub_dict.update( data_manager.get_tool_shed_repository_info_dict() )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
73 if data_table.comment_char:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
74 sub_dict['comment_char'] = 'comment_char="%s"' % ( data_table.comment_char )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
75 for i, name in enumerate( data_table.get_column_name_list() ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
76 if name is not None:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
77 sub_dict['columns'] = "%s\n%s" % ( sub_dict['columns'], '<column name="%s" index="%s" />' % ( name, i ) )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
78 location_file_dir = location_file_dir or app.config.galaxy_data_manager_data_path
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
79 for filename in data_table.filenames.keys():
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
80 sub_dict['file_path'] = os.path.basename( filename )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
81 sub_dict['file_path'] = os.path.join( location_file_dir, sub_dict['file_path'] ) # os.path.abspath?
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
82 if not os.path.exists( sub_dict['file_path'] ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
83 # Create empty file
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
84 log.debug( "Attempting to create a missing location file %s." % sub_dict['file_path'] )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
85 open( sub_dict['file_path'], 'wb+' ).close()
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
86 break
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
87 sub_dict[ 'repo_info' ] = repo_info or ''
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
88 return """
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
89 <tables><table name="%(table_name)s" %(comment_char)s>
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
90 %(columns)s
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
91 <file path="%(file_path)s" />
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
92 %(repo_info)s
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
93 </table></tables>
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
94 """ % sub_dict
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
95
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
96
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
97 def galaxy_code_get_available_data_tables( trans ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
98 # list of data tables
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
99 return [ ( x, x, False ) for x in trans.app.tool_data_tables.get_tables().keys() ]
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
100
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
101
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
102 def galaxy_code_get_available_data_table_columns( trans, data_table_name ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
103 return [ ( x, x, True ) for x in trans.app.tool_data_tables.get( data_table_name ).get_column_name_list() ]
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
104 # --- End Galaxy called Methods ---
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
105
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
106
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
107 def get_data_table_entries( params, galaxy_data_manager_data_path ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
108 rval = {}
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
109 data_tables = params.get( 'data_tables', [] )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
110 for data_table in data_tables:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
111 entry_dict = {}
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
112 for column in data_table.get( 'columns', [] ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
113 value = column.get( 'data_table_column_value', '' )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
114 if column.get( 'is_path', {} ).get( 'is_path_selector', None ) == 'yes' and column.get( 'is_path', {} ).get( 'abspath', None ) == 'abspath':
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
115 value = os.path.abspath( os.path.join( galaxy_data_manager_data_path, value ) )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
116 entry_dict[ column.get( 'data_table_column_name', '' ) ] = value
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
117 data_table_name = data_table['data_table_name']
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
118 rval[ data_table_name ] = rval.get( data_table_name, [] )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
119 rval[ data_table_name ].append( entry_dict )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
120 return rval
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
121
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
122
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
123 def get_file_content( params, target_directory ):
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
124 directory_content = params.get( 'directory_content', [] )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
125 for content in directory_content:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
126 target_path = os.path.join( target_directory, content.get( 'subdir', '' ) )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
127 try:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
128 os.makedirs( target_path )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
129 except OSError:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
130 pass
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
131 if content.get( 'file_source', {}).get( 'file_source_selector', None ) == 'URL':
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
132 ( filename, headers ) = urlretrieve( content.get( 'file_source', {}).get( 'file_URL', None ) )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
133 try:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
134 bname = headers['Content-Disposition']
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
135 except KeyError:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
136 bname = os.path.basename( urllib2.urlparse.urlsplit( content.get( 'file_source', {}).get( 'file_URL', None ) ).path )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
137 else:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
138 filename = content.get( 'file_source', {}).get( 'file_history', None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
139 bname = os.path.basename( filename )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
140 file_action = content.get( 'file_action', {}).get( 'file_action_selector', None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
141 if file_action == 'unpack':
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
142 unpack_archive( filename, target_path )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
143 else:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
144 filename_override = content.get( 'file_action', {}).get( 'filename_override', None )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
145 if filename_override:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
146 target_path = os.path.join( target_path, filename_override )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
147 else:
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
148 target_path = os.path.join( target_path, bname )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
149 shutil.copyfile( filename, target_path )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
150 return len( directory_content )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
151
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
152
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
153 def main():
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
154 parser = optparse.OptionParser()
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
155 parser.add_option( '', '--galaxy_data_manager_data_path', dest='galaxy_data_manager_data_path', default='', help='Root path for galaxy_data_manager_data_path' )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
156 (options, args) = parser.parse_args()
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
157
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
158 filename = args[0]
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
159
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
160 params = json.loads( open( filename ).read() )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
161 target_directory = params[ 'output_data' ][0]['extra_files_path']
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
162
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
163 data_table_entries = get_data_table_entries( params['param_dict'], options.galaxy_data_manager_data_path )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
164
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
165 # save info to json file
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
166 open( filename, 'wb' ).write( json.dumps( { "data_tables": data_table_entries} ) )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
167
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
168 get_file_content( params['param_dict'], target_directory )
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
169
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
170
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
171 if __name__ == "__main__":
81ed42c0721a planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_manual commit 9f2cdfc1302dce000f9a86d13d4af204cf1dc89d
iuc
parents:
diff changeset
172 main()