def appdir_from_executable(exepath):
    """Find the top-level application directory, given sys.executable."""
    #  The standard layout is <appdir>/ESKY_APPDATA_DIR/<vdir>/<exepath>.
    #  Stripping of <exepath> is done by _bs_appdir_from_executable.
    vdir = _bs_appdir_from_executable(exepath)
    appdir = os.path.dirname(vdir)
    #  On OSX we sometimes need to strip an additional directory since the
    #  app can be contained in an <appname>.app directory.
    if sys.platform == "darwin" and is_version_dir(appdir):
        appdir = os.path.dirname(appdir)
    # TODO: remove compatability hook for ESKY_APPDATA_DIR=""
    if ESKY_APPDATA_DIR and os.path.basename(appdir) not in ESKY_APPDATA_DIR:
        appdir = os.path.dirname(appdir)
        # Remove trailing slash if at the root of a drive on win32
        if sys.platform == "win32" and len(appdir) == 3:
            appdir = appdir[:2]
    return appdir
dataset/ETHPy150Open cloudmatrix/esky/esky/util.py/appdir_from_executable/operator `==` -> `not in`