comparison imagej2_base_utils.py @ 1:d26f11339f08 draft

planemo upload commit 18df9e67efd4adafcde4eb9b62cd815e4afe9733-dirty
author iuc
date Wed, 26 Aug 2015 14:37:41 -0400
parents 66d9e595dff2
children c026d0eddc3e
comparison
equal deleted inserted replaced
0:66d9e595dff2 1:d26f11339f08
84 # Remove the file so we can create a symlink. 84 # Remove the file so we can create a symlink.
85 os.remove( image_path ) 85 os.remove( image_path )
86 os.symlink( input_file, image_path ) 86 os.symlink( input_file, image_path )
87 return image_path 87 return image_path
88 88
89 def get_max_heap_size_value( max_heap_size_type, max_heap_size ):
90 """
91 Return a string that can be used by the javabridge to set the size
92 of the memory allocation pool used by the JVM. The value must be
93 determined to be a multiple of 1024 or it will be ignored.
94 """
95 if max_heap_size_type == 'default':
96 return None
97 if max_heap_size_type == 'megabytes':
98 if int( max_heap_size ) % 1024 not in [ 0, 256, 512 ]:
99 return None
100 return '%sm' % str( max_heap_size )
101 if max_heap_size_type == 'gigabytes':
102 return '%sg' % str( max_heap_size )
103
104 def get_platform_info_dict(): 89 def get_platform_info_dict():
105 '''Return a dict with information about the current platform.''' 90 '''Return a dict with information about the current platform.'''
106 platform_dict = {} 91 platform_dict = {}
107 sysname, nodename, release, version, machine = os.uname() 92 sysname, nodename, release, version, machine = os.uname()
108 platform_dict[ 'os' ] = sysname.lower() 93 platform_dict[ 'os' ] = sysname.lower()
170 else: 155 else:
171 if val_type == 'float': 156 if val_type == 'float':
172 return ' %.1f' % val 157 return ' %.1f' % val
173 elif val_type == 'int': 158 elif val_type == 'int':
174 return ' %d' % val 159 return ' %d' % val
160 return ' %s' % val
175 161
176 def stop_err( msg ): 162 def stop_err( msg ):
177 sys.stderr.write( msg ) 163 sys.stderr.write( msg )
178 sys.exit( 1 ) 164 sys.exit( 1 )