Skip to content

Commit cd8a2a4

Browse files
committed
Add some comments
1 parent e7d1ea4 commit cd8a2a4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

setup.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434

3535
class IsalExtension(Extension):
36+
"""Custom extension to allow for targeted modification."""
3637
pass
3738

3839

@@ -72,15 +73,16 @@ def build_isa_l():
7273

7374

7475
def _add_extension_options(ext: Extension):
75-
possible_prefixes = [sys.exec_prefix, os.environ.get("CONDA_PREFIX"),
76-
sys.base_exec_prefix]
76+
# Check current environment (conda or venv first) or base system install
77+
# (in case of venv) for isa-l include directories. Link dynamically.
78+
possible_prefixes = [sys.exec_prefix, sys.base_exec_prefix]
7779
for prefix in possible_prefixes:
78-
if prefix and os.path.exists(os.path.join(prefix, "include", "isa-l")):
80+
if os.path.exists(os.path.join(prefix, "include", "isa-l")):
7981
# Readthedocs uses a conda environment but does not activate it.
8082
ext.include_dirs = [os.path.join(prefix, "include")]
8183
ext.libraries = ["isal"]
8284
break
83-
else:
85+
else: # If not installed, build isa-l and link statically.
8486
isa_l_prefix_dir = build_isa_l()
8587
ext.include_dirs = [os.path.join(isa_l_prefix_dir, "include")]
8688
# -fPIC needed for proper static linking

0 commit comments

Comments
 (0)