proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1"""
2Copyright (C) 2022 LAAS-CNRS, INRIA
3"""
4
5# On Windows, if proxsuite-nlp.dll is not in the same directory than
6# the .pyd, it will not be loaded.
7# We first try to load proxsuite-nlp, then, if it fail and we are on Windows:
8# 1. We add all paths inside proxsuite-nlp_WINDOWS_DLL_PATH to DllDirectory
9# 2. If proxsuite-nlp_WINDOWS_DLL_PATH we add the relative path from the
10# package directory to the bin directory to DllDirectory
11# This solution is inspired from:
12# - https://github.com/PixarAnimationStudios/OpenUSD/pull/1511/files
13# - https://stackoverflow.com/questions/65334494/python-c-extension-packaging-dll-along-with-pyd
14# More resources on https://github.com/diffpy/pyobjcryst/issues/33
15try:
16 from .pyproxsuite_nlp import *
17 from .pyproxsuite_nlp import __version__
18except ImportError:
19 import platform
20
21 if platform.system() == "Windows":
22 from .windows_dll_manager import get_dll_paths, build_directory_manager
23
24 with build_directory_manager() as dll_dir_manager:
25 for p in get_dll_paths():
26 dll_dir_manager.add_dll_directory(p)
27 from .pyproxsuite_nlp import *
28 from .pyproxsuite_nlp import __version__
29 else:
30 raise
31
32from . import utils
33
34
35def __process():
36 import sys
37 import inspect
38 from . import pyproxsuite_nlp
39
40 lib_name = "proxsuite_nlp"
41
42 submodules = inspect.getmembers(pyproxsuite_nlp, inspect.ismodule)
43 for mod_info in submodules:
44 mod_name = "{}.{}".format(lib_name, mod_info[0])
45 sys.modules[mod_name] = mod_info[1]
46 mod_info[1].__file__ = pyproxsuite_nlp.__file__
47 mod_info[1].__name__ = mod_name
48
49
50__process()