Skip to content

Compiled Femzip Library References #44

Description

@Vortex-CAE

Compiling with module with Pyinstaller breaks the Femzip Library References, requiring /lasso/femzip/*.dll's and .so's. to be packaged alongside the exe.

Additional path update allows library files to be explicitly added during compilation bundled in root of the EXE & referenced.

class FemzipAPI:
"""FemzipAPI contains wrapper functions around the femzip library."""

_api: Union[None, CDLL] = None
@staticmethod
def load_dynamic_library(path: str) -> CDLL:
"""Load a library and check for correct execution
Parameters
----------
path: str
path to the library
Returns
-------
library: CDLL
loaded library
"""
# check executable rights
if not os.access(path, os.X_OK) or not os.access(path, os.R_OK):
if getattr( sys, 'frozen', False ):
# running in a bundle
path = os.path.join(sys._MEIPASS, os.path.basename(path)) os.chmod(path, os.stat(path).st_mode | stat.S_IEXEC | stat.S_IREAD)
if not os.access(path, os.X_OK) or not os.access(path, os.R_OK):
err_msg = "Library '{0}' is not executable and couldn't change execution rights."
raise RuntimeError(err_msg.format(path))
return CDLL(path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions