Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
flockwave-server / server / utils / packaging.py
Size: Mime:
"""Utility functions related to distributing the server as a packaged,
preferably single-file application.
"""

from functools import lru_cache

import sys

__all__ = ("is_oxidized", "is_packaged", "is_packaged_with_pyinstaller")


@lru_cache(maxsize=None)
def is_packaged() -> bool:
    """Returns whether the application is packaged."""
    return is_oxidized() or is_packaged_with_pyinstaller()


def is_oxidized() -> bool:
    """Returns whether the application is packaged with PyOxidizer."""
    return bool(getattr(sys, "oxidized", False))


def is_packaged_with_pyinstaller() -> bool:
    """Returns whether the application is packaged with PyInstaller."""
    return getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS")