Skip to content

Commit

Permalink
get library extension suffix from built-in method (deepmodeling#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz authored Aug 25, 2021
1 parent 331f97e commit 196b1dc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions deepmd/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
import os
import platform
import distutils.ccompiler
from configparser import ConfigParser
from imp import reload
from pathlib import Path
Expand Down Expand Up @@ -156,12 +156,8 @@ def get_module(module_name: str) -> "ModuleType":
FileNotFoundError
if module is not found in directory
"""
if platform.system() == "Windows":
ext = ".dll"
elif platform.system() == "Darwin":
ext = ".dylib"
else:
ext = ".so"
# https://discuss.python.org/t/how-to-get-the-file-extension-of-dynamic-libraries-for-current-os/3916/5
ext = distutils.ccompiler.new_compiler().shared_lib_extension

module_file = (
(Path(__file__).parent / SHARED_LIB_MODULE / module_name)
Expand Down

0 comments on commit 196b1dc

Please sign in to comment.