|
20 | 20 | from planemo.io import write_file |
21 | 21 | from planemo.io import kill_pid_file |
22 | 22 | from planemo import git |
| 23 | +from planemo.shed import tool_shed_url |
23 | 24 | from planemo.bioblend import ( |
24 | 25 | galaxy, |
25 | 26 | ensure_module, |
|
73 | 74 | </dependency_resolvers> |
74 | 75 | """ |
75 | 76 |
|
| 77 | +TOOL_SHEDS_CONF = """<tool_sheds> |
| 78 | + <tool_shed name="Target Shed" url="${shed_target_url}" /> |
| 79 | +</tool_sheds> |
| 80 | +""" |
| 81 | + |
76 | 82 | # Provide some shortcuts for simple/common dependency resolutions strategies. |
77 | 83 | STOCK_DEPENDENCY_RESOLUTION_STRATEGIES = { |
78 | 84 | "brew_dependency_resolution": BREW_DEPENDENCY_RESOLUTION_CONF, |
@@ -128,6 +134,9 @@ def config_join(*args): |
128 | 134 | tool_conf = config_join("tool_conf.xml") |
129 | 135 | database_location = config_join("galaxy.sqlite") |
130 | 136 | shed_tools_path = config_join("shed_tools") |
| 137 | + sheds_config_path = _configure_sheds_config_file( |
| 138 | + config_directory, **kwds |
| 139 | + ) |
131 | 140 | preseeded_database = True |
132 | 141 | master_api_key = kwds.get("master_api_key", "test_key") |
133 | 142 | dependency_dir = os.path.join(config_directory, "deps") |
@@ -166,6 +175,7 @@ def config_join(*args): |
166 | 175 | file_path="${temp_directory}/files", |
167 | 176 | new_file_path="${temp_directory}/tmp", |
168 | 177 | tool_config_file=tool_config_file, |
| 178 | + tool_sheds_config_file=sheds_config_path, |
169 | 179 | check_migrate_tools="False", |
170 | 180 | manage_dependency_relationships="False", |
171 | 181 | job_working_directory="${temp_directory}/job_working_directory", |
@@ -431,6 +441,17 @@ def _search_tool_path_for(path, target, extra_paths=[]): |
431 | 441 | return None |
432 | 442 |
|
433 | 443 |
|
| 444 | +def _configure_sheds_config_file(config_directory, **kwds): |
| 445 | + if "shed_target" not in kwds: |
| 446 | + kwds = kwds.copy() |
| 447 | + kwds["shed_target"] = "toolshed" |
| 448 | + shed_target_url = tool_shed_url(kwds) |
| 449 | + contents = _sub(TOOL_SHEDS_CONF, {"shed_target_url": shed_target_url}) |
| 450 | + tool_sheds_conf = os.path.join(config_directory, "tool_sheds_conf.xml") |
| 451 | + write_file(tool_sheds_conf, contents) |
| 452 | + return tool_sheds_conf |
| 453 | + |
| 454 | + |
434 | 455 | def _tool_conf_entry_for(tool_paths): |
435 | 456 | tool_definitions = "" |
436 | 457 | for tool_path in tool_paths: |
|
0 commit comments