Skip to content

Commit 0fd38f2

Browse files
committed
#993 fix ironpython detection to match changes in ipy 2.7.12
1 parent 96a960a commit 0fd38f2

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/compas/__main__.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import print_function
33

4-
import sys
5-
import pkg_resources
6-
import compas
4+
import platform
5+
6+
try:
7+
import pkg_resources
8+
except ImportError:
9+
pkg_resources = None
710

11+
import compas
812

913
if __name__ == '__main__':
1014

@@ -19,11 +23,12 @@
1923
print('Yay! COMPAS is installed correctly!')
2024
print()
2125
print('COMPAS: {}'.format(compas.__version__))
22-
print('Python: {}'.format(str(sys.version)))
26+
print('Python: {} ({})'.format(platform.python_version(), platform.python_implementation()))
2327

24-
working_set = pkg_resources.working_set
25-
packages = set([p.project_name for p in working_set]) - set(['COMPAS'])
26-
compas_pkgs = [p for p in packages if p.lower().startswith('compas')]
28+
if pkg_resources:
29+
working_set = pkg_resources.working_set
30+
packages = set([p.project_name for p in working_set]) - set(['COMPAS'])
31+
compas_pkgs = [p for p in packages if p.lower().startswith('compas')]
2732

28-
if compas_pkgs:
29-
print('Extensions: {}'.format([p for p in compas_pkgs]))
33+
if compas_pkgs:
34+
print('Extensions: {}'.format([p for p in compas_pkgs]))

src/compas/_os.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
Not intended to be used outside compas* packages.
55
"""
66
import os
7+
import platform
78
import re
8-
import tempfile
99
import shutil
1010
import subprocess
1111
import sys
12+
import tempfile
1213

1314
try:
1415
NotADirectoryError
@@ -96,7 +97,7 @@ def is_ironpython():
9697
True if the implementation is IronPython. False otherwise
9798
9899
"""
99-
return 'ironpython' in sys.version.lower()
100+
return 'ironpython' == platform.python_implementation().lower()
100101

101102

102103
def is_rhino():

src/compas/data/encoders.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
from __future__ import division
44

55
import json
6-
import sys
6+
import platform
77

88
from compas.data.exceptions import DecoderError
99

1010
# We don't do this from `compas.IPY` to avoid circular imports
11-
if 'ironpython' in sys.version.lower():
11+
if 'ironpython' == platform.python_implementation().lower():
1212
try:
1313
from System.Collections.Generic import IDictionary
1414
except: # noqa: E722

0 commit comments

Comments
 (0)