kopia lustrzana https://github.com/inkstitch/inkstitch
fix: generate-inx-files failing with Nix
Fixes the following error when attempting to build the Nix package: python bin/generate-inx-files; Traceback (most recent call last): File "/build/inkstitch/bin/generate-inx-files", line 59, in <module> from lib.inx.generate import generate_inx_files File "/build/inkstitch/lib/inx/generate.py", line 6, in <module> from .extensions import generate_extension_inx_files File "/build/inkstitch/lib/inx/extensions.py", line 10, in <module> from ..commands import (COMMANDS, GLOBAL_COMMANDS, LAYER_COMMANDS, File "/build/inkstitch/lib/commands.py", line 16, in <module> from .i18n import N_, _ File "/build/inkstitch/lib/i18n.py", line 10, in <module> from .utils import cache, get_resource_dir File "/build/inkstitch/lib/utils/__init__.py", line 6, in <module> from . import cache as cache_module # Slight hack to allow cache to be imported for monkeypatching ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/inkstitch/lib/utils/cache.py", line 13, in <module> from lib.utils.settings import global_settings File "/build/inkstitch/lib/utils/settings.py", line 84, in <module> global_settings = GlobalSettings() ^^^^^^^^^^^^^^^^ File "/build/inkstitch/lib/utils/settings.py", line 48, in __init__ self.__settings_file = os.path.join(get_user_dir(), "settings.json") ^^^^^^^^^^^^^^ File "/build/inkstitch/lib/utils/paths.py", line 50, in get_user_dir os.makedirs(path) File "<frozen os>", line 215, in makedirs File "<frozen os>", line 215, in makedirs File "<frozen os>", line 225, in makedirs PermissionError: [Errno 13] Permission denied: '/homeless-shelter'pull/3826/head
rodzic
84387f8a10
commit
2b0edd86db
|
@ -41,12 +41,12 @@ def get_resource_dir(name):
|
|||
return realpath(os.path.join(dirname(realpath(__file__)), '..', '..', name))
|
||||
|
||||
|
||||
def get_user_dir(name=None):
|
||||
def get_user_dir(name=None, create=True):
|
||||
try:
|
||||
path = platformdirs.user_config_dir('inkstitch')
|
||||
except ImportError:
|
||||
path = os.path.expanduser('~/.inkstitch')
|
||||
if not os.path.exists(path):
|
||||
if create and not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
if name is not None:
|
||||
|
|
|
@ -45,7 +45,11 @@ DEFAULT_SETTINGS = {
|
|||
class GlobalSettings(MutableMapping):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.__settings_file = os.path.join(get_user_dir(), "settings.json")
|
||||
# We set create=False here because this code is executed on module load
|
||||
# and via imports also runs on generate-inx-files, which with the Nix
|
||||
# package manager is executed with a non-writable home directory.
|
||||
user_dir = get_user_dir(create=False)
|
||||
self.__settings_file = os.path.join(user_dir, "settings.json")
|
||||
self.__settings = {}
|
||||
|
||||
for name, value in DEFAULT_METADATA.items():
|
||||
|
|
Ładowanie…
Reference in New Issue