Skip to content

Commit 521ea37

Browse files
committed
setup.py: Fail if old psamm-import is installed
1 parent 28d9f68 commit 521ea37

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,38 @@
1616
#
1717
# Copyright 2014-2017 Jon Lund Steffensen <[email protected]>
1818

19+
from __future__ import print_function
20+
21+
import sys
1922
from setuptools import setup, find_packages
23+
import pkg_resources
2024

2125
# Read long description
2226
with open('README.rst') as f:
2327
long_description = f.read()
2428

29+
# Test whether psamm-import is currently installed. Since the psamm-import
30+
# functionality was moved to this package (except Excel importers), only newer
31+
# versions of psamm-import are compatible with recent versions of PSAMM.
32+
try:
33+
pkg_resources.get_distribution('psamm-import <= 0.15.2')
34+
except (pkg_resources.DistributionNotFound,
35+
pkg_resources.VersionConflict):
36+
pass
37+
else:
38+
msg = (
39+
'Please upgrade or uninstall psamm-import before upgrading psamm:\n'
40+
'$ pip install --upgrade psamm-import\n'
41+
' OR\n'
42+
'$ pip uninstall psamm-import'
43+
'\n\n'
44+
' The functionality of the psamm-import package has been moved into'
45+
' the psamm package, and the psamm-import package now only contains'
46+
' the model-specific Excel importers.')
47+
print(msg, file=sys.stderr)
48+
sys.exit(1)
49+
50+
2551
setup(
2652
name='psamm',
2753
version='0.30',

0 commit comments

Comments
 (0)