[galaxy-commits] commit/galaxy-central: natefoo: If there is no env.sh in a tool dependency directory, but there is a subdirectory named 'bin', add the bin directory to $PATH.

Bitbucket commits-noreply at bitbucket.org
Mon Dec 12 21:40:44 EST 2011


1 new commit in galaxy-central:


https://bitbucket.org/galaxy/galaxy-central/changeset/55bb95ec5c2a/
changeset:   55bb95ec5c2a
user:        natefoo
date:        2011-12-13 03:40:37
summary:     If there is no env.sh in a tool dependency directory, but there is a subdirectory named 'bin', add the bin directory to $PATH.
affected #:  3 files

diff -r 09c6c980e463538443134a39c92ff7930738424c -r 55bb95ec5c2a3ce2ef7eaf0a79ec60365d7d1aec lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -1754,8 +1754,10 @@
             log.debug( "Dependency %s", requirement.name )
             if requirement.type == 'package':
                 script_file, base_path, version = self.app.toolbox.dependency_manager.find_dep( requirement.name, requirement.version )
-                if script_file is None:
+                if script_file is None and base_path is None:
                     log.warn( "Failed to resolve dependency on '%s', ignoring", requirement.name )
+                elif script_file is None:
+                    commands.append( 'PACKAGE_BASE=%s; export PACKAGE_BASE; PATH="%s/bin:$PATH"; export PATH' % ( base_path, base_path ) )
                 else:
                     commands.append( 'PACKAGE_BASE=%s; export PACKAGE_BASE; . %s' % ( base_path, script_file ) )
         return commands


diff -r 09c6c980e463538443134a39c92ff7930738424c -r 55bb95ec5c2a3ce2ef7eaf0a79ec60365d7d1aec lib/galaxy/tools/deps/__init__.py
--- a/lib/galaxy/tools/deps/__init__.py
+++ b/lib/galaxy/tools/deps/__init__.py
@@ -47,6 +47,8 @@
             script = os.path.join( path, 'env.sh' )
             if os.path.exists( script ):
                 return script, path, version
+            elif os.path.exists( os.path.join( path, 'bin' ) ):
+                return None, path, version
         else:
             return None, None, None
     def _find_dep_default( self, name ):
@@ -55,9 +57,12 @@
             path = os.path.join( base_path, name, 'default' )
             if os.path.islink( path ):
                 real_path = os.path.realpath( path )
+                real_bin = os.path.join( real_path, 'bin' )
                 real_version = os.path.basename( real_path )
                 script = os.path.join( real_path, 'env.sh' )
                 if os.path.exists( script ):
                     return script, real_path, real_version
+                elif os.path.exists( os.path.join( real_path, 'bin' ) ):
+                    return None, real_path, real_version
         else:
             return None, None, None


diff -r 09c6c980e463538443134a39c92ff7930738424c -r 55bb95ec5c2a3ce2ef7eaf0a79ec60365d7d1aec lib/galaxy/tools/deps/tests.py
--- a/lib/galaxy/tools/deps/tests.py
+++ b/lib/galaxy/tools/deps/tests.py
@@ -14,20 +14,19 @@
     # Setup directories
     base_path = tempfile.mkdtemp()
     # mkdir( base_path )
-    for name, version in [ ( "dep1", "1.0" ), ( "dep1", "2.0" ), ( "dep2", "1.0" ) ]:
-        p = os.path.join( base_path, name, version ) 
+    for name, version, sub in [ ( "dep1", "1.0", "env.sh" ), ( "dep1", "2.0", "bin" ), ( "dep2", "1.0", None ) ]:
+        if sub == "bin":
+            p = os.path.join( base_path, name, version, "bin" ) 
+        else:
+            p = os.path.join( base_path, name, version ) 
         try:
             makedirs( p )
         except:
             pass
-        touch( os.path.join( p, "env.sh" ) )
+        if sub == "env.sh":
+            touch( os.path.join( p, "env.sh" ) )
 
     dm = galaxy.tools.deps.DependencyManager( [ base_path ] )
 
+    print dm.find_dep( "dep1", "1.0" )
     print dm.find_dep( "dep1", "2.0" )
-
-    
-
-
-
-

Repository URL: https://bitbucket.org/galaxy/galaxy-central/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the galaxy-commits mailing list