From 4cd434bee973385573a29860eb97370e96af3a08 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:03 -0500 Subject: [PATCH 01/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index b0f4c304c08..e93716ab0e1 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2575,7 +2575,7 @@ class Tool( object ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.template_macro_params.keys() if not self.options or self.options.sanitize: for key, value in param_dict.items(): if key not in skip: From e462c6bcc734213a4be5bd0638af041f5241c159 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:05 -0500 Subject: [PATCH 02/40] Update tag latest_2013.06.03 for changeset aae74ee09e46 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 9dbb3446c57..595fb8d7707 100644 --- a/.hgtags +++ b/.hgtags @@ -13,7 +13,7 @@ a4113cc1cb5eaa68091c9a73375f00555b66dd11 release_2013.01.13 9c323aad4ffdd65a3deb06a4a36f6b2c5115a60f latest_2013.01.13 b986c184be88947b5d1d90be7f36cfd2627dd938 latest_2013.02.08 dec9431d66b837a208e2f060d90afd913c721227 latest_2013.04.01 -19e56e66b0b344c6e2afa4541f6988e4fdb9af29 latest_2013.06.03 +aae74ee09e4667e270750711327c8167e1dfae05 latest_2013.06.03 cee903b8b3eee9145627ee89742555dac581791e latest_2013.08.12 7d5aa19a166cba9039e15f338a1e3fc924c43d3a latest_2013.11.04 0c000cc2f9c05bf4c1c2bc3a10215014fd64e696 latest_2014.02.10 From b954ccaa67eab6126002e59be88bc5a6cf67438c Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:13 -0500 Subject: [PATCH 03/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index c63d6cea50a..e4e4803a82f 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2585,7 +2585,7 @@ class Tool( object ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.template_macro_params.keys() if not self.options or self.options.sanitize: for key, value in param_dict.items(): if key not in skip: From 647178e174d64d946d1b42650be4057581baf2e0 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:15 -0500 Subject: [PATCH 04/40] Update tag latest_2013.08.12 for changeset db967a25c5db --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 595fb8d7707..cdde5c0243d 100644 --- a/.hgtags +++ b/.hgtags @@ -14,7 +14,7 @@ a4113cc1cb5eaa68091c9a73375f00555b66dd11 release_2013.01.13 b986c184be88947b5d1d90be7f36cfd2627dd938 latest_2013.02.08 dec9431d66b837a208e2f060d90afd913c721227 latest_2013.04.01 aae74ee09e4667e270750711327c8167e1dfae05 latest_2013.06.03 -cee903b8b3eee9145627ee89742555dac581791e latest_2013.08.12 +db967a25c5db969ee4b3e138fe2be4d979665bdf latest_2013.08.12 7d5aa19a166cba9039e15f338a1e3fc924c43d3a latest_2013.11.04 0c000cc2f9c05bf4c1c2bc3a10215014fd64e696 latest_2014.02.10 ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 From 71ebf96cba8483a91c197241b161fa61a4fe7fe8 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:18 -0500 Subject: [PATCH 05/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index f56871eb8bb..f050b7ca029 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2592,7 +2592,7 @@ class Tool( object, Dictifiable ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.template_macro_params.keys() if not self.options or self.options.sanitize: for key, value in param_dict.items(): if key not in skip: From d194b20a6e840d68f1ca8f5a05b9b5f77332a5ac Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:20 -0500 Subject: [PATCH 06/40] Update tag latest_2013.11.04 for changeset 52a18b44474f --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index cdde5c0243d..750f3305bf9 100644 --- a/.hgtags +++ b/.hgtags @@ -15,7 +15,7 @@ b986c184be88947b5d1d90be7f36cfd2627dd938 latest_2013.02.08 dec9431d66b837a208e2f060d90afd913c721227 latest_2013.04.01 aae74ee09e4667e270750711327c8167e1dfae05 latest_2013.06.03 db967a25c5db969ee4b3e138fe2be4d979665bdf latest_2013.08.12 -7d5aa19a166cba9039e15f338a1e3fc924c43d3a latest_2013.11.04 +52a18b44474f017fce92850fb3892a4f76a7374a latest_2013.11.04 0c000cc2f9c05bf4c1c2bc3a10215014fd64e696 latest_2014.02.10 ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 f3fc4602e22b39468d780b955a1a05caf867a7e9 latest_2014.08.11 From baf4b18556d6273005abbdf7021441f185160665 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:23 -0500 Subject: [PATCH 07/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index 2276fe51ac3..42e5c8a4d84 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -323,7 +323,7 @@ class ToolEvaluator( object ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.tool.template_macro_params.keys() if not self.tool or not self.tool.options or self.tool.options.sanitize: for key, value in param_dict.items(): if key not in skip: From 3b40397068eb183209dffe5578584dc7f6e1d0fc Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:25 -0500 Subject: [PATCH 08/40] Update tag latest_2014.02.10 for changeset 746db2bf4da0 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 750f3305bf9..b9db25b12ca 100644 --- a/.hgtags +++ b/.hgtags @@ -16,7 +16,7 @@ dec9431d66b837a208e2f060d90afd913c721227 latest_2013.04.01 aae74ee09e4667e270750711327c8167e1dfae05 latest_2013.06.03 db967a25c5db969ee4b3e138fe2be4d979665bdf latest_2013.08.12 52a18b44474f017fce92850fb3892a4f76a7374a latest_2013.11.04 -0c000cc2f9c05bf4c1c2bc3a10215014fd64e696 latest_2014.02.10 +746db2bf4da081a7491b5a4602aeadd2611b3b1d latest_2014.02.10 ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 f3fc4602e22b39468d780b955a1a05caf867a7e9 latest_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 From ca34200e50b838436d47a44ab33e2bb12adf6718 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:27 -0500 Subject: [PATCH 09/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index 2276fe51ac3..42e5c8a4d84 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -323,7 +323,7 @@ class ToolEvaluator( object ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.tool.template_macro_params.keys() if not self.tool or not self.tool.options or self.tool.options.sanitize: for key, value in param_dict.items(): if key not in skip: From ba7880683bdb6bac0fb868a3328665731dd71327 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:28 -0500 Subject: [PATCH 10/40] Update tag latest_2014.04.14 for changeset b2c0570f52e1 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index b9db25b12ca..75925a839e1 100644 --- a/.hgtags +++ b/.hgtags @@ -9,7 +9,7 @@ a4113cc1cb5eaa68091c9a73375f00555b66dd11 release_2013.01.13 9e53251b0b7e93b9563008a2b112f2e815a04bbc release_2014.04.14 7e257c7b10badb65772b1528cb61d58175a42e47 release_2014.06.02 9bce3f426863f8ba88062f67c7efc1836e82ee7c latest_2014.06.02 -8f9dcac033694e4cabcf5daae5cca1cfefbe967f latest_2014.04.14 +b2c0570f52e18d8661ca1d80c42867e4b036f22b latest_2014.04.14 9c323aad4ffdd65a3deb06a4a36f6b2c5115a60f latest_2013.01.13 b986c184be88947b5d1d90be7f36cfd2627dd938 latest_2013.02.08 dec9431d66b837a208e2f060d90afd913c721227 latest_2013.04.01 From cf64a220d2417dd104366d867d212ca37f256b74 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:30 -0500 Subject: [PATCH 11/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index 16720a79964..1d0475564d9 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -348,7 +348,7 @@ class ToolEvaluator( object ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.tool.template_macro_params.keys() if not self.tool or not self.tool.options or self.tool.options.sanitize: for key, value in param_dict.items(): if key not in skip: From 9dcee0218ba2620b2e865ea056469c4a93c78eb2 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:31 -0500 Subject: [PATCH 12/40] Update tag latest_2014.06.02 for changeset c52dc4c72b77 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 75925a839e1..4f8021811a3 100644 --- a/.hgtags +++ b/.hgtags @@ -8,7 +8,7 @@ a4113cc1cb5eaa68091c9a73375f00555b66dd11 release_2013.01.13 5e605ed6069fe4c5ca9875e95e91b2713499e8ca release_2014.02.10 9e53251b0b7e93b9563008a2b112f2e815a04bbc release_2014.04.14 7e257c7b10badb65772b1528cb61d58175a42e47 release_2014.06.02 -9bce3f426863f8ba88062f67c7efc1836e82ee7c latest_2014.06.02 +c52dc4c72b77e4b0849a596b6d05e4341236642a latest_2014.06.02 b2c0570f52e18d8661ca1d80c42867e4b036f22b latest_2014.04.14 9c323aad4ffdd65a3deb06a4a36f6b2c5115a60f latest_2013.01.13 b986c184be88947b5d1d90be7f36cfd2627dd938 latest_2013.02.08 From 6304c816c9c5bd1bd60bedae42aa70b98bfeb1cf Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:33 -0500 Subject: [PATCH 13/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index 16720a79964..1d0475564d9 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -348,7 +348,7 @@ class ToolEvaluator( object ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.tool.template_macro_params.keys() if not self.tool or not self.tool.options or self.tool.options.sanitize: for key, value in param_dict.items(): if key not in skip: From 88d4c63f8ffe00fdd7994455d6bacde96e542ef1 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:34 -0500 Subject: [PATCH 14/40] Update tag latest_2014.08.11 for changeset 6d6d7f8b3217 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 4f8021811a3..30523a654fc 100644 --- a/.hgtags +++ b/.hgtags @@ -18,7 +18,7 @@ db967a25c5db969ee4b3e138fe2be4d979665bdf latest_2013.08.12 52a18b44474f017fce92850fb3892a4f76a7374a latest_2013.11.04 746db2bf4da081a7491b5a4602aeadd2611b3b1d latest_2014.02.10 ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 -f3fc4602e22b39468d780b955a1a05caf867a7e9 latest_2014.08.11 +6d6d7f8b321725a21a96ce21e7d18a3a66f7b72e latest_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 9bd6f8b5b8153db752f4e61ed62f2b6c01ae4a11 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 From ed0e764320d3fd55439d0a50151f4fe5f8a89f45 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:35 -0500 Subject: [PATCH 15/40] Bugfix: Skip extra wrapping around template-style macros. --- lib/galaxy/tools/evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index 16720a79964..1d0475564d9 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -348,7 +348,7 @@ class ToolEvaluator( object ): Note: this method follows the style of the similar populate calls, in that param_dict is modified in-place. """ # chromInfo is a filename, do not sanitize it. - skip = [ 'chromInfo' ] + skip = [ 'chromInfo' ] + self.tool.template_macro_params.keys() if not self.tool or not self.tool.options or self.tool.options.sanitize: for key, value in param_dict.items(): if key not in skip: From bc713eb6eed04177efc5465a669f668469da801d Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 15 Jan 2015 16:01:36 -0500 Subject: [PATCH 16/40] Update tag latest_2014.10.06 for changeset 782fa60fc654 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 30523a654fc..f45d353ed20 100644 --- a/.hgtags +++ b/.hgtags @@ -20,6 +20,6 @@ db967a25c5db969ee4b3e138fe2be4d979665bdf latest_2013.08.12 ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 6d6d7f8b321725a21a96ce21e7d18a3a66f7b72e latest_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 -9bd6f8b5b8153db752f4e61ed62f2b6c01ae4a11 latest_2014.10.06 +782fa60fc65488aea0c618d723e9a63d42caf865 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 3b559c4b9399236ae2a76ea1f061fcd660e76ed5 latest_2015.01.13 From 9bed3041f563b823ab2c55d7c478ee17345e1e19 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 28 Jan 2015 09:00:26 -0500 Subject: [PATCH 17/40] Update tag latest_2015.01.13 for changeset 1b96d3a4ff28 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 68d98974a64..5b32e688972 100644 --- a/.hgtags +++ b/.hgtags @@ -22,4 +22,4 @@ f3fc4602e22b39468d780b955a1a05caf867a7e9 latest_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 9bd6f8b5b8153db752f4e61ed62f2b6c01ae4a11 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 -4039bfd5584aac053f686197a76ac176253e6f3d latest_2015.01.13 +1b96d3a4ff28da2bd547b65ad86c5ad5a9bbfb90 latest_2015.01.13 From 2f558e3919a90b9faa269a4211cbedd4cc937572 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 28 Jan 2015 10:38:22 -0500 Subject: [PATCH 18/40] Allow BAM's set_meta() to use samtools 1 to generate the index, if the samtools found on $PATH is samtools 1. --- lib/galaxy/datatypes/binary.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 2077131558b..b7d76cab7b6 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -240,10 +240,19 @@ class Bam( Binary ): ##$ samtools index ##Usage: samtools index [] stderr_name = tempfile.NamedTemporaryFile( prefix = "bam_index_stderr" ).name - command = 'samtools index %s %s' % ( dataset.file_name, index_file.file_name ) - proc = subprocess.Popen( args=command, shell=True, stderr=open( stderr_name, 'wb' ) ) + command = [ 'samtools', 'index', dataset.file_name, index_file.file_name ] + proc = subprocess.Popen( args=command, stderr=open( stderr_name, 'wb' ) ) exit_code = proc.wait() #Did index succeed? + if exit_code == -6: + # SIGABRT, most likely samtools 1.0+ which does not accept the index name parameter. + command = [ 'samtools', 'index', dataset.file_name ] + proc = subprocess.Popen( args=command, stderr=open( stderr_name, 'wb' ) ) + exit_code = proc.wait() + if os.path.exists( os.path.join( dataset.file_name, '.bai' ) ): + shutil.move( os.path.join( dataset.file_name, '.bai' ), index_file.file_name ) + else: + open( stderr_name, 'ab+' ).write( 'Galaxy attempted to build the BAM index with samtools 1.0+ but failed\n') stderr = open( stderr_name ).read().strip() if stderr: if exit_code != 0: From fffdaf115450e3d9181cd547e6ba39aecd9557ca Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 28 Jan 2015 11:58:23 -0500 Subject: [PATCH 19/40] Use a symlink to the dataset in the same directory as the MetadataTempFile as the input to samtools index so there's no clobber risk. Thanks Dan. --- lib/galaxy/datatypes/binary.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index b7d76cab7b6..36e3707b00e 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -246,13 +246,18 @@ class Bam( Binary ): #Did index succeed? if exit_code == -6: # SIGABRT, most likely samtools 1.0+ which does not accept the index name parameter. - command = [ 'samtools', 'index', dataset.file_name ] - proc = subprocess.Popen( args=command, stderr=open( stderr_name, 'wb' ) ) - exit_code = proc.wait() - if os.path.exists( os.path.join( dataset.file_name, '.bai' ) ): - shutil.move( os.path.join( dataset.file_name, '.bai' ), index_file.file_name ) - else: - open( stderr_name, 'ab+' ).write( 'Galaxy attempted to build the BAM index with samtools 1.0+ but failed\n') + dataset_symlink = os.path.join( os.path.dirname( index_file.file_name ), + '__dataset_%d_%s' % ( dataset.id, os.path.basename( index_file.file_name ) ) ) + os.symlink( dataset.file_name, dataset_symlink ) + try: + command = [ 'samtools', 'index', dataset_symlink ] + proc = subprocess.Popen( args=command, stderr=open( stderr_name, 'wb' ) ) + exit_code = proc.wait() + shutil.move( dataset_symlink + '.bai', index_file.file_name ) + except Exception, e: + open( stderr_name, 'ab+' ).write( 'Galaxy attempted to build the BAM index with samtools 1.0+ but failed: %s\n' % e) + finally: + os.unlink( dataset_symlink ) stderr = open( stderr_name ).read().strip() if stderr: if exit_code != 0: From 9252d11d269773ac039d709393d5ffd92c145464 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Wed, 28 Jan 2015 13:25:11 -0500 Subject: [PATCH 20/40] Use subprocess.call() rather than Popen(), thanks Nicola. --- lib/galaxy/datatypes/binary.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 36e3707b00e..00a27264b63 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -251,8 +251,7 @@ class Bam( Binary ): os.symlink( dataset.file_name, dataset_symlink ) try: command = [ 'samtools', 'index', dataset_symlink ] - proc = subprocess.Popen( args=command, stderr=open( stderr_name, 'wb' ) ) - exit_code = proc.wait() + exit_code = subprocess.call( args=command, stderr=open( stderr_name, 'wb' ) ) shutil.move( dataset_symlink + '.bai', index_file.file_name ) except Exception, e: open( stderr_name, 'ab+' ).write( 'Galaxy attempted to build the BAM index with samtools 1.0+ but failed: %s\n' % e) From 93d377f9d4abac6215676b3a0bbd1cf6fec1a69b Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Thu, 29 Jan 2015 09:00:24 -0500 Subject: [PATCH 21/40] Update tag latest_2015.01.13 for changeset a481d17c0448 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 5b32e688972..2ce0cb671e6 100644 --- a/.hgtags +++ b/.hgtags @@ -22,4 +22,4 @@ f3fc4602e22b39468d780b955a1a05caf867a7e9 latest_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 9bd6f8b5b8153db752f4e61ed62f2b6c01ae4a11 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 -1b96d3a4ff28da2bd547b65ad86c5ad5a9bbfb90 latest_2015.01.13 +a481d17c04482b069e6b2ebdda4fbca01448fa9c latest_2015.01.13 From 9e18e1ab7269547dd9f12dcd7e713e47df27f5d8 Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Thu, 29 Jan 2015 11:23:35 -0500 Subject: [PATCH 22/40] Set time to epoch instead of throwing server error if repository_metadata.time_last_tested is unset. --- lib/galaxy/webapps/tool_shed/controllers/repository.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/tool_shed/controllers/repository.py b/lib/galaxy/webapps/tool_shed/controllers/repository.py index 9d8bc5ab660..b6bea464e23 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -1690,7 +1690,10 @@ class RepositoryController( BaseUIController, ratings_util.ItemRatings ): description_lines = [] # Per the RSS 2.0 specification, all dates in RSS feeds must be formatted as specified in RFC 822 # section 5.1, e.g. Sat, 07 Sep 2002 00:00:01 UT - time_tested = repository_metadata.time_last_tested.strftime( '%a, %d %b %Y %H:%M:%S UT' ) + if repository_metadata.time_last_tested is None: + time_tested = 'Thu, 01 Jan 1970 00:00:00 UT' + else: + time_tested = repository_metadata.time_last_tested.strftime( '%a, %d %b %Y %H:%M:%S UT' ) # Generate a citable URL for this repository with owner and changeset revision. repository_citable_url = common_util.url_join( tool_shed_url, 'view', From 9c538ee4eb0941c58dd2939fd4c5d8fc93b6fc16 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 30 Jan 2015 13:00:22 -0500 Subject: [PATCH 23/40] Update tag latest_2015.01.13 for changeset c5e7535b4d22 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 2ce0cb671e6..42d948c5569 100644 --- a/.hgtags +++ b/.hgtags @@ -22,4 +22,4 @@ f3fc4602e22b39468d780b955a1a05caf867a7e9 latest_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 9bd6f8b5b8153db752f4e61ed62f2b6c01ae4a11 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 -a481d17c04482b069e6b2ebdda4fbca01448fa9c latest_2015.01.13 +c5e7535b4d229dbbe52d48ea35a27ab601205b7b latest_2015.01.13 From 57ae0139bb71cd4601253ea9b646092a379e294b Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Mon, 2 Feb 2015 14:00:23 -0500 Subject: [PATCH 24/40] Update tag latest_2015.01.13 for changeset fd75aaee91cf --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index c14f18d388f..7d342abc9f2 100644 --- a/.hgtags +++ b/.hgtags @@ -22,4 +22,4 @@ ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 782fa60fc65488aea0c618d723e9a63d42caf865 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 -c5e7535b4d229dbbe52d48ea35a27ab601205b7b latest_2015.01.13 +fd75aaee91cf3e8a0916689dfea72e0c752c447c latest_2015.01.13 From 48f77dc742acf01ddbafafcc4634e69378f1f020 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Mon, 2 Feb 2015 16:21:00 -0500 Subject: [PATCH 25/40] Fix for preventing non-admins from running data managers via the api. --- lib/galaxy/tools/__init__.py | 19 +++++++++++++++++++ lib/galaxy/tools/actions/__init__.py | 1 + lib/galaxy/webapps/galaxy/api/tools.py | 12 ++++++------ .../webapps/galaxy/controllers/tool_runner.py | 4 +++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 7785144f860..69292cc8f92 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1388,6 +1388,12 @@ class Tool( object, Dictifiable ): return section_id, section_name return None, None + def allow_user_access( self, user ): + """ + :returns: bool -- Whether the user is allowed to access the tool. + """ + return True + def parse( self, root, guid=None ): """ Read tool configuration from the element `root` and fill in `self`. @@ -3392,6 +3398,7 @@ class DataManagerTool( OutputParameterJSONTool ): self.data_manager_id = self.id def exec_after_process( self, app, inp_data, out_data, param_dict, job=None, **kwds ): + assert self.allow_user_access( job.user ), "You must be an admin to access this tool." #run original exec_after_process super( DataManagerTool, self ).exec_after_process( app, inp_data, out_data, param_dict, job=job, **kwds ) #process results of tool @@ -3415,6 +3422,7 @@ class DataManagerTool( OutputParameterJSONTool ): return history user = trans.user assert user, 'You must be logged in to use this tool.' + assert self.allow_user_access( user ), "You must be an admin to access this tool." history = user.data_manager_histories if not history: #create @@ -3434,6 +3442,17 @@ class DataManagerTool( OutputParameterJSONTool ): history = None return history + def allow_user_access( self, user ): + """ + :returns: bool -- Whether the user is allowed to access the tool. + Data Manager tools are only accessible to admins. + """ + if super( DataManagerTool, self ).allow_user_access( user ) and self.app.config.is_admin_user( user ): + return True + if user: + user = user.id + log.debug( "User (%s) attempted to access a data manager tool (%s), but is not an admin.", user, self.id ) + return False # Populate tool_type to ToolClass mappings tool_types = {} diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index e15a76cab79..8fab8964a90 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -155,6 +155,7 @@ class DefaultToolAction( object ): submitting the job to the job queue. If history is not specified, use trans.history as destination for tool's output datasets. """ + assert tool.allow_user_access( trans.user ), "User (%s) is not allowed to access this tool." % ( trans.user ) # Set history. if not history: history = tool.get_default_history_by_trans( trans, create=True ) diff --git a/lib/galaxy/webapps/galaxy/api/tools.py b/lib/galaxy/webapps/galaxy/api/tools.py index 2d2fc535323..4b48a4bd390 100644 --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -63,7 +63,7 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin, UsesHistoryMix """ io_details = util.string_as_bool( kwd.get( 'io_details', False ) ) link_details = util.string_as_bool( kwd.get( 'link_details', False ) ) - tool = self._get_tool( id ) + tool = self._get_tool( id, user=trans.user ) return tool.to_dict( trans, io_details=io_details, link_details=link_details ) @_future_expose_api_anonymous @@ -89,7 +89,7 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin, UsesHistoryMix @_future_expose_api_anonymous def citations( self, trans, id, **kwds ): - tool = self._get_tool( id ) + tool = self._get_tool( id, user=trans.user ) rval = [] for citation in tool.citations: rval.append( citation.to_dict( 'bibtex' ) ) @@ -122,7 +122,7 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin, UsesHistoryMix # Get tool. tool = trans.app.toolbox.get_tool( payload[ 'tool_id' ] ) if 'tool_id' in payload else None - if not tool: + if not tool or not tool.allow_user_access( trans.user ): trans.response.status = 404 return { "message": { "type": "error", "text" : trans.app.model.Dataset.conversion_messages.NO_TOOL } } @@ -212,10 +212,10 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin, UsesHistoryMix # # -- Helper methods -- # - def _get_tool( self, id ): + def _get_tool( self, id, user=None ): id = urllib.unquote_plus( id ) tool = self.app.toolbox.get_tool( id ) - if not tool: + if not tool or not tool.allow_user_access( user ): raise exceptions.ObjectNotFound("Could not find tool with id '%s'" % id) return tool @@ -281,7 +281,7 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin, UsesHistoryMix # original_job = self.get_hda_job( original_dataset ) tool = trans.app.toolbox.get_tool( original_job.tool_id ) - if not tool: + if not tool or not tool.allow_user_access( trans.user ): return trans.app.model.Dataset.conversion_messages.NO_TOOL tool_params = dict( [ ( p.name, p.value ) for p in original_job.parameters ] ) diff --git a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py index c2dd91e43e6..c453bbf6d87 100644 --- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py +++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py @@ -65,7 +65,7 @@ class ToolRunner( BaseUIController ): get_loaded_tools_by_lineage=False, set_selected=refreshed_on_change ) # No tool matching the tool id, display an error (shouldn't happen) - if not tool: + if not tool or not tool.allow_user_access( trans.user ): log.error( "index called with tool id '%s' but no such tool exists", tool_id ) trans.log_event( "Tool id '%s' does not exist" % tool_id ) trans.response.status = 404 @@ -191,6 +191,8 @@ class ToolRunner( BaseUIController ): # This is expected so not an exception. tool_id_version_message = '' error( "This dataset was created by an obsolete tool (%s). Can't re-run." % tool_id ) + if not tool.allow_user_access( trans.user ): + error( "The requested tool is unknown." ) # Can't rerun upload, external data sources, et cetera. Workflow compatible will proxy this for now if not tool.is_workflow_compatible: error( "The '%s' tool does not currently support rerunning." % tool.name ) From accd6f0810fed2a68b923c3bd98c8122e24721e6 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Tue, 3 Feb 2015 09:00:27 -0500 Subject: [PATCH 26/40] Update tag latest_2015.01.13 for changeset 5e4060f5ac7a --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 7d342abc9f2..7d637d8b197 100644 --- a/.hgtags +++ b/.hgtags @@ -22,4 +22,4 @@ ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 782fa60fc65488aea0c618d723e9a63d42caf865 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 -fd75aaee91cf3e8a0916689dfea72e0c752c447c latest_2015.01.13 +5e4060f5ac7a3c11d4681bc80f94c620df9d0479 latest_2015.01.13 From 51153c3d66bdc628048f51c55b26278d6be198f1 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 5 Feb 2015 12:14:01 -0500 Subject: [PATCH 27/40] Workflow scheduling delay fix. There were problems if all three of these conditions were met - 1) workflow from GUI, 2) workflow evaluation delayed, and 3) a delayed step was connected to a input dataset. This fixes these workflows. --- lib/galaxy/model/__init__.py | 21 +++++++++++++++++++++ lib/galaxy/workflow/modules.py | 5 +++++ lib/galaxy/workflow/run_request.py | 12 +----------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index c4bfd5523ef..6b9a446ae1e 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3202,6 +3202,27 @@ class WorkflowInvocation( object, Dictifiable ): def update( self ): self.update_time = galaxy.model.orm.now.now() + def add_input( self, content, step_id ): + if content.history_content_type == "dataset": + request_to_content = WorkflowRequestToInputDatasetAssociation() + request_to_content.dataset = content + request_to_content.workflow_step_id = step_id + self.input_datasets.append( request_to_content ) + else: + request_to_content = WorkflowRequestToInputDatasetCollectionAssociation() + request_to_content.dataset_collection = content + request_to_content.workflow_step_id = step_id + self.input_dataset_collections.append( request_to_content ) + + def has_input_for_step( self, step_id ): + for content in self.input_datasets: + if content.workflow_step_id == step_id: + return True + for content in self.input_dataset_collections: + if content.workflow_step_id == step_id: + return True + return False + class WorkflowInvocationStep( object, Dictifiable ): dict_collection_visible_keys = ( 'id', 'update_time', 'job_id', 'workflow_step_id', 'action' ) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index a0129ce93f7..d25f0023cf1 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -320,6 +320,11 @@ class InputModule( SimpleWorkflowModule ): step_outputs[ 'input_ds_copy' ] = new_hdca else: raise Exception("Unknown history content encountered") + # If coming from UI - we haven't registered invocation inputs yet, + # so do that now so dependent steps can be recalculated. In the future + # everything should come in from the API and this can be eliminated. + if not invocation.has_input_for_step( step.id ): + invocation.add_input( step_outputs.values()[ 0 ], step.id ) progress.set_outputs_for_input( step, step_outputs ) return job diff --git a/lib/galaxy/workflow/run_request.py b/lib/galaxy/workflow/run_request.py index 19adc3f97e3..83118e5f1b7 100644 --- a/lib/galaxy/workflow/run_request.py +++ b/lib/galaxy/workflow/run_request.py @@ -284,18 +284,8 @@ def workflow_run_config_to_request( trans, run_config, workflow ): value=value, type=param_types.REPLACEMENT_PARAMETERS, ) - for step_id, content in run_config.inputs.iteritems(): - if content.history_content_type == "dataset": - request_to_content = model.WorkflowRequestToInputDatasetAssociation() - request_to_content.dataset = content - request_to_content.workflow_step_id = step_id - workflow_invocation.input_datasets.append( request_to_content ) - else: - request_to_content = model.WorkflowRequestToInputDatasetCollectionAssociation() - request_to_content.dataset_collection = content - request_to_content.workflow_step_id = step_id - workflow_invocation.input_dataset_collections.append( request_to_content ) + workflow_invocation.add_input( content, step_id ) for step in workflow.steps: state = step.state From cf1632811ef3a66570331b066a6caca834ae2edd Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 5 Feb 2015 12:14:01 -0500 Subject: [PATCH 28/40] Fix scheduling_manager.py for unknown attribute reference. Not sure if this was a poor rebasing or a copy and paste error. --- lib/galaxy/workflow/scheduling_manager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/galaxy/workflow/scheduling_manager.py b/lib/galaxy/workflow/scheduling_manager.py index 28bfaaf08f6..556ee469217 100644 --- a/lib/galaxy/workflow/scheduling_manager.py +++ b/lib/galaxy/workflow/scheduling_manager.py @@ -116,7 +116,6 @@ class WorkflowSchedulingManager( object ): for plugin_element in plugins_element.getchildren(): plugin_type = plugin_element.tag plugin_kwds = dict( plugin_element.items() ) - plugin_kwds.update( self.extra_kwargs ) workflow_scheduler_id = plugin_kwds.get( 'id', None ) self.__init_plugin( plugin_type, workflow_scheduler_id, **plugin_kwds ) From d8875d27e776a05e468e3c61d80bd6166bf08a3d Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 5 Feb 2015 13:33:59 -0500 Subject: [PATCH 29/40] Bugfix for bugfix d3b1f6b. d3b1f6b fix the GUI (in an obsecure use) but broke fairly typical uses of the API. --- lib/galaxy/workflow/modules.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index d25f0023cf1..2f93a7470aa 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -324,7 +324,9 @@ class InputModule( SimpleWorkflowModule ): # so do that now so dependent steps can be recalculated. In the future # everything should come in from the API and this can be eliminated. if not invocation.has_input_for_step( step.id ): - invocation.add_input( step_outputs.values()[ 0 ], step.id ) + content = step_outputs.values()[ 0 ] + if content: + invocation.add_input( content, step.id ) progress.set_outputs_for_input( step, step_outputs ) return job From 2fbb3d67d24af43f300f26313a90e08d05782dcb Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 6 Feb 2015 09:00:23 -0500 Subject: [PATCH 30/40] Update tag latest_2015.01.13 for changeset 644deef1a578 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 7d637d8b197..206fa7f1efd 100644 --- a/.hgtags +++ b/.hgtags @@ -22,4 +22,4 @@ ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 782fa60fc65488aea0c618d723e9a63d42caf865 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 -5e4060f5ac7a3c11d4681bc80f94c620df9d0479 latest_2015.01.13 +644deef1a5789b788552a6db7f3d6fe07d81c79d latest_2015.01.13 From 8d82dfb2be3b383ae7d54132820896fd8543aeee Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 12:33:49 -0500 Subject: [PATCH 31/40] Fix for Data Tables persisting when .loc file doesn't exist. --- lib/galaxy/tools/data/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index 190a9c18fd5..2f648ac0b0c 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -495,7 +495,7 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): try: data_table_fh = open( filename, 'r+b' ) except IOError, e: - log.warning( 'Error opening data table file (%s) with r+b, assuming file does not exist and will open as wb: %s', self.filename, e ) + log.warning( 'Error opening data table file (%s) with r+b, assuming file does not exist and will open as wb: %s', filename, e ) data_table_fh = open( filename, 'wb' ) if os.stat( filename )[6] != 0: # ensure last existing line ends with new line From b7e5183ba3a39e71bbb583e08048ac18c21915fe Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 12:37:59 -0500 Subject: [PATCH 32/40] Fix for TabularToolDataTable.get_named_fields_list() when a data line has extra columns. --- lib/galaxy/tools/data/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index 2f648ac0b0c..ecff997dbfd 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -335,11 +335,13 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): def get_named_fields_list( self ): rval = [] - named_colums = self.get_column_name_list() + named_columns = self.get_column_name_list() for fields in self.get_fields(): field_dict = {} for i, field in enumerate( fields ): - field_name = named_colums[i] + if i == len( named_columns ): + break + field_name = named_columns[i] if field_name is None: field_name = i #check that this is supposed to be 0 based. field_dict[ field_name ] = field From 41fcc8ecdb348525f5cc464968702eda6cb79828 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 12:40:33 -0500 Subject: [PATCH 33/40] Fix for parsing Tool Data Table columns that are defined as individual xml elements. --- lib/galaxy/tools/data/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index ecff997dbfd..3e7ac75b65e 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -368,6 +368,7 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): self.columns[ name ] = index self.largest_index = index else: + self.largest_index = 0 for column_elem in config_element.findall( 'column' ): name = column_elem.get( 'name', None ) assert name is not None, "Required 'name' attribute missing from column def" From 58c4f261dec50aa024a27231ca2a4ce1f22ae662 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 16:50:25 -0500 Subject: [PATCH 34/40] Fix for resetting repository metadata in the toolshed via UI (pass resetting_all_metadata_on_repository=True flag). --- lib/galaxy/webapps/tool_shed/controllers/repository.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/tool_shed/controllers/repository.py b/lib/galaxy/webapps/tool_shed/controllers/repository.py index 9d8bc5ab660..56650debd36 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -2763,7 +2763,8 @@ class RepositoryController( BaseUIController, ratings_util.ItemRatings ): repository = suc.get_repository_in_tool_shed( trans.app, id ) rmm = repository_metadata_manager.RepositoryMetadataManager( app=trans.app, user=trans.user, - repository=repository ) + repository=repository, + resetting_all_metadata_on_repository=True ) rmm.reset_all_metadata_on_repository_in_tool_shed() rmm_metadata_dict = rmm.get_metadata_dict() rmm_invalid_file_tups = rmm.get_invalid_file_tups() @@ -2784,7 +2785,7 @@ class RepositoryController( BaseUIController, ratings_util.ItemRatings ): @web.expose def reset_metadata_on_my_writable_repositories_in_tool_shed( self, trans, **kwd ): - rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user ) + rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user, resetting_all_metadata_on_repository=True ) if 'reset_metadata_on_selected_repositories_button' in kwd: message, status = rmm.reset_metadata_on_selected_repositories( **kwd ) else: From 511465bc8560ab043675da3a25271c5aadeb9508 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 17:31:49 -0500 Subject: [PATCH 35/40] Always add sample file info to metadata, not only during initial creation.. --- lib/tool_shed/metadata/metadata_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tool_shed/metadata/metadata_generator.py b/lib/tool_shed/metadata/metadata_generator.py index 81d5a62bdf9..0cf1fd40dc7 100644 --- a/lib/tool_shed/metadata/metadata_generator.py +++ b/lib/tool_shed/metadata/metadata_generator.py @@ -853,7 +853,7 @@ class MetadataGenerator( object ): if tool_path and relative_install_dir: if relative_path_to_sample_file.startswith( os.path.join( tool_path, relative_install_dir ) ): relative_path_to_sample_file = relative_path_to_sample_file[ len( tool_path ) + 1 :] - sample_file_metadata_paths.append( relative_path_to_sample_file ) + sample_file_metadata_paths.append( relative_path_to_sample_file ) return sample_file_metadata_paths, sample_file_copy_paths def handle_repository_elem( self, repository_elem, only_if_compiling_contained_td=False ): From 2332e180cc67aefa56b3c481d3b734205b12bcbe Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 11 Feb 2015 17:36:05 -0500 Subject: [PATCH 36/40] When resetting repository metadata in the toolshed, don't overwrite the already set relative_install_dir. --- lib/tool_shed/metadata/repository_metadata_manager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/tool_shed/metadata/repository_metadata_manager.py b/lib/tool_shed/metadata/repository_metadata_manager.py index f4166388731..5c7f8a5e7a1 100644 --- a/lib/tool_shed/metadata/repository_metadata_manager.py +++ b/lib/tool_shed/metadata/repository_metadata_manager.py @@ -834,7 +834,6 @@ class RepositoryMetadataManager( metadata_generator.MetadataGenerator ): if cloned_ok: log.debug( "Generating metadata for changset revision: %s", str( ctx.rev() ) ) self.set_changeset_revision( str( repo.changectx( changeset ) ) ) - self.set_relative_install_dir( work_dir ) self.set_repository_files_dir( work_dir ) self.generate_metadata_for_changeset_revision() if self.metadata_dict: From 58e9b20965e0f4d88c216f56866a2048071713bb Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 12 Feb 2015 07:57:51 -0500 Subject: [PATCH 37/40] Fix at least one error with zipfile downloads and file permissions not being set correctly. --- lib/galaxy/eggs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/eggs/__init__.py b/lib/galaxy/eggs/__init__.py index 1938009bf99..d4ed05cbb21 100644 --- a/lib/galaxy/eggs/__init__.py +++ b/lib/galaxy/eggs/__init__.py @@ -421,7 +421,7 @@ def unpack_zipfile( filename, extract_dir, ignores=[] ): try: for info in z.infolist(): name = info.filename - perm = (info.external_attr >> 16L) & 0777 + mode = (info.external_attr >> 16L) & 0777 # don't extract absolute paths or ones with .. in them if name.startswith('/') or '..' in name: continue From dce9c1a5218fc3deb1a54b4521206bbf977af4ab Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 12 Feb 2015 08:28:37 -0500 Subject: [PATCH 38/40] Fix path manipulation during fetch_eggs. This getting an external version of pkg_resources (and not ours in lib/) is what is causing the weird egg fetching errors. Newer versions of pkg_resources create a mangled distribution string for some eggs with nonstandard version identifiers. --- scripts/fetch_eggs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fetch_eggs.py b/scripts/fetch_eggs.py index f96596f6ee7..20f9c8dfcd2 100755 --- a/scripts/fetch_eggs.py +++ b/scripts/fetch_eggs.py @@ -32,7 +32,7 @@ root.setLevel( 10 ) root.addHandler( logging.StreamHandler( sys.stdout ) ) lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) ) -sys.path.append( lib ) +sys.path.insert(1, lib) from galaxy.eggs import Crate, EggNotFetchable import pkg_resources From 669bdd4dc2653d63c1b44b53bce8364bffce76ee Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Thu, 12 Feb 2015 09:00:26 -0500 Subject: [PATCH 39/40] Update tag latest_2015.01.13 for changeset 577b270034b4 --- .hgtags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hgtags b/.hgtags index 206fa7f1efd..0bbd03bf981 100644 --- a/.hgtags +++ b/.hgtags @@ -22,4 +22,4 @@ ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11 2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06 782fa60fc65488aea0c618d723e9a63d42caf865 latest_2014.10.06 2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13 -644deef1a5789b788552a6db7f3d6fe07d81c79d latest_2015.01.13 +577b270034b48d90e58ffbea296e700d229545c9 latest_2015.01.13 From 3961d4834fe5c83fd27be176f94dbc6ec95dda9c Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 12 Feb 2015 10:34:51 -0500 Subject: [PATCH 40/40] Fix path insertion vs appending of /lib for all scripts. --- scripts/check_eggs.py | 2 +- scripts/check_galaxy.py | 2 +- scripts/dist-scramble.py | 2 +- scripts/get_platforms.py | 2 +- scripts/helper.py | 2 +- scripts/make_egg_packager.py | 2 +- scripts/scramble.py | 2 +- scripts/scramble/scripts/DRMAA_python-macosx.py | 2 +- scripts/scramble/scripts/DRMAA_python-solaris.py | 2 +- scripts/scramble/scripts/DRMAA_python.py | 2 +- scripts/scramble/scripts/MySQL_python-solaris.py | 2 +- scripts/scramble/scripts/MySQL_python.py | 2 +- scripts/scramble/scripts/PyRods.py | 2 +- scripts/scramble/scripts/bx_python-solaris.py | 2 +- scripts/scramble/scripts/generic.py | 2 +- scripts/scramble/scripts/pbs_python.py | 2 +- scripts/scramble/scripts/psycopg2-linux.py | 2 +- scripts/scramble/scripts/psycopg2-macosx.py | 2 +- scripts/scramble/scripts/psycopg2-solaris.py | 2 +- scripts/scramble/scripts/psycopg2.py | 2 +- scripts/scramble/scripts/pysam-solaris.py | 2 +- scripts/scramble/scripts/pysqlite.py | 2 +- scripts/set_dataset_sizes.py | 2 +- scripts/set_user_disk_usage.py | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/scripts/check_eggs.py b/scripts/check_eggs.py index e3717069cd4..7655eb964cb 100644 --- a/scripts/check_eggs.py +++ b/scripts/check_eggs.py @@ -37,7 +37,7 @@ if config_set: config_arg = '-c %s' % config lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) ) -sys.path.append( lib ) +sys.path.insert( 1, lib ) from galaxy.eggs import Crate diff --git a/scripts/check_galaxy.py b/scripts/check_galaxy.py index e2ce1001aa3..81f50fcf1fd 100755 --- a/scripts/check_galaxy.py +++ b/scripts/check_galaxy.py @@ -90,7 +90,7 @@ except: # find/import twill lib_dir = os.path.join( scripts_dir, "..", "lib" ) -sys.path.append( lib_dir ) +sys.path.insert( 1, lib_dir ) from galaxy import eggs import pkg_resources pkg_resources.require( "twill" ) diff --git a/scripts/dist-scramble.py b/scripts/dist-scramble.py index b34301c0f08..04f396be393 100644 --- a/scripts/dist-scramble.py +++ b/scripts/dist-scramble.py @@ -44,7 +44,7 @@ root.setLevel( 10 ) root.addHandler( logging.StreamHandler( sys.stdout ) ) lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) -sys.path.append( lib ) +sys.path.insert( 1, lib ) from galaxy.eggs.dist import DistScrambleCrate, ScrambleFailure from galaxy.eggs import EggNotFetchable diff --git a/scripts/get_platforms.py b/scripts/get_platforms.py index 0035b01542f..b0d11d3c832 100755 --- a/scripts/get_platforms.py +++ b/scripts/get_platforms.py @@ -5,7 +5,7 @@ import os, sys assert sys.version_info[:2] >= ( 2, 4 ) lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) ) -sys.path.append( lib ) +sys.path.insert( 1, lib ) import galaxy import pkg_resources diff --git a/scripts/helper.py b/scripts/helper.py index 13a66a332a9..dad65d6d63c 100644 --- a/scripts/helper.py +++ b/scripts/helper.py @@ -26,7 +26,7 @@ except: sys.exit( 1 ) options.config = os.path.abspath( options.config ) -sys.path.append( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) from galaxy import eggs import pkg_resources diff --git a/scripts/make_egg_packager.py b/scripts/make_egg_packager.py index 9cafe9dc40e..e9d2352b7c7 100644 --- a/scripts/make_egg_packager.py +++ b/scripts/make_egg_packager.py @@ -17,7 +17,7 @@ root.setLevel( 10 ) root.addHandler( logging.StreamHandler( sys.stdout ) ) lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) ) -sys.path.append( lib ) +sys.path.insert( 1, lib ) from galaxy.eggs import Crate, EggNotFetchable, py import pkg_resources diff --git a/scripts/scramble.py b/scripts/scramble.py index c464b4fa381..ed97a5fe527 100644 --- a/scripts/scramble.py +++ b/scripts/scramble.py @@ -15,7 +15,7 @@ root.setLevel( 10 ) root.addHandler( logging.StreamHandler( sys.stdout ) ) lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) ) -sys.path.append( lib ) +sys.path.insert( 1, lib ) from galaxy.eggs.scramble import ScrambleCrate, ScrambleFailure, EggNotFetchable diff --git a/scripts/scramble/scripts/DRMAA_python-macosx.py b/scripts/scramble/scripts/DRMAA_python-macosx.py index d48a2671a4a..18cc332aeaa 100644 --- a/scripts/scramble/scripts/DRMAA_python-macosx.py +++ b/scripts/scramble/scripts/DRMAA_python-macosx.py @@ -10,7 +10,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/DRMAA_python-solaris.py b/scripts/scramble/scripts/DRMAA_python-solaris.py index 2300e04c579..2eb3fbdad01 100644 --- a/scripts/scramble/scripts/DRMAA_python-solaris.py +++ b/scripts/scramble/scripts/DRMAA_python-solaris.py @@ -10,7 +10,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/DRMAA_python.py b/scripts/scramble/scripts/DRMAA_python.py index 09e7551ca96..4f2062e1451 100644 --- a/scripts/scramble/scripts/DRMAA_python.py +++ b/scripts/scramble/scripts/DRMAA_python.py @@ -10,7 +10,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/MySQL_python-solaris.py b/scripts/scramble/scripts/MySQL_python-solaris.py index 6f8eea8537d..8ef903e90ce 100644 --- a/scripts/scramble/scripts/MySQL_python-solaris.py +++ b/scripts/scramble/scripts/MySQL_python-solaris.py @@ -50,7 +50,7 @@ if __name__ == '__main__': os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools - sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) + sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) from scramble_lib import * tag = get_tag() diff --git a/scripts/scramble/scripts/MySQL_python.py b/scripts/scramble/scripts/MySQL_python.py index bd8ba23852c..496689b3ba8 100644 --- a/scripts/scramble/scripts/MySQL_python.py +++ b/scripts/scramble/scripts/MySQL_python.py @@ -47,7 +47,7 @@ if __name__ == '__main__': os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools - sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) + sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) from scramble_lib import * tag = get_tag() diff --git a/scripts/scramble/scripts/PyRods.py b/scripts/scramble/scripts/PyRods.py index 7553d8e6ea1..3314ad9542c 100644 --- a/scripts/scramble/scripts/PyRods.py +++ b/scripts/scramble/scripts/PyRods.py @@ -6,7 +6,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/bx_python-solaris.py b/scripts/scramble/scripts/bx_python-solaris.py index bdeea7976c7..35adfe4b32a 100644 --- a/scripts/scramble/scripts/bx_python-solaris.py +++ b/scripts/scramble/scripts/bx_python-solaris.py @@ -5,7 +5,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/generic.py b/scripts/scramble/scripts/generic.py index e40a8261a4f..ba929d636ad 100644 --- a/scripts/scramble/scripts/generic.py +++ b/scripts/scramble/scripts/generic.py @@ -5,7 +5,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/pbs_python.py b/scripts/scramble/scripts/pbs_python.py index 5d0d7f69de7..2264530a975 100644 --- a/scripts/scramble/scripts/pbs_python.py +++ b/scripts/scramble/scripts/pbs_python.py @@ -10,7 +10,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/psycopg2-linux.py b/scripts/scramble/scripts/psycopg2-linux.py index 9b798fe9c9a..7c91b1da99d 100644 --- a/scripts/scramble/scripts/psycopg2-linux.py +++ b/scripts/scramble/scripts/psycopg2-linux.py @@ -44,7 +44,7 @@ if __name__ == '__main__': os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools - sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) + sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) from scramble_lib import * tag = get_tag() diff --git a/scripts/scramble/scripts/psycopg2-macosx.py b/scripts/scramble/scripts/psycopg2-macosx.py index c82466f1240..77dc699ddcb 100644 --- a/scripts/scramble/scripts/psycopg2-macosx.py +++ b/scripts/scramble/scripts/psycopg2-macosx.py @@ -50,7 +50,7 @@ if __name__ == '__main__': os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools - sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) + sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) from scramble_lib import * tag = get_tag() diff --git a/scripts/scramble/scripts/psycopg2-solaris.py b/scripts/scramble/scripts/psycopg2-solaris.py index 7ef58971164..ff0050558eb 100644 --- a/scripts/scramble/scripts/psycopg2-solaris.py +++ b/scripts/scramble/scripts/psycopg2-solaris.py @@ -47,7 +47,7 @@ if __name__ == '__main__': os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools - sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) + sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) from scramble_lib import * tag = get_tag() diff --git a/scripts/scramble/scripts/psycopg2.py b/scripts/scramble/scripts/psycopg2.py index f895d6bce19..bcaa2081f2c 100644 --- a/scripts/scramble/scripts/psycopg2.py +++ b/scripts/scramble/scripts/psycopg2.py @@ -44,7 +44,7 @@ if __name__ == '__main__': os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools - sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) + sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) ) from scramble_lib import * tag = get_tag() diff --git a/scripts/scramble/scripts/pysam-solaris.py b/scripts/scramble/scripts/pysam-solaris.py index 25499f2b522..6b4d62c5470 100644 --- a/scripts/scramble/scripts/pysam-solaris.py +++ b/scripts/scramble/scripts/pysam-solaris.py @@ -5,7 +5,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/scramble/scripts/pysqlite.py b/scripts/scramble/scripts/pysqlite.py index c324e928913..4a6e277327d 100644 --- a/scripts/scramble/scripts/pysqlite.py +++ b/scripts/scramble/scripts/pysqlite.py @@ -10,7 +10,7 @@ if os.path.dirname( sys.argv[0] ) != "": os.chdir( os.path.dirname( sys.argv[0] ) ) # find setuptools -sys.path.append( os.path.join( '..', '..', '..', 'lib' ) ) +sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) ) from scramble_lib import * tag = get_tag() # get the tag diff --git a/scripts/set_dataset_sizes.py b/scripts/set_dataset_sizes.py index d2d8390c576..8fc5cf18703 100644 --- a/scripts/set_dataset_sizes.py +++ b/scripts/set_dataset_sizes.py @@ -13,7 +13,7 @@ parser.add_option( '-c', '--config', dest='config', help='Path to Galaxy config def init(): options.config = os.path.abspath( options.config ) - sys.path.append( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) + sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) from galaxy import eggs import pkg_resources diff --git a/scripts/set_user_disk_usage.py b/scripts/set_user_disk_usage.py index 97bd6858ac7..282ad589aa4 100755 --- a/scripts/set_user_disk_usage.py +++ b/scripts/set_user_disk_usage.py @@ -21,7 +21,7 @@ def init(): if options.email == 'all': options.email = None - sys.path.append( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) + sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) from galaxy import eggs import pkg_resources