commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d13c2f41bff1/ Changeset: d13c2f41bff1 Branch: next-stable User: greg Date: 2013-05-21 18:26:55 Summary: 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. Affected #: 2 files diff -r d8b3dc823978835f0b2105635990f310fa619c1c -r d13c2f41bff1a19cd996bdcf3457b070e668edae lib/galaxy/webapps/tool_shed/controllers/upload.py --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -131,7 +131,7 @@ # 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 @@ # 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 @@ # 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 @@ # 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, diff -r d8b3dc823978835f0b2105635990f310fa619c1c -r d13c2f41bff1a19cd996bdcf3457b070e668edae lib/tool_shed/util/commit_util.py --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -1,5 +1,6 @@ import logging import os +import pkg_resources import shutil import tempfile from galaxy import util @@ -9,11 +10,15 @@ 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 @@ 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 @@ 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 @@ 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 https://bitbucket.org/galaxy/galaxy-central/commits/61dd8d5c33e5/ Changeset: 61dd8d5c33e5 User: greg Date: 2013-05-21 18:27:54 Summary: Merged from next-stable Affected #: 2 files diff -r 0b9bd1fdc765d18d0831aa2ecbf419e16bbfd15b -r 61dd8d5c33e566b8ec28fb3cbd22de50226dbbd9 lib/galaxy/webapps/tool_shed/controllers/upload.py --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -131,7 +131,7 @@ # 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 @@ # 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 @@ # 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 @@ # 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, diff -r 0b9bd1fdc765d18d0831aa2ecbf419e16bbfd15b -r 61dd8d5c33e566b8ec28fb3cbd22de50226dbbd9 lib/tool_shed/util/commit_util.py --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -1,5 +1,6 @@ import logging import os +import pkg_resources import shutil import tempfile from galaxy import util @@ -9,11 +10,15 @@ 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 @@ 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 @@ 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 @@ 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 Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org