Skip to content

Commit

Permalink
Refactor the nmodl wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
JCGoran committed Feb 7, 2024
1 parent 15ed7a6 commit 8d27abe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions pywheel/shim/_binwrapper.py → nmodl/_binwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from find_libpython import find_libpython


def _config_exe(exe_name):
def main():
"""Sets the environment to run the real executable (returned)"""

package_name = "nmodl"
Expand All @@ -37,12 +37,7 @@ def _config_exe(exe_name):
# set PYTHONPATH for embedded python to properly find the nmodl module
os.environ["PYTHONPATH"] = working_set.by_key[package_name].location + ':' + os.environ.get("PYTHONPATH", "")

return os.path.join(NMODL_BIN, exe_name)


if __name__ == "__main__":
"""Set the pointed file as executable"""
exe = _config_exe(os.path.basename(sys.argv[0]))
exe = os.path.join(NMODL_BIN, os.path.basename(sys.argv[0]))
st = os.stat(exe)
os.chmod(exe, st.st_mode | stat.S_IEXEC)
os.execv(exe, sys.argv)
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies = [
"Jinja2>=2.9.3",
"PyYAML>=3.13",
]
scripts = {nmodl = "nmodl._binwrapper:main"}

[build-system]
requires = [
Expand Down
1 change: 0 additions & 1 deletion pywheel/shim/nmodl

This file was deleted.

0 comments on commit 8d27abe

Please sign in to comment.