Skip to content

Commit

Permalink
deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Nov 14, 2024
1 parent 636dc88 commit d723218
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 42 deletions.
41 changes: 2 additions & 39 deletions ovos_workshop/resource_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def locate_base_directories(skill_directory: str,
"""
base_dirs = [Path(skill_directory, resource_subdirectory)] if \
resource_subdirectory else []
base_dirs += [Path(skill_directory, "locale"),
Path(skill_directory, "text")]
base_dirs += [Path(skill_directory, "locale")]
candidates = []
for directory in base_dirs:
if directory.exists():
Expand All @@ -79,8 +78,7 @@ def locate_lang_directories(lang: str, skill_directory: str,
@param resource_subdirectory: optional extra resource directory to prepend
@return: list of existing skill resource directories for the given lang
"""
base_dirs = [Path(skill_directory, "locale"),
Path(skill_directory, "text")]
base_dirs = [Path(skill_directory, "locale")]
if resource_subdirectory:
base_dirs.append(Path(skill_directory, resource_subdirectory))
candidates = []
Expand All @@ -103,41 +101,6 @@ def locate_lang_directories(lang: str, skill_directory: str,
return [c[0] for c in candidates]


def resolve_resource_file(res_name: str) -> Optional[str]:
"""Convert a resource into an absolute filename.
Resource names are in the form: 'filename.ext'
or 'path/filename.ext'
The system wil look for $XDG_DATA_DIRS/mycroft/res_name first
(defaults to ~/.local/share/mycroft/res_name), and if not found will
look at /opt/mycroft/res_name, then finally it will look for res_name
in the 'mycroft/res' folder of the source code package.
Example:
With mycroft running as the user 'bob', if you called
``resolve_resource_file('snd/beep.wav')``
it would return either:
'$XDG_DATA_DIRS/mycroft/beep.wav',
'/home/bob/.mycroft/snd/beep.wav' or
'/opt/mycroft/snd/beep.wav' or
'.../mycroft/res/snd/beep.wav'
where the '...' is replaced by the path
where the package has been installed.
Args:
res_name (str): a resource path/name
Returns:
(str) path to resource or None if no resource found
"""
log_deprecation(f"This method has moved to `ovos_utils.file_utils`",
"0.1.0")
from ovos_utils.file_utils import resolve_resource_file
config = Configuration()
return resolve_resource_file(res_name, config=config)


def find_resource(res_name: str, root_dir: str, res_dirname: str,
lang: Optional[str] = None) -> Optional[Path]:
"""
Expand Down
6 changes: 3 additions & 3 deletions ovos_workshop/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def save_meta(self, generate: bool = False):
@requires_backend
def upload(self, generate: bool = False):
if not is_paired():
LOG.error("Device needs to be paired to upload settings")
LOG.debug("Device needs to be paired to upload settings")
return
self.remote_settings.settings = dict(self.skill.settings)
if generate:
Expand All @@ -126,7 +126,7 @@ def upload(self, generate: bool = False):
@requires_backend
def upload_meta(self, generate: bool = False):
if not is_paired():
LOG.error("Device needs to be paired to upload settingsmeta")
LOG.debug("Device needs to be paired to upload settingsmeta")
return
if generate:
self.remote_settings.settings = dict(self.skill.settings)
Expand All @@ -136,7 +136,7 @@ def upload_meta(self, generate: bool = False):
@requires_backend
def download(self):
if not is_paired():
LOG.error("Device needs to be paired to download remote settings")
LOG.debug("Device needs to be paired to download remote settings")
return
self.remote_settings.download()
# we do not update skill object settings directly
Expand Down

0 comments on commit d723218

Please sign in to comment.