Skip to content

Commit 9a694e8

Browse files
committed
bugfix version checking
1 parent 43c15e1 commit 9a694e8

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,22 @@
1616

1717
- fix deprecation warning
1818

19+
# CopomuS.py
20+
21+
- bugfix version checking
22+
1923
################################################################################
2024
################################################################################
2125

26+
250219 Martin Raden
27+
* python/CopomuS.py
28+
* python/copomus/IntaRNA.py
29+
* bugfix version checking (old string comparison fails for "3.12" < "3.7")
30+
31+
250214 Martin Raden
32+
+ conda-build-env.yml : environment to build IntaRNA
33+
* new github build workflow
34+
2235
250213 Martin Raden
2336
* R/IntaRNA_plotRegions.R
2437
* fix deprecation warning when using element_lines() with ggplot >= 3.4.0

python/CopomuS.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
import sys
1212
from platform import python_version
1313

14-
if python_version() < __python_min__:
15-
sys.stderr.write(f'CopomuS requires python >= {__python_min__}\n')
16-
sys.exit(1)
1714

1815
import csv
1916
from tempfile import gettempdir
@@ -26,6 +23,10 @@
2623
from copomus.mutation_generators import get_generator
2724

2825

26+
if IntaRNA.version_tuple(python_version()) < IntaRNA.version_tuple(__python_min__):
27+
sys.stderr.write(f'CopomuS requires python >= {__python_min__}\n')
28+
sys.exit(1)
29+
2930

3031
class CopomuS:
3132
def __init__(self):

python/copomus/IntaRNA.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,25 @@ class IntaRNA:
1111
def __init__(self):
1212
pass
1313

14+
@staticmethod
15+
def version_tuple(versionstring: str):
16+
"""
17+
Decomposes a version string into a tuple of entries
18+
:param versionstring: The string encoding of a version, i.e. dot-separated numbers
19+
"""
20+
return tuple(map(int, versionstring.split('.')))
21+
1422
@staticmethod
1523
def check_binary(required_version: str):
1624
"""
17-
Checks weather or not the IntaRNA binary can be found in PATH and exits with returncode 1 if not found.
25+
Checks weather or not the IntaRNA binary can be found in PATH and exits with return code 1 if not found.
1826
:param required_version: The minimum required version for IntaRNA
1927
"""
2028
p = run('IntaRNA --version', shell=True, stdout=PIPE, stderr=PIPE, universal_newlines=True)
2129
if p.returncode:
2230
sys.stderr.write('Please add the IntaRNA binary to your PATH.\n')
2331
sys.exit(1)
24-
if p.stdout.split('\n')[0].split()[1] < required_version:
32+
if IntaRNA.version_tuple(p.stdout.split('\n')[0].split()[1]) < IntaRNA.version_tuple(required_version):
2533
sys.stderr.write(f'This tool requires IntaRNA version {required_version}, please upgrade\n')
2634
sys.exit(1)
2735

0 commit comments

Comments
 (0)