From 77353902ee7f7c06b6376537809b9b3ea700c84a Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Tue, 5 Apr 2016 13:04:44 -0400 Subject: [PATCH 1/4] Move scripts out of lib/tool_shed. --- .../api/add_repository_registry_entry.py | 0 .../tool_shed}/api/common.py | 2 +- .../tool_shed}/api/create_categories.py | 0 .../tool_shed}/api/create_users.py | 0 .../tool_shed}/api/export.py | 2 +- .../api/get_filtered_repository_revisions.py | 18 +++++++++--------- .../tool_shed}/api/import_capsule.py | 0 .../api/remove_repository_registry_entry.py | 0 .../api/reset_metadata_on_repositories.py | 0 .../tool_shed_repository_revision_update.py | 0 .../bootstrap_tool_shed/bootstrap_tool_shed.sh | 16 ++++++++-------- .../bootstrap_tool_shed/bootstrap_util.py | 2 +- .../create_user_with_api_key.py | 0 .../bootstrap_tool_shed/parse_run_sh_args.sh | 0 .../bootstrap_tool_shed/user_info.xml.sample | 0 ...empty_tool_dependency_installation_paths.py | 0 .../check_repositories_for_functional_tests.py | 0 ...empty_tool_dependency_installation_paths.py | 0 ..._tool_dependency_definition_repositories.py | 0 .../clean_up_tool_dependency_directory.py | 0 .../deprecate_repositories_without_metadata.py | 0 ...ool_dependency_installation_dir_contents.py | 0 22 files changed, 20 insertions(+), 20 deletions(-) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/add_repository_registry_entry.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/common.py (99%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/create_categories.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/create_users.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/export.py (98%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/get_filtered_repository_revisions.py (87%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/import_capsule.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/remove_repository_registry_entry.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/reset_metadata_on_repositories.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/api/tool_shed_repository_revision_update.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/bootstrap_tool_shed/bootstrap_tool_shed.sh (77%) rename {lib/tool_shed/scripts => scripts/tool_shed}/bootstrap_tool_shed/bootstrap_util.py (98%) rename {lib/tool_shed/scripts => scripts/tool_shed}/bootstrap_tool_shed/create_user_with_api_key.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/bootstrap_tool_shed/parse_run_sh_args.sh (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/bootstrap_tool_shed/user_info.xml.sample (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/check_filesystem_for_empty_tool_dependency_installation_paths.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/check_repositories_for_functional_tests.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/check_s3_for_empty_tool_dependency_installation_paths.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/check_tool_dependency_definition_repositories.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/clean_up_tool_dependency_directory.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/deprecate_repositories_without_metadata.py (100%) rename {lib/tool_shed/scripts => scripts/tool_shed}/show_tool_dependency_installation_dir_contents.py (100%) diff --git a/lib/tool_shed/scripts/api/add_repository_registry_entry.py b/scripts/tool_shed/api/add_repository_registry_entry.py similarity index 100% rename from lib/tool_shed/scripts/api/add_repository_registry_entry.py rename to scripts/tool_shed/api/add_repository_registry_entry.py diff --git a/lib/tool_shed/scripts/api/common.py b/scripts/tool_shed/api/common.py similarity index 99% rename from lib/tool_shed/scripts/api/common.py rename to scripts/tool_shed/api/common.py index 88f7fcf2e94..d3102cdf5f5 100644 --- a/lib/tool_shed/scripts/api/common.py +++ b/scripts/tool_shed/api/common.py @@ -4,7 +4,7 @@ import sys import urllib import urllib2 -sys.path.insert(1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir ) ) +sys.path.insert( 1, 'lib' ) from tool_shed.util import hg_util from galaxy import util diff --git a/lib/tool_shed/scripts/api/create_categories.py b/scripts/tool_shed/api/create_categories.py similarity index 100% rename from lib/tool_shed/scripts/api/create_categories.py rename to scripts/tool_shed/api/create_categories.py diff --git a/lib/tool_shed/scripts/api/create_users.py b/scripts/tool_shed/api/create_users.py similarity index 100% rename from lib/tool_shed/scripts/api/create_users.py rename to scripts/tool_shed/api/create_users.py diff --git a/lib/tool_shed/scripts/api/export.py b/scripts/tool_shed/api/export.py similarity index 98% rename from lib/tool_shed/scripts/api/export.py rename to scripts/tool_shed/api/export.py index f60bc5497b0..b9286c41460 100644 --- a/lib/tool_shed/scripts/api/export.py +++ b/scripts/tool_shed/api/export.py @@ -13,7 +13,7 @@ import sys import tempfile import urllib2 -sys.path.insert(1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir ) ) +sys.path.insert( 1, 'lib' ) from tool_shed.util import basic_util from common import display, submit diff --git a/lib/tool_shed/scripts/api/get_filtered_repository_revisions.py b/scripts/tool_shed/api/get_filtered_repository_revisions.py similarity index 87% rename from lib/tool_shed/scripts/api/get_filtered_repository_revisions.py rename to scripts/tool_shed/api/get_filtered_repository_revisions.py index b47bbdc6ba9..909c66c7c50 100644 --- a/lib/tool_shed/scripts/api/get_filtered_repository_revisions.py +++ b/scripts/tool_shed/api/get_filtered_repository_revisions.py @@ -25,7 +25,7 @@ import os import sys import urllib -sys.path.insert(1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir ) ) +sys.path.insert( 1, 'lib' ) from galaxy.util import asbool from tool_shed.util import hg_util @@ -44,14 +44,14 @@ def main( options ): test_install_error = str( options.test_install_error ) tools_functionally_correct = str( options.tools_functionally_correct ) parts = [ 'repository_revisions' ] - params = urllib.urlencode( dict( do_not_test=do_not_test, - downloadable=downloadable, - includes_tools=includes_tools, - malicious=malicious, - missing_test_components=missing_test_components, - skip_tool_test=skip_tool_test, - test_install_error=test_install_error, - tools_functionally_correct=tools_functionally_correct ) ) + params = dict( do_not_test=do_not_test, + downloadable=downloadable, + includes_tools=includes_tools, + malicious=malicious, + missing_test_components=missing_test_components, + skip_tool_test=skip_tool_test, + test_install_error=test_install_error, + tools_functionally_correct=tools_functionally_correct ) api_url = get_api_url( base=base_tool_shed_url, parts=parts, params=params ) baseline_repository_dicts, error_message = json_from_url( api_url ) if baseline_repository_dicts is None or error_message: diff --git a/lib/tool_shed/scripts/api/import_capsule.py b/scripts/tool_shed/api/import_capsule.py similarity index 100% rename from lib/tool_shed/scripts/api/import_capsule.py rename to scripts/tool_shed/api/import_capsule.py diff --git a/lib/tool_shed/scripts/api/remove_repository_registry_entry.py b/scripts/tool_shed/api/remove_repository_registry_entry.py similarity index 100% rename from lib/tool_shed/scripts/api/remove_repository_registry_entry.py rename to scripts/tool_shed/api/remove_repository_registry_entry.py diff --git a/lib/tool_shed/scripts/api/reset_metadata_on_repositories.py b/scripts/tool_shed/api/reset_metadata_on_repositories.py similarity index 100% rename from lib/tool_shed/scripts/api/reset_metadata_on_repositories.py rename to scripts/tool_shed/api/reset_metadata_on_repositories.py diff --git a/lib/tool_shed/scripts/api/tool_shed_repository_revision_update.py b/scripts/tool_shed/api/tool_shed_repository_revision_update.py similarity index 100% rename from lib/tool_shed/scripts/api/tool_shed_repository_revision_update.py rename to scripts/tool_shed/api/tool_shed_repository_revision_update.py diff --git a/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_tool_shed.sh b/scripts/tool_shed/bootstrap_tool_shed/bootstrap_tool_shed.sh similarity index 77% rename from lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_tool_shed.sh rename to scripts/tool_shed/bootstrap_tool_shed/bootstrap_tool_shed.sh index 1de9d78710f..4a7b61208e6 100755 --- a/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_tool_shed.sh +++ b/scripts/tool_shed/bootstrap_tool_shed/bootstrap_tool_shed.sh @@ -11,15 +11,15 @@ stop_err() { exit 1 } -tool_shed=`./lib/tool_shed/scripts/bootstrap_tool_shed/parse_run_sh_args.sh $@` +tool_shed=`./scripts/tool_shed/bootstrap_tool_shed/parse_run_sh_args.sh $@` if [ $? -ne 0 ] ; then exit 0 fi -log_file="lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap.log" +log_file="scripts/tool_shed/bootstrap_tool_shed/bootstrap.log" -database_result=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute check_db --config_file ${TOOL_SHED_CONFIG_FILE}` +database_result=`python ./scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py --execute check_db --config_file ${TOOL_SHED_CONFIG_FILE}` if [ $? -ne 0 ] ; then stop_err "Unable to bootstrap tool shed. $database_result" @@ -36,8 +36,8 @@ else fi if [ $? -eq 0 ] ; then - user_auth=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute admin_user_info --config_file ${TOOL_SHED_CONFIG_FILE}` - local_shed_url=`python ./lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py --execute get_url --config_file ${TOOL_SHED_CONFIG_FILE}` + user_auth=`python ./scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py --execute admin_user_info --config_file ${TOOL_SHED_CONFIG_FILE}` + local_shed_url=`python ./scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py --execute get_url --config_file ${TOOL_SHED_CONFIG_FILE}` fi admin_user_name=`echo $user_auth | awk 'BEGIN { FS="__SEP__" } ; { print \$1 }'` @@ -46,7 +46,7 @@ admin_user_password=`echo $user_auth | awk 'BEGIN { FS="__SEP__" } ; { print \$3 echo -n "Creating user '$admin_user_name' with email address '$admin_user_email'..." -python ./lib/tool_shed/scripts/bootstrap_tool_shed/create_user_with_api_key.py -c ${TOOL_SHED_CONFIG_FILE} >> $log_file +python ./scripts/tool_shed/bootstrap_tool_shed/create_user_with_api_key.py -c ${TOOL_SHED_CONFIG_FILE} >> $log_file echo " done." @@ -94,10 +94,10 @@ echo " done." if [ $? -eq 0 ] ; then echo -n "Creating users... " - python lib/tool_shed/scripts/api/create_users.py -a $api_key -f $tool_shed -t $local_shed_url >> $log_file + python scripts/tool_shed/api/create_users.py -a $api_key -f $tool_shed -t $local_shed_url >> $log_file echo "done." echo -n "Creating categories... " - python lib/tool_shed/scripts/api/create_categories.py -a $api_key -f $tool_shed -t $local_shed_url >> $log_file + python scripts/tool_shed/api/create_categories.py -a $api_key -f $tool_shed -t $local_shed_url >> $log_file echo "done." else stop_err "Error getting API key from local tool shed." diff --git a/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py b/scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py similarity index 98% rename from lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py rename to scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py index e49c7a06bc5..61d3edf8e5e 100755 --- a/lib/tool_shed/scripts/bootstrap_tool_shed/bootstrap_util.py +++ b/scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py @@ -69,7 +69,7 @@ def check_db( config_parser ): def admin_user_info( ): - user_info_config = os.path.abspath( os.path.join( os.getcwd(), 'lib/tool_shed/scripts/bootstrap_tool_shed', 'user_info.xml' ) ) + user_info_config = os.path.abspath( os.path.join( os.getcwd(), 'scripts/tool_shed/bootstrap_tool_shed', 'user_info.xml' ) ) tree, error_message = xml_util.parse_xml( user_info_config ) username = None email = None diff --git a/lib/tool_shed/scripts/bootstrap_tool_shed/create_user_with_api_key.py b/scripts/tool_shed/bootstrap_tool_shed/create_user_with_api_key.py similarity index 100% rename from lib/tool_shed/scripts/bootstrap_tool_shed/create_user_with_api_key.py rename to scripts/tool_shed/bootstrap_tool_shed/create_user_with_api_key.py diff --git a/lib/tool_shed/scripts/bootstrap_tool_shed/parse_run_sh_args.sh b/scripts/tool_shed/bootstrap_tool_shed/parse_run_sh_args.sh similarity index 100% rename from lib/tool_shed/scripts/bootstrap_tool_shed/parse_run_sh_args.sh rename to scripts/tool_shed/bootstrap_tool_shed/parse_run_sh_args.sh diff --git a/lib/tool_shed/scripts/bootstrap_tool_shed/user_info.xml.sample b/scripts/tool_shed/bootstrap_tool_shed/user_info.xml.sample similarity index 100% rename from lib/tool_shed/scripts/bootstrap_tool_shed/user_info.xml.sample rename to scripts/tool_shed/bootstrap_tool_shed/user_info.xml.sample diff --git a/lib/tool_shed/scripts/check_filesystem_for_empty_tool_dependency_installation_paths.py b/scripts/tool_shed/check_filesystem_for_empty_tool_dependency_installation_paths.py similarity index 100% rename from lib/tool_shed/scripts/check_filesystem_for_empty_tool_dependency_installation_paths.py rename to scripts/tool_shed/check_filesystem_for_empty_tool_dependency_installation_paths.py diff --git a/lib/tool_shed/scripts/check_repositories_for_functional_tests.py b/scripts/tool_shed/check_repositories_for_functional_tests.py similarity index 100% rename from lib/tool_shed/scripts/check_repositories_for_functional_tests.py rename to scripts/tool_shed/check_repositories_for_functional_tests.py diff --git a/lib/tool_shed/scripts/check_s3_for_empty_tool_dependency_installation_paths.py b/scripts/tool_shed/check_s3_for_empty_tool_dependency_installation_paths.py similarity index 100% rename from lib/tool_shed/scripts/check_s3_for_empty_tool_dependency_installation_paths.py rename to scripts/tool_shed/check_s3_for_empty_tool_dependency_installation_paths.py diff --git a/lib/tool_shed/scripts/check_tool_dependency_definition_repositories.py b/scripts/tool_shed/check_tool_dependency_definition_repositories.py similarity index 100% rename from lib/tool_shed/scripts/check_tool_dependency_definition_repositories.py rename to scripts/tool_shed/check_tool_dependency_definition_repositories.py diff --git a/lib/tool_shed/scripts/clean_up_tool_dependency_directory.py b/scripts/tool_shed/clean_up_tool_dependency_directory.py similarity index 100% rename from lib/tool_shed/scripts/clean_up_tool_dependency_directory.py rename to scripts/tool_shed/clean_up_tool_dependency_directory.py diff --git a/lib/tool_shed/scripts/deprecate_repositories_without_metadata.py b/scripts/tool_shed/deprecate_repositories_without_metadata.py similarity index 100% rename from lib/tool_shed/scripts/deprecate_repositories_without_metadata.py rename to scripts/tool_shed/deprecate_repositories_without_metadata.py diff --git a/lib/tool_shed/scripts/show_tool_dependency_installation_dir_contents.py b/scripts/tool_shed/show_tool_dependency_installation_dir_contents.py similarity index 100% rename from lib/tool_shed/scripts/show_tool_dependency_installation_dir_contents.py rename to scripts/tool_shed/show_tool_dependency_installation_dir_contents.py From 9bf3976e8a267d3f3d462c9d8f2798f9834024bb Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Tue, 5 Apr 2016 13:50:51 -0400 Subject: [PATCH 2/4] Fix sys.path.insert --- scripts/tool_shed/api/common.py | 2 +- scripts/tool_shed/api/export.py | 2 +- scripts/tool_shed/api/get_filtered_repository_revisions.py | 2 +- scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/tool_shed/api/common.py b/scripts/tool_shed/api/common.py index d3102cdf5f5..1b249149eff 100644 --- a/scripts/tool_shed/api/common.py +++ b/scripts/tool_shed/api/common.py @@ -4,7 +4,7 @@ import sys import urllib import urllib2 -sys.path.insert( 1, 'lib' ) +sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir, 'lib' ) ) from tool_shed.util import hg_util from galaxy import util diff --git a/scripts/tool_shed/api/export.py b/scripts/tool_shed/api/export.py index b9286c41460..5773354558d 100644 --- a/scripts/tool_shed/api/export.py +++ b/scripts/tool_shed/api/export.py @@ -13,7 +13,7 @@ import sys import tempfile import urllib2 -sys.path.insert( 1, 'lib' ) +sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir, 'lib' ) ) from tool_shed.util import basic_util from common import display, submit diff --git a/scripts/tool_shed/api/get_filtered_repository_revisions.py b/scripts/tool_shed/api/get_filtered_repository_revisions.py index 909c66c7c50..bba495427a1 100644 --- a/scripts/tool_shed/api/get_filtered_repository_revisions.py +++ b/scripts/tool_shed/api/get_filtered_repository_revisions.py @@ -25,7 +25,7 @@ import os import sys import urllib -sys.path.insert( 1, 'lib' ) +sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir, 'lib' ) ) from galaxy.util import asbool from tool_shed.util import hg_util diff --git a/scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py b/scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py index 61d3edf8e5e..980873e2df8 100755 --- a/scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py +++ b/scripts/tool_shed/bootstrap_tool_shed/bootstrap_util.py @@ -4,7 +4,7 @@ import ConfigParser import os import sys -sys.path.insert(1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir ) ) +sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir, 'lib' ) ) from sqlalchemy.exc import OperationalError, ProgrammingError From 9f1490cc60d993f9ac3907bdf53c0a65e7cbeadf Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Tue, 5 Apr 2016 13:55:21 -0400 Subject: [PATCH 3/4] Fix sys.path.insert some more. --- .../tool_shed/bootstrap_tool_shed/create_user_with_api_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tool_shed/bootstrap_tool_shed/create_user_with_api_key.py b/scripts/tool_shed/bootstrap_tool_shed/create_user_with_api_key.py index 231ad1074c1..d431307ba67 100644 --- a/scripts/tool_shed/bootstrap_tool_shed/create_user_with_api_key.py +++ b/scripts/tool_shed/bootstrap_tool_shed/create_user_with_api_key.py @@ -7,7 +7,7 @@ import re import sys import optparse -sys.path.insert(1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir ) ) +sys.path.insert(1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir, 'lib' ) ) sys.path.insert(1, os.path.join( os.path.dirname( __file__ ) ) ) import galaxy.webapps.tool_shed.config as tool_shed_config From fbf8cfce2a89dd1c199bb757a55dfabeca9f9b7e Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Tue, 5 Apr 2016 14:23:56 -0400 Subject: [PATCH 4/4] Remove unused import. --- scripts/tool_shed/api/get_filtered_repository_revisions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/tool_shed/api/get_filtered_repository_revisions.py b/scripts/tool_shed/api/get_filtered_repository_revisions.py index bba495427a1..83c3ffcf4ca 100644 --- a/scripts/tool_shed/api/get_filtered_repository_revisions.py +++ b/scripts/tool_shed/api/get_filtered_repository_revisions.py @@ -23,7 +23,6 @@ Here is a working example of how to use this script. import argparse import os import sys -import urllib sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), os.pardir, os.pardir, os.pardir, 'lib' ) ) from galaxy.util import asbool