1 | import tempfile |
---|
2 | import os.path |
---|
3 | from os import makedirs, mkdir |
---|
4 | import galaxy.tools.deps |
---|
5 | |
---|
6 | def touch( fname, data=None ): |
---|
7 | f = open( fname, 'w' ) |
---|
8 | if data: |
---|
9 | f.write( data ) |
---|
10 | f.close() |
---|
11 | |
---|
12 | def test(): |
---|
13 | |
---|
14 | # Setup directories |
---|
15 | base_path = tempfile.mkdtemp() |
---|
16 | # mkdir( base_path ) |
---|
17 | for name, version in [ ( "dep1", "1.0" ), ( "dep1", "2.0" ), ( "dep2", "1.0" ) ]: |
---|
18 | p = os.path.join( base_path, name, version ) |
---|
19 | try: |
---|
20 | makedirs( p ) |
---|
21 | except: |
---|
22 | pass |
---|
23 | touch( os.path.join( p, "env.sh" ) ) |
---|
24 | |
---|
25 | dm = galaxy.tools.deps.DependencyManager( [ base_path ] ) |
---|
26 | |
---|
27 | print dm.find_dep( "dep1", "2.0" ) |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | |
---|