From 58e9b20965e0f4d88c216f56866a2048071713bb Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 12 Feb 2015 07:57:51 -0500 Subject: [PATCH 1/3] 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 2/3] 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 3961d4834fe5c83fd27be176f94dbc6ec95dda9c Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 12 Feb 2015 10:34:51 -0500 Subject: [PATCH 3/3] 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