Skip to content

Commit

Permalink
cleanup debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Wahl committed Aug 29, 2024
1 parent 5611692 commit 03f3486
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions Nagstamon/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,17 +1062,11 @@ def __init__(self, **kwds):
executable_dir = os.path.join(os.sep.join(sys.executable.split(os.sep)[:-1]))
if os.path.exists(os.path.normcase(os.sep.join((executable_dir, "resources")))):
RESOURCES = os.path.normcase(os.sep.join((executable_dir, "resources")))

print('resources 1: ' + RESOURCES)

else:
import pkg_resources

RESOURCES = pkg_resources.resource_filename("Nagstamon", "resources")

print('resources 2: ' + RESOURCES)


except Exception as err:
# get resources directory from current directory - only if not being set before by pkg_resources
# try-excepts necessary for platforms like Windows .EXE
Expand All @@ -1082,15 +1076,13 @@ def __init__(self, **kwds):
# if resources dir is not available in CWD, try the
# libs dir (site-packages) for the current Python
from distutils.sysconfig import get_python_lib

paths_to_check.append(os.path.normcase(os.path.join(get_python_lib(), "Nagstamon", "resources")))
except Exception:
pass

# if we're still out of luck, maybe this was a user scheme install
try:
import site

site.getusersitepackages() # make sure USER_SITE is set
paths_to_check.append(os.path.normcase(os.path.join(site.USER_SITE, "Nagstamon", "resources")))
except Exception:
Expand All @@ -1103,13 +1095,10 @@ def __init__(self, **kwds):
if os.path.exists(path):
RESOURCES = path
print('resources 3: ' + RESOURCES, paths_to_check)

break
else:
RESOURCES = str(Path(__file__).parent.absolute().joinpath('resources'))

print('resources 4: ' + RESOURCES)

# try to fix missing resources path for Windows
if OS == OS_WINDOWS:
if r'\_internal\Nagstamon\resources' in RESOURCES:
Expand Down

0 comments on commit 03f3486

Please sign in to comment.