[hg] galaxy 3540: Fix for editing library templates, add a new f...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/861756e85b16
changeset: 3540:861756e85b16
user: Greg Von Kuster <greg(a)bx.psu.edu>
date: Tue Mar 16 16:03:28 2010 -0400
description:
Fix for editing library templates, add a new functional test to cover the scenario, and some code cleanup.
diffstat:
lib/galaxy/web/controllers/library_admin.py | 2 +-
lib/galaxy/web/controllers/library_common.py | 1 -
templates/library/common/browse_library.mako | 10 +-
test/base/test_db_util.py | 9 ---
test/base/twilltestcase.py | 20 +++++-
test/functional/test_library_features.py | 84 +++++++++++++++++++--------
6 files changed, 82 insertions(+), 44 deletions(-)
diffs (366 lines):
diff -r 4a670e8f4248 -r 861756e85b16 lib/galaxy/web/controllers/library_admin.py
--- a/lib/galaxy/web/controllers/library_admin.py Tue Mar 16 15:32:05 2010 -0400
+++ b/lib/galaxy/web/controllers/library_admin.py Tue Mar 16 16:03:28 2010 -0400
@@ -34,7 +34,7 @@
template='/admin/library/grid.mako'
default_sort_key = "name"
columns = [
- NameColumn( "Library Name",
+ NameColumn( "Name",
key="name",
model_class=model.Library,
link=( lambda library: dict( operation="browse", id=library.id ) ),
diff -r 4a670e8f4248 -r 861756e85b16 lib/galaxy/web/controllers/library_common.py
--- a/lib/galaxy/web/controllers/library_common.py Tue Mar 16 15:32:05 2010 -0400
+++ b/lib/galaxy/web/controllers/library_common.py Tue Mar 16 16:03:28 2010 -0400
@@ -1616,7 +1616,6 @@
response_redirect=web.url_for( controller='library_common',
action='edit_template',
cntrller=cntrller,
- use_panels=use_panels,
item_type=item_type,
library_id=library_id,
folder_id=folder_id,
diff -r 4a670e8f4248 -r 861756e85b16 templates/library/common/browse_library.mako
--- a/templates/library/common/browse_library.mako Tue Mar 16 15:32:05 2010 -0400
+++ b/templates/library/common/browse_library.mako Tue Mar 16 16:03:28 2010 -0400
@@ -445,11 +445,11 @@
%endif
%if cntrller == 'library_admin':
<a class="action-button" confirm="Click OK to delete the library named '${library.name}'." href="${h.url_for( controller='library_admin', action='delete_library_item', library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library.id ), item_type='library' )}">Delete this data library</a>
- %endif
- %if show_deleted:
- <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=False )}">Hide deleted items</a>
- %else:
- <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=True )}">Show deleted items</a>
+ %if show_deleted:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=False )}">Hide deleted items</a>
+ %else:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=True )}">Show deleted items</a>
+ %endif
%endif
%elif cntrller == 'library_admin' and not library.purged:
<a class="action-button" href="${h.url_for( controller='library_admin', action='undelete_library_item', library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library.id ), item_type='library', use_panels=use_panels )}">Undelete this data library</a>
diff -r 4a670e8f4248 -r 861756e85b16 test/base/test_db_util.py
--- a/test/base/test_db_util.py Tue Mar 16 15:32:05 2010 -0400
+++ b/test/base/test_db_util.py Tue Mar 16 16:03:28 2010 -0400
@@ -112,12 +112,3 @@
.all()
def refresh( obj ):
sa_session.refresh( obj )
-def set_library_permissions( in_list ):
- permissions_in = []
- permissions_out = []
- for k, v in galaxy.model.Library.permitted_actions.items():
- if k in in_list:
- permissions_in.append( k )
- else:
- permissions_out.append( k )
- return permissions_in, permissions_out
diff -r 4a670e8f4248 -r 861756e85b16 test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Tue Mar 16 15:32:05 2010 -0400
+++ b/test/base/twilltestcase.py Tue Mar 16 16:03:28 2010 -0400
@@ -1630,7 +1630,6 @@
pass
def create_library( self, name='Library One', description='This is Library One', synopsis='Synopsis for Library One' ):
"""Create a new library"""
- self.home()
self.visit_url( "%s/library_admin/create_library" % self.url )
self.check_page_for_string( 'Create a new data library' )
tc.fv( "1", "name", name )
@@ -1640,10 +1639,25 @@
check_str = "The new library named '%s' has been created" % name
self.check_page_for_string( check_str )
self.home()
+ def edit_template( self, cntrller, item_type, library_id, folder_id='', ldda_id='', action='add_field',
+ field_name='', field_name_value='', field_help='', field_help_value='',
+ field_type='', field_type_value='' ):
+ """Edit the form fields defining a library template"""
+ self.visit_url( "%s/library_common/edit_template?cntrller=%s&item_type=%s&library_id=%s" % \
+ ( self.url, cntrller, item_type, library_id ) )
+ self.check_page_for_string( "Edit form definition" )
+ if action == 'add_field':
+ tc.submit( 'add_field_button' )
+ tc.fv( '1', field_name, field_name_value )
+ tc.fv( '1', field_help, field_help_value )
+ tc.fv( '1', field_type, field_type_value )
+ tc.submit( 'save_changes_button' )
+ self.check_page_for_string( "The template for this data library has been updated with your changes." )
+ if action == 'add_field':
+ self.check_page_for_string( field_name_value )
def library_info( self, cntrller, library_id, library_name, new_name='', new_description='', new_synopsis='',
ele_1_field_name='', ele_1_contents='', ele_2_field_name='', ele_2_contents='', check_str1='' ):
"""Edit information about a library, optionally using an existing template with up to 2 elements"""
- self.home()
self.visit_url( "%s/library_common/library_info?cntrller=%s&id=%s" % ( self.url, cntrller, library_id ) )
if check_str1:
self.check_page_for_string( check_str1 )
@@ -1866,7 +1880,7 @@
self.visit_url( url )
self.check_page_for_string( 'Upload a directory of files' )
if check_str1:
- self.check_page_for_strin( check_str1 )
+ self.check_page_for_string( check_str1 )
tc.fv( "1", "folder_id", folder_id )
tc.fv( "1", "file_type", file_type )
tc.fv( "1", "dbkey", dbkey )
diff -r 4a670e8f4248 -r 861756e85b16 test/functional/test_library_features.py
--- a/test/functional/test_library_features.py Tue Mar 16 15:32:05 2010 -0400
+++ b/test/functional/test_library_features.py Tue Mar 16 16:03:28 2010 -0400
@@ -9,21 +9,29 @@
global regular_user1
regular_user1 = get_user( 'test1(a)bx.psu.edu' )
assert regular_user1 is not None, 'Problem retrieving user with email "test1(a)bx.psu.edu" from the database'
+ global regular_user1_private_role
+ regular_user1_private_role = get_private_role( regular_user1 )
self.logout()
self.login( email='test2(a)bx.psu.edu' )
global regular_user2
regular_user2 = get_user( 'test2(a)bx.psu.edu' )
assert regular_user2 is not None, 'Problem retrieving user with email "test2(a)bx.psu.edu" from the database'
+ global regular_user2_private_role
+ regular_user2_private_role = get_private_role( regular_user2 )
self.logout()
self.login( email='test3(a)bx.psu.edu' )
global regular_user3
regular_user3 = get_user( 'test3(a)bx.psu.edu' )
assert regular_user3 is not None, 'Problem retrieving user with email "test3(a)bx.psu.edu" from the database'
+ global regular_user3_private_role
+ regular_user3_private_role = get_private_role( regular_user3 )
self.logout()
self.login( email='test(a)bx.psu.edu' )
global admin_user
admin_user = get_user( 'test(a)bx.psu.edu' )
assert admin_user is not None, 'Problem retrieving user with email "test(a)bx.psu.edu" from the database'
+ global admin_user_private_role
+ admin_user_private_role = get_private_role( admin_user )
def test_005_create_library( self ):
"""Testing creating a new library, then renaming it"""
# Logged in as admin_user
@@ -100,7 +108,6 @@
self.security.encode_id( library_one.id ),
library_one.name,
check_str1=contents )
- contents = '%s library contents' % form_one_field_label
contents_edited = contents + ' edited'
# Edit the contents and then save them
self.library_info( 'library_admin',
@@ -113,7 +120,25 @@
self.security.encode_id( library_one.id ),
library_one.name,
check_str1=contents_edited )
- def test_020_add_public_dataset_to_root_folder( self ):
+ def test_020_edit_template_admin_view( self ):
+ """Test editing the layout of a template from the Admin view"""
+ # Since there is only 1 field currently in the form definition, we'll add another
+ field_name = 'field_name_1'
+ field_name_value = 'Field 1'
+ field_help = 'field_helptext_1'
+ field_help_value = 'Field 1 help'
+ field_type = 'field_type_1'
+ field_type_value = 'TextArea'
+ self.edit_template( 'library_admin',
+ 'library',
+ self.security.encode_id( library_one.id ),
+ field_name=field_name,
+ field_name_value=field_name_value,
+ field_help=field_help,
+ field_help_value=field_help_value,
+ field_type=field_type,
+ field_type_value=field_type_value )
+ def test_025_add_public_dataset_to_root_folder( self ):
"""Testing adding a public dataset to the root folder, making sure library template is inherited"""
# Logged in as admin_user
message = 'Testing adding a public dataset to the root folder'
@@ -145,7 +170,7 @@
self.security.encode_id( ldda_one.id ),
ldda_one.name,
check_str1=template_contents )
- def test_025_add_new_folder_to_root_folder( self ):
+ def test_030_add_new_folder_to_root_folder( self ):
"""Testing adding a folder to a library root folder"""
# logged in as admin_user
root_folder = library_one.root_folder
@@ -177,7 +202,7 @@
self.security.encode_id( library_one.id ),
field_name=form_one_field_name,
contents=template_contents )
- def test_030_add_subfolder_to_folder( self ):
+ def test_035_add_subfolder_to_folder( self ):
"""Testing adding a folder to a library folder"""
# logged in as admin_user
name = "Folder One's Subfolder"
@@ -208,7 +233,7 @@
self.security.encode_id( library_one.id ),
field_name=form_one_field_name,
contents=template_contents )
- def test_035_add_2nd_new_folder_to_root_folder( self ):
+ def test_040_add_2nd_new_folder_to_root_folder( self ):
"""Testing adding a 2nd folder to a library root folder"""
# logged in as admin_user
root_folder = library_one.root_folder
@@ -226,7 +251,7 @@
self.security.encode_id( library_one.id ),
check_str1=name,
check_str2=description )
- def test_040_add_public_dataset_to_root_folders_2nd_subfolder( self ):
+ def test_045_add_public_dataset_to_root_folders_2nd_subfolder( self ):
"""Testing adding a public dataset to the root folder's 2nd sub-folder"""
# Logged in as admin_user
message = "Testing adding a public dataset to the folder named %s" % folder_two.name
@@ -258,7 +283,7 @@
self.security.encode_id( ldda_two.id ),
ldda_two.name,
check_str1=template_contents )
- def test_045_add_2nd_public_dataset_to_root_folders_2nd_subfolder( self ):
+ def test_050_add_2nd_public_dataset_to_root_folders_2nd_subfolder( self ):
"""Testing adding a 2nd public dataset to the root folder's 2nd sub-folder"""
# Logged in as admin_user
message = "Testing adding a 2nd public dataset to the folder named %s" % folder_two.name
@@ -290,7 +315,7 @@
self.security.encode_id( ldda_three.id ),
ldda_three.name,
check_str1=template_contents )
- def test_050_copy_dataset_from_history_to_subfolder( self ):
+ def test_055_copy_dataset_from_history_to_subfolder( self ):
"""Testing copying a dataset from the current history to a subfolder"""
# logged in as admin_user
self.new_history()
@@ -314,7 +339,7 @@
ldda_four.name,
check_str1=form_one_field_name,
not_displayed=contents )
- def test_055_editing_dataset_attribute_info( self ):
+ def test_060_editing_dataset_attribute_info( self ):
"""Testing editing a library dataset's attribute information"""
# logged in as admin_user
new_ldda_name = '4.bed ( version 1 )'
@@ -335,7 +360,7 @@
ldda_four.name,
check_str1=form_one_field_name,
not_displayed=contents )
- def test_060_uploading_new_dataset_version( self ):
+ def test_065_uploading_new_dataset_version( self ):
"""Testing uploading a new version of a library dataset"""
# logged in as admin_user
message = 'Testing uploading a new version of a dataset'
@@ -384,22 +409,32 @@
self.browse_library( 'library_admin',
self.security.encode_id( library_one.id ),
not_displayed=ldda_four.name )
- def test_065_upload_directory_of_files_from_libraries_view( self ):
+ def test_070_upload_directory_of_files_from_libraries_view( self ):
"""Testing uploading a directory of files to a root folder from the Data Libraries view"""
# logged in as admin_user
# admin_user will not have the option to upload a directory of files from the
# Libraries view since a sub-directory named the same as their email is not contained
- # in the configured user_library_import_dir. However, since members of role_one have
- # the LIBRARY_ADD permission, we can test this feature as regular_user1 or regular_user3
+ # in the configured user_library_import_dir ( in the test_data directory, only regular_user1
+ # and regular_user3 have directories ). We'll need to give these 2 user LIBRARY_ADD permission
+ # on library_one to test this feature.
+ permissions_in = [ 'LIBRARY_ADD' ]
+ permissions_out = [ 'LIBRARY_ACCESS', 'LIBRARY_MODIFY', 'LIBRARY_MANAGE' ]
+ role_ids = '%s,%s' % ( str( regular_user1_private_role.id ), str( regular_user3_private_role.id ) )
+ # Role one members are: admin_user, regular_user1, regular_user3. Each of these users will be permitted for
+ # LIBRARY_ACCESS, LIBRARY_ADD, LIBRARY_MODIFY, LIBRARY_MANAGE on this library and it's contents.
+ self.library_permissions( self.security.encode_id( library_one.id ),
+ library_one.name,
+ role_ids,
+ permissions_in,
+ permissions_out )
self.logout()
+ # Now that we have permissions set on the library, we can proceed to test uploading files
self.login( email=regular_user1.email )
message = 'Uploaded all files in test-data/users/test1...'
# Since regular_user1 does not have any sub-directories contained within her configured
# user_library_import_dir, the only option in her server_dir select list will be the
# directory named the same as her email
check_str_after_submit = "Added 1 datasets to the library '%s' (each is selected)." % library_one.root_folder.name
- # TODO: gvk( 3/12/10 )this is broken, so commenting until I have time to discover why...
- """
self.upload_directory_of_files( 'library',
self.security.encode_id( library_one.id ),
self.security.encode_id( library_one.root_folder.id ),
@@ -426,8 +461,7 @@
self.security.encode_id( library_one.id ),
check_str1=regular_user3.email,
check_str2=message )
- """
- def test_070_download_archive_of_library_files( self ):
+ def test_075_download_archive_of_library_files( self ):
"""Testing downloading an archive of files from the library"""
# logged in as regular_user3
self.logout()
@@ -439,7 +473,7 @@
format=format )
self.check_archive_contents( archive, ( ldda_one, ldda_two ) )
os.remove( archive )
- def test_075_mark_dataset_deleted( self ):
+ def test_080_mark_dataset_deleted( self ):
"""Testing marking a library dataset as deleted"""
# Logged in as admin_user
self.delete_library_item( self.security.encode_id( library_one.id ),
@@ -449,7 +483,7 @@
self.browse_library( 'library_admin',
self.security.encode_id( library_one.id ),
not_displayed=ldda_two.name )
- def test_080_display_and_hide_deleted_dataset( self ):
+ def test_085_display_and_hide_deleted_dataset( self ):
"""Testing displaying and hiding a deleted library dataset"""
# Logged in as admin_user
self.browse_library( 'library_admin',
@@ -459,7 +493,7 @@
self.browse_library( 'library_admin',
self.security.encode_id( library_one.id ),
not_displayed=ldda_two.name )
- def test_085_mark_folder_deleted( self ):
+ def test_090_mark_folder_deleted( self ):
"""Testing marking a library folder as deleted"""
# Logged in as admin_user
self.delete_library_item( self.security.encode_id( library_one.id ),
@@ -469,7 +503,7 @@
self.browse_library( 'library_admin',
self.security.encode_id( library_one.id ),
not_displayed=folder_two.name )
- def test_090_mark_folder_undeleted( self ):
+ def test_095_mark_folder_undeleted( self ):
"""Testing marking a library folder as undeleted"""
# Logged in as admin_user
self.undelete_library_item( self.security.encode_id( library_one.id ),
@@ -482,7 +516,7 @@
self.security.encode_id( library_one.id ),
check_str1=folder_two.name,
not_displayed=ldda_two.name )
- def test_095_mark_library_deleted( self ):
+ def test_100_mark_library_deleted( self ):
"""Testing marking a library as deleted"""
# Logged in as admin_user
# First mark folder_two as deleted to further test state saving when we undelete the library
@@ -496,7 +530,7 @@
item_type='library' )
self.browse_libraries_admin( not_displayed1=library_one.name )
self.browse_libraries_admin( deleted=True, check_str1=library_one.name )
- def test_100_mark_library_undeleted( self ):
+ def test_105_mark_library_undeleted( self ):
"""Testing marking a library as undeleted"""
# Logged in as admin_user
self.undelete_library_item( self.security.encode_id( library_one.id ),
@@ -508,7 +542,7 @@
self.security.encode_id( library_one.id ),
check_str1=library_one.name,
not_displayed=folder_two.name )
- def test_105_purge_library( self ):
+ def test_110_purge_library( self ):
"""Testing purging a library"""
# Logged in as admin_user
self.delete_library_item( self.security.encode_id( library_one.id ),
@@ -547,7 +581,7 @@
raise AssertionError( 'The library_dataset id %s named "%s" has not been marked as deleted.' % \
( str( library_dataset.id ), library_dataset.name ) )
check_folder( library_one.root_folder )
- def test_110_no_library_template( self ):
+ def test_115_no_library_template( self ):
"""Test library features when library has no template"""
# Logged in as admin_user
name = "library features Library Two"
12 years, 3 months
[hg] galaxy 3539: Fix for 'add' action in act_on_multiple_datase...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/4a670e8f4248
changeset: 3539:4a670e8f4248
user: fubar: ross Lazarus at gmail period com
date: Tue Mar 16 15:32:05 2010 -0400
description:
Fix for 'add' action in act_on_multiple_datasets - and a warning message if any bogus action supplied - fixes issue #297
diffstat:
lib/galaxy/web/controllers/library_common.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (31 lines):
diff -r aad7b294ffca -r 4a670e8f4248 lib/galaxy/web/controllers/library_common.py
--- a/lib/galaxy/web/controllers/library_common.py Tue Mar 16 15:09:22 2010 -0400
+++ b/lib/galaxy/web/controllers/library_common.py Tue Mar 16 15:32:05 2010 -0400
@@ -1257,7 +1257,7 @@
messagetype = 'error'
else:
ldda_ids = util.listify( ldda_ids )
- if action == 'import_to_history':
+ if action == 'import_to_history' or action == 'add':
history = trans.get_history()
if history is None:
# Must be a bot sending a request without having a history.
@@ -1308,7 +1308,7 @@
trans.sa_session.add( ld )
trans.sa_session.flush()
msg = "The selected datasets have been removed from this data library"
- else:
+ elif action in ['zip','tgz','tbz']:
error = False
killme = string.punctuation + string.whitespace
trantab = string.maketrans(killme,'_'*len(killme))
@@ -1416,6 +1416,9 @@
archive.wsgi_status = trans.response.wsgi_status()
archive.wsgi_headeritems = trans.response.wsgi_headeritems()
return archive.stream
+ else: # unknown action
+ msg = '### unknown action = %s in act_on_multiple_datasets' % action
+
return trans.response.send_redirect( web.url_for( controller='library_common',
action='browse_library',
cntrller=cntrller,
12 years, 3 months
[hg] galaxy 3538: Add magnifier icons for trackster
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/aad7b294ffca
changeset: 3538:aad7b294ffca
user: Kanwei Li <kanwei(a)gmail.com>
date: Tue Mar 16 15:09:22 2010 -0400
description:
Add magnifier icons for trackster
diffstat:
static/images/fugue/magnifier-zoom-out.png | 0
static/images/fugue/magnifier-zoom.png | 0
2 files changed, 0 insertions(+), 0 deletions(-)
diffs (4 lines):
diff -r 2fa5488a9b3e -r aad7b294ffca static/images/fugue/magnifier-zoom-out.png
Binary file static/images/fugue/magnifier-zoom-out.png has changed
diff -r 2fa5488a9b3e -r aad7b294ffca static/images/fugue/magnifier-zoom.png
Binary file static/images/fugue/magnifier-zoom.png has changed
12 years, 3 months
[hg] galaxy 3537: Monkeypatch pkg_resources to put eggs at the b...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/2fa5488a9b3e
changeset: 3537:2fa5488a9b3e
user: Nate Coraor <nate(a)bx.psu.edu>
date: Tue Mar 16 14:07:42 2010 -0400
description:
Monkeypatch pkg_resources to put eggs at the beginning of the path instead of the end
diffstat:
lib/galaxy/__init__.py | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diffs (38 lines):
diff -r d776beca95f8 -r 2fa5488a9b3e lib/galaxy/__init__.py
--- a/lib/galaxy/__init__.py Tue Mar 16 12:00:10 2010 -0400
+++ b/lib/galaxy/__init__.py Tue Mar 16 14:07:42 2010 -0400
@@ -61,3 +61,34 @@
except:
pkg_resources._compatible_platforms = pkg_resources.compatible_platforms
pkg_resources.compatible_platforms = _compatible_platforms
+
+# patch to insert eggs at the beginning of sys.path instead of at the end
+def _insert_on(self, path, loc = None):
+ """Insert self.location in path before its nearest parent directory"""
+
+ loc = loc or self.location
+ if not loc:
+ return
+
+ nloc = pkg_resources._normalize_cached(loc)
+ npath= [(p and pkg_resources._normalize_cached(p) or p) for p in path]
+
+ if path is sys.path:
+ self.check_version_conflict()
+ path.insert(0, loc)
+
+ # remove dups
+ while 1:
+ try:
+ np = npath.index(nloc, 1)
+ except ValueError:
+ break
+ else:
+ del npath[np], path[np]
+
+ return
+try:
+ assert pkg_resources.Distribution._insert_on
+except:
+ pkg_resources.Distribution._insert_on = pkg_resources.Distribution.insert_on
+ pkg_resources.Distribution.insert_on = _insert_on
12 years, 3 months
[hg] galaxy 3535: Fixes user info functional tests broken in cha...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/15fd40238cef
changeset: 3535:15fd40238cef
user: rc
date: Tue Mar 16 09:50:13 2010 -0400
description:
Fixes user info functional tests broken in changeset 3529:96ec861b4b6e
diffstat:
test/base/twilltestcase.py | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diffs (48 lines):
diff -r 447c059a096a -r 15fd40238cef test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Mon Mar 15 15:06:14 2010 -0400
+++ b/test/base/twilltestcase.py Tue Mar 16 09:50:13 2010 -0400
@@ -806,17 +806,18 @@
self.visit_page( "user/create?user_info_select=%i&admin_view=False" % user_info_form_id )
else:
self.visit_page( "user/create?admin_view=False" )
+ print self.write_temp_file( self.last_page() )
self.check_page_for_string( "Create account" )
- tc.fv( "1", "email", email )
- tc.fv( "1", "password", password )
- tc.fv( "1", "confirm", password )
- tc.fv( "1", "username", username )
+ tc.fv( "2", "email", email )
+ tc.fv( "2", "password", password )
+ tc.fv( "2", "confirm", password )
+ tc.fv( "2", "username", username )
if user_info_forms == 'multiple':
self.check_page_for_string( "User type" )
for index, info_value in enumerate(user_info_values):
- tc.fv( "1", "field_%i" % index, info_value )
+ tc.fv( "2", "field_%i" % index, info_value )
tc.submit( "create_user_button" )
- self.check_page_for_string( "now logged in as %s" % email )
+ self.check_page_for_string( "ogged in as %s" % email )
def create_user_with_info_as_admin( self, email, password, username, user_info_forms, user_info_form_id, user_info_values ):
'''
This method registers a new user and also provides use info as an admin
@@ -827,14 +828,14 @@
else:
self.visit_page( "admin/users?operation=create" )
self.check_page_for_string( "Create account" )
- tc.fv( "1", "email", email )
- tc.fv( "1", "password", password )
- tc.fv( "1", "confirm", password )
- tc.fv( "1", "username", username )
+ tc.fv( "2", "email", email )
+ tc.fv( "2", "password", password )
+ tc.fv( "2", "confirm", password )
+ tc.fv( "2", "username", username )
if user_info_forms == 'multiple':
self.check_page_for_string( "User type" )
for index, info_value in enumerate(user_info_values):
- tc.fv( "1", "field_%i" % index, info_value )
+ tc.fv( "2", "field_%i" % index, info_value )
tc.submit( "create_user_button" )
self.check_page_for_string( "Created new user account (%s)" % email )
def edit_login_info( self, new_email, new_username ):
12 years, 3 months
[hg] galaxy 3536: Fixes to item embedding in pages. In particula...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/d776beca95f8
changeset: 3536:d776beca95f8
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Tue Mar 16 12:00:10 2010 -0400
description:
Fixes to item embedding in pages. In particular, fixed the editor color changes that were occurring when moving the cursor through embedded items.
diffstat:
static/june_2007_style/blue/embed_item.css | 16 ++++++++++------
static/june_2007_style/embed_item.css.tmpl | 25 ++++++++++++++++++++++++-
static/wymeditor/iframe/galaxy/wymiframe.css | 12 +++++++++---
templates/embed_base.mako | 2 +-
templates/page/editor.mako | 11 ++++++-----
templates/workflow/embed.mako | 1 +
6 files changed, 51 insertions(+), 16 deletions(-)
diffs (177 lines):
diff -r 15fd40238cef -r d776beca95f8 static/june_2007_style/blue/embed_item.css
--- a/static/june_2007_style/blue/embed_item.css Tue Mar 16 09:50:13 2010 -0400
+++ b/static/june_2007_style/blue/embed_item.css Tue Mar 16 12:00:10 2010 -0400
@@ -1,10 +1,14 @@
-.embedded-item{margin-left:auto;margin-right:auto;width:90%;padding: 0.5em;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em;}
-.embedded-item.history{background-color:#C1C9E5}
-.embedded-item.dataset{background-color:#CFC}
-.embedded-item.workflow{background-color:#EBD9B2}
+.embedded-item{margin-left:auto;margin-right:auto;width:90%;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em;}
+.embedded-item.display {padding: 0.5em;}
+.embedded-item.history{background-color:#C1C9E5}
+.embedded-item.history p{background:#C1C9E5 no-repeat 2px 2px;margin-top:0;margin-bottom:0;}
+.embedded-item.dataset{background-color:#CFC}
+.embedded-item.dataset p{background:#CFC no-repeat 2px 2px;margin-top:0;margin-bottom:0;}
+.embedded-item.workflow{background-color:#EBD9B2}
+.embedded-item.workflow p{background:#EBD9B2 no-repeat 2px 2px;margin-top:0;margin-bottom:0;}
.embedded-item.placeholder{}
-.embedded-item .item-content{max-height:25em;overflow:auto;}
-.embedded-item .title{vertical-align:top;text-align:center;}
+.embedded-item .item-content{max-height:25em;overflow:auto;display:none;}
+.embedded-item .title{vertical-align:top;text-align:center;font-weight:bold;}
.embedded-item.placeholder .content{padding: 1em 1em;font-style:italic;text-align:center;}
table.annotated-item{width:100%;border-collapse:collapse;}
table.annotated-item td,th{padding:0;}
diff -r 15fd40238cef -r d776beca95f8 static/june_2007_style/embed_item.css.tmpl
--- a/static/june_2007_style/embed_item.css.tmpl Tue Mar 16 09:50:13 2010 -0400
+++ b/static/june_2007_style/embed_item.css.tmpl Tue Mar 16 12:00:10 2010 -0400
@@ -1,35 +1,58 @@
+
.embedded-item {
margin-left:auto;
margin-right:auto;
width:90%;
- padding: 0.5em;
-moz-border-radius:0.5em;
-webkit-border-radius:0.5em;
border-radius:0.5em;
}
+.embedded-item.display {
+ padding: 0.5em;
+}
+
.embedded-item.history {
background-color:#C1C9E5
}
+.embedded-item.history p {
+ background:#C1C9E5 no-repeat 2px 2px;
+ margin-top:0;
+ margin-bottom:0;
+}
+
.embedded-item.dataset {
background-color:#CFC
}
+.embedded-item.dataset p {
+ background:#CFC no-repeat 2px 2px;
+ margin-top:0;margin-bottom:0;
+}
+
.embedded-item.workflow {
background-color:#EBD9B2
}
+.embedded-item.workflow p {
+ background:#EBD9B2 no-repeat 2px 2px;
+ margin-top:0;
+ margin-bottom:0;
+}
+
.embedded-item.placeholder{}
.embedded-item .item-content {
max-height: 25em;
overflow: auto;
+ display: none;
}
.embedded-item .title {
vertical-align:top;
text-align:center;
+ font-weight: bold;
}
.embedded-item.placeholder .content {
diff -r 15fd40238cef -r d776beca95f8 static/wymeditor/iframe/galaxy/wymiframe.css
--- a/static/wymeditor/iframe/galaxy/wymiframe.css Tue Mar 16 09:50:13 2010 -0400
+++ b/static/wymeditor/iframe/galaxy/wymiframe.css Tue Mar 16 12:00:10 2010 -0400
@@ -1,3 +1,7 @@
+/*
+ * JG: edited to remove '!important' from rules so that embedded Galaxy items can have unique background colors.
+ */
+
/*
* WYMeditor : what you see is What You Mean web-based editor
* Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
@@ -33,9 +37,9 @@
ol,
table,
blockquote,
- pre { background: #FFFFFF no-repeat 2px 2px !important;
- padding:8px 5px 5px !important;
- margin:10px !important; }
+ pre { background: #FFFFFF no-repeat 2px 2px; /* JG removed: !important */
+ padding:8px 5px 5px; /* JG removed: !important */
+ margin:10px} /* JG removed: !important */
td { background: #F0F4F8; }
th { background: #ffffcc; }
ul,
@@ -52,6 +56,7 @@
td { height: 1.6em; }
/* labels */
+/* JG commented out:
p { background-image: url(lbl-p.png); }
h1 { background-image: url(lbl-h1.png); }
h2 { background-image: url(lbl-h2.png); }
@@ -61,6 +66,7 @@
h6 { background-image: url(lbl-h6.png); }
blockquote{ background-image: url(lbl-blockquote.png); }
pre { background-image: url(lbl-pre.png); }
+*/
/* specific HTML elements */
caption { text-align: left; }
diff -r 15fd40238cef -r d776beca95f8 templates/embed_base.mako
--- a/templates/embed_base.mako Tue Mar 16 09:50:13 2010 -0400
+++ b/templates/embed_base.mako Tue Mar 16 12:00:10 2010 -0400
@@ -6,7 +6,7 @@
<%namespace file="/display_common.mako" import="*" />
## HTML structure.
-<div class='embedded-item ${get_class_display_name( item.__class__ ).lower()}'>
+<div class='embedded-item display ${get_class_display_name( item.__class__ ).lower()}'>
<div class='title'>
${self.render_title( item )}
<hr/>
diff -r 15fd40238cef -r d776beca95f8 templates/page/editor.mako
--- a/templates/page/editor.mako Tue Mar 16 09:50:13 2010 -0400
+++ b/templates/page/editor.mako Tue Mar 16 12:00:10 2010 -0400
@@ -459,17 +459,18 @@
// all non-standard attributes when it returns its content (e.g. it will not return an element attribute of the form
// item_class='History').
var item_embed_html =
- "<p> \
+ "\
<div id='" + item_info.iclass + "-" + item_id + "' class='embedded-item " + item_info.singular.toLowerCase() +
" placeholder'> \
- <div class='title'> Embedded Galaxy " + item_info.singular + " '" + item_name + "'</div> \
- <div class='content'> \
+ <p class='title'>Embedded Galaxy " + item_info.singular + " '" + item_name + "'</p> \
+ <p class='content'> \
[Do not edit this block; Galaxy will fill it in with the annotated " +
item_info.singular.toLowerCase() + " when it is displayed.]</div> \
- </div> \
- </div></p>";
+ </p> \
+ </div><p></p>";
// Insert embedded representation into document.
+ // TODO: maybe try replace() instead to handle indenting?
wym.insert(item_embed_html);
});
hide_modal();
diff -r 15fd40238cef -r d776beca95f8 templates/workflow/embed.mako
--- a/templates/workflow/embed.mako Tue Mar 16 09:50:13 2010 -0400
+++ b/templates/workflow/embed.mako Tue Mar 16 12:00:10 2010 -0400
@@ -4,6 +4,7 @@
%>
<%def name="render_summary_content( workflow, steps )">
+
## <ul>
## <% num_steps = len ( steps ) %>
## <li>${num_steps} step${iff( num_steps != 1, "s", "" )}
12 years, 3 months
[hg] galaxy 3533: Add numpy egg, update bx_python egg (now with ...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/ac60740712de
changeset: 3533:ac60740712de
user: Nate Coraor <nate(a)bx.psu.edu>
date: Mon Mar 15 14:35:35 2010 -0400
description:
Add numpy egg, update bx_python egg (now with 100% more numpy) and include code that allows scrambling to depend on other eggs existing and being importable.
diffstat:
eggs.ini | 6 +-
lib/galaxy/eggs/dist.py | 5 +
lib/galaxy/eggs/scramble.py | 12 ++-
lib/pkg_resources.py | 148 ++++++++++++++++++++++------------
scripts/dist-scramble.py | 13 +++
scripts/scramble.py | 12 ++-
scripts/scramble/lib/scramble_lib.py | 36 +++-----
scripts/scramble/scripts/generic.py | 1 +
scripts/test_dist_egg.py | 53 ++++++++++++
9 files changed, 207 insertions(+), 79 deletions(-)
diffs (592 lines):
diff -r cfb0776875c0 -r ac60740712de eggs.ini
--- a/eggs.ini Mon Mar 15 14:05:25 2010 -0400
+++ b/eggs.ini Mon Mar 15 14:35:35 2010 -0400
@@ -16,6 +16,7 @@
Cheetah = 2.2.2
DRMAA_python = 0.2
MySQL_python = 1.2.3c1
+numpy = 1.3.0
pbs_python = 2.9.4
psycopg2 = 2.0.13
pycrypto = 2.0.1
@@ -59,7 +60,7 @@
psycopg2 = _8.4.2_static
pysqlite = _3.6.17_static
MySQL_python = _5.1.41_static
-bx_python = _dev_3b9d30e47619
+bx_python = _dev_f74aec067563
GeneTrack = _dev_48da9e998f0caf01c5be731e926f4b0481f658f0
SQLAlchemy = _dev_r6498
pysam = _kanwei_90e03180969d
@@ -70,3 +71,6 @@
MySQL_python = mysql-5.1.41
psycopg2 = postgresql-8.4.2
pysqlite = sqlite-amalgamation-3_6_17
+
+[dependencies]
+bx_python = numpy
diff -r cfb0776875c0 -r ac60740712de lib/galaxy/eggs/dist.py
--- a/lib/galaxy/eggs/dist.py Mon Mar 15 14:05:25 2010 -0400
+++ b/lib/galaxy/eggs/dist.py Mon Mar 15 14:35:35 2010 -0400
@@ -72,6 +72,10 @@
sources = self.config.get( 'source', name ).split()
except:
sources = []
+ try:
+ dependencies = self.config.get( 'dependencies', name ).split()
+ except:
+ dependencies = []
if full_platform:
platforms = self.platforms
else:
@@ -83,4 +87,5 @@
host_info = self.hosts[platform].split()
egg.build_host, egg.python = host_info[:2]
egg.sources = sources
+ egg.dependencies = dependencies
self.eggs[name].append( egg )
diff -r cfb0776875c0 -r ac60740712de lib/galaxy/eggs/scramble.py
--- a/lib/galaxy/eggs/scramble.py Mon Mar 15 14:05:25 2010 -0400
+++ b/lib/galaxy/eggs/scramble.py Mon Mar 15 14:35:35 2010 -0400
@@ -3,7 +3,7 @@
"""
import os, sys, shutil, tempfile, subprocess, urlparse, urllib
-from __init__ import Egg, Crate, URLRetriever, galaxy_dir, py, unpack_zipfile
+from __init__ import Egg, Crate, URLRetriever, galaxy_dir, py, unpack_zipfile, EggNotFetchable
from distutils.sysconfig import get_config_var
import tarfile, zipfile, zlib
@@ -37,6 +37,7 @@
def __init__( self, *args, **kwargs ):
Egg.__init__( self, *args, **kwargs )
self.sources = []
+ self.dependencies = []
self.buildpath = None
self.source_path = None
self.py = py
@@ -184,6 +185,11 @@
tagfile = open( os.path.join( self.buildpath, ".galaxy_tag" ), "w" )
tagfile.write( self.tag + '\n' )
tagfile.close()
+ if self.dependencies:
+ depfile = open( os.path.join( self.buildpath, ".galaxy_deps" ), "w" )
+ for dependency in self.dependencies:
+ depfile.write( dependency + '\n' )
+ depfile.close()
def run_scramble_script( self ):
log.warning( "%s(): Beginning build" % sys._getframe().f_code.co_name )
# subprocessed to sterilize the env
@@ -211,6 +217,10 @@
egg.sources = self.config.get( "source", egg.name ).split()
except:
egg.sources = []
+ try:
+ egg.dependencies = self.config.get( "dependencies", egg.name ).split()
+ except:
+ egg.dependencies = []
def parse_egg_section( self, *args, **kwargs ):
kwargs['egg_class'] = ScrambleEgg
Crate.parse_egg_section( self, *args, **kwargs )
diff -r cfb0776875c0 -r ac60740712de lib/pkg_resources.py
--- a/lib/pkg_resources.py Mon Mar 15 14:05:25 2010 -0400
+++ b/lib/pkg_resources.py Mon Mar 15 14:35:35 2010 -0400
@@ -13,26 +13,67 @@
method.
"""
-import sys, os, zipimport, time, re, imp, new
+import sys, os, zipimport, time, re, imp
try:
frozenset
except NameError:
from sets import ImmutableSet as frozenset
-from os import utime, rename, unlink # capture these to bypass sandboxing
+# capture these to bypass sandboxing
+from os import utime, rename, unlink, mkdir
from os import open as os_open
-
-
-
-
-
-
-
-
-
-
-
+from os.path import isdir, split
+
+
+def _bypass_ensure_directory(name, mode=0777):
+ # Sandbox-bypassing version of ensure_directory()
+ dirname, filename = split(name)
+ if dirname and filename and not isdir(dirname):
+ _bypass_ensure_directory(dirname)
+ mkdir(dirname, mode)
+
+
+
+
+
+
+
+_state_vars = {}
+
+def _declare_state(vartype, **kw):
+ g = globals()
+ for name, val in kw.iteritems():
+ g[name] = val
+ _state_vars[name] = vartype
+
+def __getstate__():
+ state = {}
+ g = globals()
+ for k, v in _state_vars.iteritems():
+ state[k] = g['_sget_'+v](g[k])
+ return state
+
+def __setstate__(state):
+ g = globals()
+ for k, v in state.iteritems():
+ g['_sset_'+_state_vars[k]](k, g[k], v)
+ return state
+
+def _sget_dict(val):
+ return val.copy()
+
+def _sset_dict(key, ob, state):
+ ob.clear()
+ ob.update(state)
+
+def _sget_object(val):
+ return val.__getstate__()
+
+def _sset_object(key, ob, state):
+ ob.__setstate__(state)
+
+_sget_none = _sset_none = lambda *args: None
@@ -164,14 +205,8 @@
def _macosx_vers(_cache=[]):
if not _cache:
- info = os.popen('/usr/bin/sw_vers').read().splitlines()
- for line in info:
- key, value = line.split(None, 1)
- if key == 'ProductVersion:':
- _cache.append(value.strip().split("."))
- break
- else:
- raise ValueError, "What?!"
+ from platform import mac_ver
+ _cache.append(mac_ver()[0].split('.'))
return _cache[0]
def _macosx_arch(machine):
@@ -203,6 +238,12 @@
+
+
+
+
+
+
def compatible_platforms(provided,required):
"""Can code for the `provided` platform run on the `required` platform?
@@ -387,7 +428,7 @@
def add_entry(self, entry):
"""Add a path item to ``.entries``, finding any distributions on it
- ``find_distributions(entry,False)`` is used to find distributions
+ ``find_distributions(entry, True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already present.
(This is because ``sys.path`` can contain the same value more than
@@ -622,7 +663,6 @@
activated to fulfill the requirements; all relevant distributions are
included, even if they were already activated in this working set.
"""
-
needed = self.resolve(parse_requirements(requirements))
for dist in needed:
@@ -630,7 +670,6 @@
return needed
-
def subscribe(self, callback):
"""Invoke `callback` for all distributions (including existing ones)"""
if callback in self.callbacks:
@@ -639,19 +678,21 @@
for dist in self:
callback(dist)
-
def _added_new(self, dist):
for callback in self.callbacks:
callback(dist)
-
-
-
-
-
-
-
-
+ def __getstate__(self):
+ return (
+ self.entries[:], self.entry_keys.copy(), self.by_key.copy(),
+ self.callbacks[:]
+ )
+
+ def __setstate__(self, (entries, keys, by_key, callbacks)):
+ self.entries = entries[:]
+ self.entry_keys = keys.copy()
+ self.by_key = by_key.copy()
+ self.callbacks = callbacks[:]
class Environment(object):
@@ -916,7 +957,7 @@
extract_path = self.extraction_path or get_default_cache()
target_path = os.path.join(extract_path, archive_name+'-tmp', *names)
try:
- ensure_directory(target_path)
+ _bypass_ensure_directory(target_path)
except:
self.extraction_error()
@@ -1188,7 +1229,9 @@
)
def _fn(self, base, resource_name):
- return os.path.join(base, *resource_name.split('/'))
+ if resource_name:
+ return os.path.join(base, *resource_name.split('/'))
+ return base
def _get(self, path):
if hasattr(self.loader, 'get_data'):
@@ -1226,8 +1269,6 @@
-
-
class DefaultProvider(EggProvider):
"""Provides access to package resources in the filesystem"""
@@ -1597,7 +1638,7 @@
-_distribution_finders = {}
+_declare_state('dict', _distribution_finders = {})
def register_finder(importer_type, distribution_finder):
"""Register `distribution_finder` to find distributions in sys.path items
@@ -1646,7 +1687,7 @@
"""Yield distributions accessible on a sys.path directory"""
path_item = _normalize_cached(path_item)
- if os.path.isdir(path_item):
+ if os.path.isdir(path_item) and os.access(path_item, os.R_OK):
if path_item.lower().endswith('.egg'):
# unpacked egg
yield Distribution.from_filename(
@@ -1679,8 +1720,8 @@
break
register_finder(ImpWrapper,find_on_path)
-_namespace_handlers = {}
-_namespace_packages = {}
+_declare_state('dict', _namespace_handlers = {})
+_declare_state('dict', _namespace_packages = {})
def register_namespace_handler(importer_type, namespace_handler):
"""Register `namespace_handler` to declare namespace packages
@@ -1709,7 +1750,7 @@
return None
module = sys.modules.get(packageName)
if module is None:
- module = sys.modules[packageName] = new.module(packageName)
+ module = sys.modules[packageName] = imp.new_module(packageName)
module.__path__ = []; _set_parent_ns(packageName)
elif not hasattr(module,'__path__'):
raise TypeError("Not a package:", packageName)
@@ -1862,7 +1903,7 @@
The algorithm assumes that strings like "-" and any alpha string that
alphabetically follows "final" represents a "patch level". So, "2.4-1"
is assumed to be a branch or patch of "2.4", and therefore "2.4.1" is
- considered newer than "2.4-1", whic in turn is newer than "2.4".
+ considered newer than "2.4-1", which in turn is newer than "2.4".
Strings like "a", "b", "c", "alpha", "beta", "candidate" and so on (that
come before "final" alphabetically) are assumed to be pre-release versions,
@@ -1871,7 +1912,8 @@
Finally, to handle miscellaneous cases, the strings "pre", "preview", and
"rc" are treated as if they were "c", i.e. as though they were release
candidates, and therefore are not as new as a version string that does not
- contain them.
+ contain them, and "dev" is replaced with an '@' so that it sorts lower than
+ than any other pre-release tag.
"""
parts = []
for part in _parse_version_parts(s.lower()):
@@ -2219,12 +2261,9 @@
if not loc:
return
- if path is sys.path:
- self.check_version_conflict()
-
nloc = _normalize_cached(loc)
bdir = os.path.dirname(nloc)
- npath= map(_normalize_cached, path)
+ npath= [(p and _normalize_cached(p) or p) for p in path]
bp = None
for p, item in enumerate(npath):
@@ -2232,10 +2271,14 @@
break
elif item==bdir and self.precedence==EGG_DIST:
# if it's an .egg, give it precedence over its directory
+ if path is sys.path:
+ self.check_version_conflict()
path.insert(p, loc)
npath.insert(p, nloc)
break
else:
+ if path is sys.path:
+ self.check_version_conflict()
path.append(loc)
return
@@ -2252,7 +2295,6 @@
return
-
def check_version_conflict(self):
if self.key=='setuptools':
return # ignore the inevitable setuptools self-conflicts :(
@@ -2266,7 +2308,7 @@
continue
fn = getattr(sys.modules[modname], '__file__', None)
- if fn and normalize_path(fn).startswith(loc):
+ if fn and (normalize_path(fn).startswith(loc) or fn.startswith(loc)):
continue
issue_warning(
"Module %s was already imported from %s, but %s is being added"
@@ -2443,7 +2485,7 @@
def __contains__(self,item):
if isinstance(item,Distribution):
- if item.key <> self.key: return False
+ if item.key != self.key: return False
if self.index: item = item.parsed_version # only get if we need it
elif isinstance(item,basestring):
item = parse_version(item)
@@ -2540,7 +2582,7 @@
os.open = old_open # and then put it back
-# Set up global resource manager
+# Set up global resource manager (deliberately not state-saved)
_manager = ResourceManager()
def _initialize(g):
for name in dir(_manager):
@@ -2549,7 +2591,7 @@
_initialize(globals())
# Prepare the master working set and make the ``require()`` API available
-working_set = WorkingSet()
+_declare_state('object', working_set = WorkingSet())
try:
# Does the main program list any requirements?
from __main__ import __requires__
diff -r cfb0776875c0 -r ac60740712de scripts/dist-scramble.py
--- a/scripts/dist-scramble.py Mon Mar 15 14:05:25 2010 -0400
+++ b/scripts/dist-scramble.py Mon Mar 15 14:35:35 2010 -0400
@@ -32,6 +32,19 @@
failed = []
for egg in eggs:
try:
+ for dependency in egg.dependencies:
+ print "Checking %s dependency: %s" % ( egg.name, dependency )
+ # this could be in a better data structure...
+ dep = filter( lambda x: x.platform == egg.platform, c[dependency] )[0]
+ dep.resolve()
+ except EggNotFetchable, e:
+ degg = e.eggs[0]
+ print "%s build dependency %s %s %s couldn't be" % ( egg.name, degg.name, degg.version, degg.platform )
+ print "downloaded automatically. There isn't really a graceful"
+ print "way to handle this when dist-scrambling."
+ failed.append( egg.platform )
+ continue
+ try:
egg.scramble()
except ScrambleFailure:
failed.append( egg.platform )
diff -r cfb0776875c0 -r ac60740712de scripts/scramble.py
--- a/scripts/scramble.py Mon Mar 15 14:05:25 2010 -0400
+++ b/scripts/scramble.py Mon Mar 15 14:35:35 2010 -0400
@@ -14,7 +14,7 @@
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
sys.path.append( lib )
-from galaxy.eggs.scramble import ScrambleCrate, ScrambleFailure
+from galaxy.eggs.scramble import ScrambleCrate, ScrambleFailure, EggNotFetchable
c = ScrambleCrate()
@@ -31,6 +31,16 @@
except:
print "error: %s not in eggs.ini" % name
sys.exit( 1 )
+ for dependency in egg.dependencies:
+ print "Checking %s dependency: %s" % ( egg.name, dependency )
+ try:
+ c[dependency].require()
+ except EggNotFetchable, e:
+ degg = e.eggs[0]
+ print "%s build dependency %s %s couldn't be downloaded" % ( egg.name, degg.name, degg.version )
+ print "automatically. You can try building it by hand with:"
+ print " python scripts/scramble.py %s" % degg.name
+ sys.exit( 1 )
egg.scramble()
sys.exit( 0 )
except ScrambleFailure, e:
diff -r cfb0776875c0 -r ac60740712de scripts/scramble/lib/scramble_lib.py
--- a/scripts/scramble/lib/scramble_lib.py Mon Mar 15 14:05:25 2010 -0400
+++ b/scripts/scramble/lib/scramble_lib.py Mon Mar 15 14:35:35 2010 -0400
@@ -21,6 +21,15 @@
except:
return None
+def get_deps():
+ try:
+ depf = open( '.galaxy_deps', 'r' )
+ except:
+ return []
+ c = eggs.Crate()
+ for dep in depf:
+ c[dep.strip()].require()
+
def clean( extra_dirs=[] ):
for dir in [ 'build', 'dist' ] + extra_dirs:
try:
@@ -127,29 +136,10 @@
else:
return 'gcc'
-# Monkeypatch pkg_resources for better ABI recognition
-def _get_platform():
- plat = distutils.util._get_platform()
- if sys.version_info[:2] == ( 2, 5 ) and \
- ( ( os.uname()[-1] in ( 'i386', 'ppc' ) and sys.platform == 'darwin' and os.path.abspath( sys.prefix ).startswith( '/System' ) ) or \
- ( sys.platform == 'darwin' and get_config_vars().get('UNIVERSALSDK', '').strip() ) ):
- plat = 'macosx-10.3-fat'
- if sys.platform == "sunos5" and not (plat.endswith('_32') or plat.endswith('_64')):
- if sys.maxint > 2**31:
- plat += '_64'
- else:
- plat += '_32'
- if not (plat.endswith('-ucs2') or plat.endswith('-ucs4')):
- if sys.maxunicode > 2**16:
- plat += '-ucs4'
- else:
- plat += '-ucs2'
- return plat
-try:
- assert distutil.util._get_platform
-except:
- distutils.util._get_platform = distutils.util.get_platform
- distutils.util.get_platform = _get_platform
+# get galaxy eggs lib
+galaxy_lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '..', '..', '..', 'lib' ) )
+sys.path.insert( 0, galaxy_lib )
+from galaxy import eggs
# get setuptools
from ez_setup import use_setuptools
diff -r cfb0776875c0 -r ac60740712de scripts/scramble/scripts/generic.py
--- a/scripts/scramble/scripts/generic.py Mon Mar 15 14:05:25 2010 -0400
+++ b/scripts/scramble/scripts/generic.py Mon Mar 15 14:35:35 2010 -0400
@@ -9,6 +9,7 @@
from scramble_lib import *
tag = get_tag() # get the tag
+get_deps() # require any dependent eggs
clean() # clean up any existing stuff (could happen if you run scramble.py by hand)
# reset args for distutils
diff -r cfb0776875c0 -r ac60740712de scripts/test_dist_egg.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/test_dist_egg.py Mon Mar 15 14:35:35 2010 -0400
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+"""
+A crude script for minimal "testing" of dist eggs (require and import). It may
+not work on all zipped eggs. It may be easiest to just customize this script
+for whatever egg you want to test.
+
+usage: test_dist_egg.py <egg_name>
+"""
+import os, sys, logging, subprocess
+
+try:
+ assert sys.argv[1]
+except:
+ print __doc__
+ sys.exit( 1 )
+
+lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
+sys.path.insert( 0, lib )
+
+if sys.argv[1].endswith( '.egg' ):
+
+ egg = sys.argv[1]
+ egg_name = os.path.basename( egg ).split( '-' )[0]
+ sys.path.insert( 0, egg )
+
+ import pkg_resources
+ pkg_resources.require( egg_name )
+ provider = pkg_resources.get_provider( egg_name )
+ importables = provider.get_metadata('top_level.txt').splitlines()
+
+ for importable in importables:
+ mod = __import__( importable )
+ assert os.path.dirname( mod.__path__[0] ) == os.path.dirname( provider.module_path )
+ print "OK"
+
+ sys.exit( 0 )
+
+else:
+
+ build_dir = os.path.join( os.path.dirname( os.path.abspath( __file__ ) ), 'scramble', 'build' )
+ if os.path.exists( build_dir ):
+ raise Exception( 'Build dir must be removed before testing: %s' % build_dir )
+
+ name = sys.argv[1]
+
+ from galaxy.eggs.dist import DistScrambleCrate
+
+ c = DistScrambleCrate()
+
+ for egg in c[name]:
+ print 'Checking %s %s for %s on %s' % ( name, egg.version, egg.platform, egg.build_host )
+ p = subprocess.Popen( 'ssh %s %s %s %s %s' % ( egg.build_host, egg.python, os.path.abspath( __file__ ), egg.distribution.location, egg.platform ), shell=True )
+ p.wait()
12 years, 3 months
[hg] galaxy 3534: Fix a bug in removing conflicts from the eggs ...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/447c059a096a
changeset: 3534:447c059a096a
user: Nate Coraor <nate(a)bx.psu.edu>
date: Mon Mar 15 15:06:14 2010 -0400
description:
Fix a bug in removing conflicts from the eggs directory
diffstat:
lib/galaxy/eggs/__init__.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r ac60740712de -r 447c059a096a lib/galaxy/eggs/__init__.py
--- a/lib/galaxy/eggs/__init__.py Mon Mar 15 14:35:35 2010 -0400
+++ b/lib/galaxy/eggs/__init__.py Mon Mar 15 15:06:14 2010 -0400
@@ -2,7 +2,7 @@
Manage Galaxy eggs
"""
-import os, sys, glob, urllib, urllib2, ConfigParser, HTMLParser, zipimport, zipfile
+import os, sys, shutil, glob, urllib, urllib2, ConfigParser, HTMLParser, zipimport, zipfile
import logging
log = logging.getLogger( __name__ )
@@ -281,7 +281,7 @@
for egg in eggs:
try:
egg.resolve()
- except:
+ except EggNotFetchable:
missing.append( egg )
if missing:
raise EggNotFetchable( missing )
12 years, 3 months
[hg] galaxy 3532: Fix migration script's default value for 'dele...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/cfb0776875c0
changeset: 3532:cfb0776875c0
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Mon Mar 15 14:05:25 2010 -0400
description:
Fix migration script's default value for 'deleted' column in visualization table. Because visualizations are not in use yet, effects are small, and manual fix is easy, it's not necessary to use another migration script to fix this problem. Fix, then, is largely for reference purposes.
diffstat:
lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diffs (15 lines):
diff -r 3c124a19ae94 -r cfb0776875c0 lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py
--- a/lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py Mon Mar 15 12:40:30 2010 -0400
+++ b/lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py Mon Mar 15 14:05:25 2010 -0400
@@ -54,10 +54,8 @@
log.debug( "Creating visualization_user_share_association table failed: %s" % str( e ) )
# Get default boolean value 'false' so that columns can be initialized.
- if migrate_engine.name == 'mysql':
+ if migrate_engine.name == 'mysql' or migrate_engine.name == 'sqlite':
default_false = "0"
- elif migrate_engine.name == 'sqlite':
- default_false = "'false'"
elif migrate_engine.name == 'postgres':
default_false = "false"
12 years, 3 months
[hg] galaxy 3531: lims: automatic update of sample state when th...
by Greg Von Kuster
details: http://www.bx.psu.edu/hg/galaxy/rev/3c124a19ae94
changeset: 3531:3c124a19ae94
user: rc
date: Mon Mar 15 12:40:30 2010 -0400
description:
lims: automatic update of sample state when the state is changed in th db (using scanner etc)
diffstat:
lib/galaxy/web/controllers/requests_admin.py | 21 ++++++
templates/admin/requests/show_request.mako | 87 ++++++++++++++++++++++++---
templates/requests/sample_datasets.mako | 7 ++
templates/requests/sample_state.mako | 5 +
4 files changed, 109 insertions(+), 11 deletions(-)
diffs (175 lines):
diff -r 6d079d53f9db -r 3c124a19ae94 lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Mon Mar 15 11:31:14 2010 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Mon Mar 15 12:40:30 2010 -0400
@@ -231,6 +231,27 @@
def index( self, trans ):
return trans.fill_template( "/admin/requests/index.mako" )
+ @web.json
+ def sample_state_updates( self, trans, ids=None, states=None ):
+ # Avoid caching
+ trans.response.headers['Pragma'] = 'no-cache'
+ trans.response.headers['Expires'] = '0'
+ # Create new HTML for any that have changed
+ rval = {}
+ if ids is not None and states is not None:
+ ids = map( int, ids.split( "," ) )
+ states = states.split( "," )
+ for id, state in zip( ids, states ):
+ sample = trans.sa_session.query( self.app.model.Sample ).get( id )
+ if sample.current_state().name != state:
+ rval[id] = {
+ "state": sample.current_state().name,
+ "datasets": len(sample.dataset_files),
+ "html_state": unicode( trans.fill_template( "requests/sample_state.mako", sample=sample ), 'utf-8' ),
+ "html_datasets": unicode( trans.fill_template( "requests/sample_datasets.mako", trans=trans, sample=sample ), 'utf-8' )
+ }
+ return rval
+
@web.expose
@web.require_admin
def list( self, trans, **kwd ):
diff -r 6d079d53f9db -r 3c124a19ae94 templates/admin/requests/show_request.mako
--- a/templates/admin/requests/show_request.mako Mon Mar 15 11:31:14 2010 -0400
+++ b/templates/admin/requests/show_request.mako Mon Mar 15 12:40:30 2010 -0400
@@ -1,5 +1,7 @@
<%inherit file="/base.mako"/>
<%namespace file="/message.mako" import="render_msg" />
+<%namespace file="/requests/sample_state.mako" import="render_sample_state" />
+<%namespace file="/requests/sample_datasets.mako" import="render_sample_datasets" />
%if msg:
${render_msg( msg, messagetype )}
@@ -42,6 +44,54 @@
});
</script>
+<script type="text/javascript">
+ // Looks for changes in sample states using an async request. Keeps
+ // calling itself (via setTimeout) until all samples are in a terminal
+ // state.
+ var updater = function ( sample_states ) {
+ // Check if there are any items left to track
+ var empty = true;
+ for ( i in sample_states ) {
+ empty = false;
+ break;
+ }
+ if ( ! empty ) {
+ setTimeout( function() { updater_callback( sample_states ) }, 1000 );
+ }
+ };
+ var updater_callback = function ( sample_states ) {
+ // Build request data
+ var ids = []
+ var states = []
+ $.each( sample_states, function ( id, state ) {
+ ids.push( id );
+ states.push( state );
+ });
+ // Make ajax call
+ $.ajax( {
+ type: "POST",
+ url: "${h.url_for( controller='requests_admin', action='sample_state_updates' )}",
+ dataType: "json",
+ data: { ids: ids.join( "," ), states: states.join( "," ) },
+ success : function ( data ) {
+ $.each( data, function( id, val ) {
+ // Replace HTML
+ var cell1 = $("#sampleState-" + id);
+ cell1.html( val.html_state );
+ var cell2 = $("#sampleDatasets-" + id);
+ cell2.html( val.html_datasets );
+ sample_states[ parseInt(id) ] = val.state;
+ });
+ updater( sample_states );
+ },
+ error: function() {
+ // Just retry, like the old method, should try to be smarter
+ updater( sample_states );
+ }
+ });
+ };
+</script>
+
<style type="text/css">
.msg_head {
padding: 0px 0px;
@@ -162,15 +212,21 @@
%if sample_index in range(len(request.samples)):
<td>${info['name']}</td>
<td>${info['barcode']}</td>
- <td>
- %if sample:
- %if sample.request.unsubmitted():
- Unsubmitted
- %else:
- <a href="${h.url_for( controller='requests_admin', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a>
- %endif
- %endif
- </td>
+ %if sample.request.unsubmitted():
+ <td>Unsubmitted</td>
+ %else:
+ <td id="sampleState-${sample.id}">${render_sample_state( sample )}</td>
+ %endif
+
+## <td>
+## %if sample:
+## %if sample.request.unsubmitted():
+## Unsubmitted
+## %else:
+## <a href="${h.url_for( controller='requests_admin', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a>
+## %endif
+## %endif
+## </td>
%if info['library']:
<td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller='library', id=trans.security.encode_id( info['library'].id ) )}">${info['library'].name}</a></td>
%else:
@@ -182,8 +238,9 @@
<td></td>
%endif
%if request.submitted() or request.complete():
- <td>
- <a href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">${len(sample.dataset_files)}</a>
+ <td id="sampleDatasets-${sample.id}">
+ ${render_sample_datasets( sample )}
+## <a href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">${len(sample.dataset_files)}</a>
</td>
%endif
@@ -358,6 +415,14 @@
<label>There are no samples.</label>
%endif
</div>
+
+ %if request.samples and request.submitted():
+ <script type="text/javascript">
+ // Updater
+ updater({${ ",".join( [ '"%s" : "%s"' % ( s.id, s.current_state().name ) for s in request.samples ] ) }});
+ </script>
+ %endif
+
%if edit_mode == 'False':
<table class="grid">
<tbody>
diff -r 6d079d53f9db -r 3c124a19ae94 templates/requests/sample_datasets.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/requests/sample_datasets.mako Mon Mar 15 12:40:30 2010 -0400
@@ -0,0 +1,7 @@
+<%def name="render_sample_datasets( sample )">
+ <a href="${h.url_for(controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id))}">${sample.transferred_dataset_files()}</a>
+</%def>
+
+
+
+${render_sample_datasets( sample )}
diff -r 6d079d53f9db -r 3c124a19ae94 templates/requests/sample_state.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/requests/sample_state.mako Mon Mar 15 12:40:30 2010 -0400
@@ -0,0 +1,5 @@
+<%def name="render_sample_state( sample )">
+ <a href="${h.url_for( controller='requests_admin', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a>
+</%def>
+
+${render_sample_state( sample )}
12 years, 3 months