mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fixes for complext repository dependency definitions that do not include a changeset_revision attribute. A fix for indenting the updates XML file is also included.
This commit is contained in:
@@ -131,7 +131,7 @@ class UploadController( BaseUIController ):
|
||||
# Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately.
|
||||
altered, root = commit_util.handle_repository_dependencies_definition( trans, uploaded_file_name )
|
||||
if altered:
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( util.xml_to_string( root, pretty=True ) )
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( root )
|
||||
shutil.move( tmp_filename, full_path )
|
||||
else:
|
||||
shutil.move( uploaded_file_name, full_path )
|
||||
@@ -140,7 +140,7 @@ class UploadController( BaseUIController ):
|
||||
# are missing and if so, set them appropriately.
|
||||
altered, root = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name )
|
||||
if altered:
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( util.xml_to_string( root, pretty=True ) )
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( root )
|
||||
shutil.move( tmp_filename, full_path )
|
||||
else:
|
||||
shutil.move( uploaded_file_name, full_path )
|
||||
@@ -268,13 +268,13 @@ class UploadController( BaseUIController ):
|
||||
# Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately.
|
||||
altered, root = commit_util.handle_repository_dependencies_definition( trans, uploaded_file_name )
|
||||
if altered:
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( util.xml_to_string( root, pretty=True ) )
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( root )
|
||||
shutil.move( tmp_filename, uploaded_file_name )
|
||||
elif os.path.split( uploaded_file_name )[ -1 ] == 'tool_dependencies.xml':
|
||||
# Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately.
|
||||
altered, root = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name )
|
||||
if altered:
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( util.xml_to_string( root, pretty=True ) )
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( root )
|
||||
shutil.move( tmp_filename, uploaded_file_name )
|
||||
if ok:
|
||||
repo_path = os.path.join( full_path, relative_path )
|
||||
@@ -330,13 +330,13 @@ class UploadController( BaseUIController ):
|
||||
# Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately.
|
||||
altered, root = commit_util.handle_repository_dependencies_definition( trans, uploaded_file_name )
|
||||
if altered:
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( util.xml_to_string( root, pretty=True ) )
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( root )
|
||||
shutil.move( tmp_filename, uploaded_file_name )
|
||||
elif os.path.split( uploaded_file_name )[ -1 ] == 'tool_dependencies.xml':
|
||||
# Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately.
|
||||
altered, root = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name )
|
||||
if altered:
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( util.xml_to_string( root, pretty=True ) )
|
||||
tmp_filename = commit_util.create_and_write_tmp_file( root )
|
||||
shutil.move( tmp_filename, uploaded_file_name )
|
||||
return commit_util.handle_directory_changes( trans,
|
||||
repository,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
import pkg_resources
|
||||
import shutil
|
||||
import tempfile
|
||||
from galaxy import util
|
||||
@@ -9,11 +10,15 @@ import tool_shed.util.shed_util_common as suc
|
||||
from tool_shed.util import tool_util
|
||||
|
||||
from galaxy import eggs
|
||||
|
||||
eggs.require( 'mercurial' )
|
||||
from mercurial import commands
|
||||
from mercurial import hg
|
||||
from mercurial import ui
|
||||
|
||||
pkg_resources.require( 'elementtree' )
|
||||
from elementtree.ElementTree import tostring
|
||||
|
||||
log = logging.getLogger( __name__ )
|
||||
|
||||
UNDESIRABLE_DIRS = [ '.hg', '.svn', '.git', '.cvs' ]
|
||||
@@ -57,13 +62,13 @@ def check_file_content_for_html_and_images( file_path ):
|
||||
message = 'The file "%s" contains image content.\n' % str( file_path )
|
||||
return message
|
||||
|
||||
def create_and_write_tmp_file( text ):
|
||||
def create_and_write_tmp_file( root ):
|
||||
fh = tempfile.NamedTemporaryFile( 'wb' )
|
||||
tmp_filename = fh.name
|
||||
fh.close()
|
||||
fh = open( tmp_filename, 'wb' )
|
||||
fh.write( '<?xml version="1.0"?>\n' )
|
||||
fh.write( text )
|
||||
fh.write( tostring( root, 'utf-8' ) )
|
||||
fh.close()
|
||||
return tmp_filename
|
||||
|
||||
@@ -255,7 +260,6 @@ def handle_tool_dependencies_definition( trans, tool_dependencies_config ):
|
||||
package_altered = True
|
||||
if not altered:
|
||||
altered = True
|
||||
|
||||
elif package_elem.tag == 'install':
|
||||
# <install version="1.0">
|
||||
for actions_index, actions_elem in enumerate( package_elem ):
|
||||
@@ -277,8 +281,9 @@ def handle_tool_dependencies_definition( trans, tool_dependencies_config ):
|
||||
if package_altered:
|
||||
actions_elem[ action_index ] = action_elem
|
||||
if package_altered:
|
||||
root_elem[ actions_index ] = actions_elem
|
||||
|
||||
package_elem[ actions_index ] = actions_elem
|
||||
if package_altered:
|
||||
root_elem[ package_index ] = package_elem
|
||||
if package_altered:
|
||||
root[ root_index ] = root_elem
|
||||
return altered, root
|
||||
|
||||
Reference in New Issue
Block a user