diff --git a/README.md b/README.md
index 56a5618..3a0e071 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,7 @@ The default configuration file comes with a sample configuration, making it easy
Most options are easy to understand at first glance, and some are described in more details [later](https://github.com/akpw/mktxp#advanced-features).
-💡 To automatically migrate from the older `mktxp.conf` format in the existing installs, just set `compact_default_conf_values = True` in [the mktxp system config](https://github.com/akpw/mktxp#mktxp-system-configuration)
+💡 To automatically migrate from the older `mktxp.conf` format in the existing installs, just set `compact_default_conf_values = True` in [the mktxp system config](https://github.com/akpw/mktxp#mktxp-system-configuration)
#### Local install
If you have a local MKTXP installation, you can edit the configuration file with your default system editor directly from mktxp:
@@ -143,7 +143,7 @@ docker run -v "$(pwd)/mktxp:/home/mktxp/mktxp/" -p 49090:49090 -it --rm ghcr.io/
#### MKTXP stack install
[MKTXP Stack Getting Started](https://github.com/akpw/mktxp-stack#install--getting-started) provides similar instructions around editing the mktxp.conf file and, if needed, adding a dedicated API user to your Mikrotik RouterOS devices as mentioned below.
-💡 *In the case of usage within a [Docker Swarm](https://docs.docker.com/engine/swarm/), please do make sure to have all settings explicitly set in both the `mktxp.conf` and `_mktxp.conf` files. Not doing this may cause [issues](https://github.com/akpw/mktxp/issues/55#issuecomment-1346693843) regarding a `read-only` filesystem.*
+💡 *In the case of usage within a [Docker Swarm](https://docs.docker.com/engine/swarm/), please do make sure to have all settings explicitly set in both the `mktxp.conf` and `_mktxp.conf` files. Not doing this may cause [issues](https://github.com/akpw/mktxp/issues/55#issuecomment-1346693843) regarding a `read-only` filesystem.*
## Mikrotik Device Config
For the purpose of RouterOS device monitoring, it's best to create a dedicated user with minimal required permissions. \
@@ -241,7 +241,7 @@ mktxp edit -i
max_scrape_duration = 10 # Max duration of individual routers' metrics collection (parallel fetch only)
total_max_scrape_duration = 30 # Max overall duration of all metrics collection (parallel fetch only)
- compact_default_conf_values = True # Compact mktxp.conf, so only specific values are kept on the individual routers' level
+ compact_default_conf_values = False # Compact mktxp.conf, so only specific values are kept on the individual routers' level
```
💡 *When changing the default mktxp port for [docker image installs](https://github.com/akpw/mktxp#docker-image-install), you'll need to adjust the `docker run ... -p 49090:49090 ...` command to reflect the new port*
diff --git a/mktxp/cli/config/_mktxp.conf b/mktxp/cli/config/_mktxp.conf
index c92577d..6e14f1c 100644
--- a/mktxp/cli/config/_mktxp.conf
+++ b/mktxp/cli/config/_mktxp.conf
@@ -30,4 +30,4 @@
max_scrape_duration = 10 # Max duration of individual routers' metrics collection (parallel fetch only)
total_max_scrape_duration = 30 # Max overall duration of all metrics collection (parallel fetch only)
- compact_default_conf_values = True # Compact mktxp.conf, so only specific values are kept on the individual routers' level
\ No newline at end of file
+ compact_default_conf_values = False # Compact mktxp.conf, so only specific values are kept on the individual routers' level
\ No newline at end of file
diff --git a/mktxp/cli/config/config.py b/mktxp/cli/config/config.py
index 24b67e4..013f812 100755
--- a/mktxp/cli/config/config.py
+++ b/mktxp/cli/config/config.py
@@ -17,7 +17,7 @@ import shutil
from collections import namedtuple
from configobj import ConfigObj
from abc import ABCMeta, abstractmethod
-from pkg_resources import Requirement, resource_filename
+import importlib.resources
from mktxp.utils.utils import FSHelper
@@ -262,9 +262,9 @@ class MKTXPConfigHandler:
self.os_config.mktxp_user_dir_path, '_mktxp.conf')
self._create_os_path(self.usr_conf_data_path,
- 'mktxp/cli/config/mktxp.conf')
+ 'cli/config/mktxp.conf')
self._create_os_path(self.mktxp_conf_path,
- 'mktxp/cli/config/_mktxp.conf')
+ 'cli/config/_mktxp.conf')
self.re_compiled = {}
@@ -309,9 +309,9 @@ class MKTXPConfigHandler:
def _create_os_path(self, os_path, resource_path):
if not os.path.exists(os_path):
# stage from the conf templates
- lookup_path = resource_filename(
- Requirement.parse("mktxp"), resource_path)
- shutil.copy(lookup_path, os_path)
+ ref = importlib.resources.files('mktxp') / resource_path
+ with importlib.resources.as_file(ref) as path:
+ shutil.copy(path, os_path)
def _system_entry_reader(self):
system_entry_reader = {}
diff --git a/mktxp/utils/utils.py b/mktxp/utils/utils.py
index 5368424..5de8e05 100755
--- a/mktxp/utils/utils.py
+++ b/mktxp/utils/utils.py
@@ -21,8 +21,7 @@ import xml.etree.ElementTree as ET
from contextlib import contextmanager
from multiprocessing import Process, Event
from datetime import timedelta
-from pkg_resources import packaging
-
+from packaging.version import parse
''' Utilities / Helpers
@@ -309,7 +308,7 @@ def get_available_updates(channel, ttl_hash=get_ttl_hash()):
title, _, _, _, _, _ = child
# extract and parse the version number from title
version_text = re.findall(r'[\d+\.]+', title.text)[0]
- version_number = packaging.version.parse(version_text)
+ version_number = parse(version_text)
versions.append(version_number)
return versions
@@ -322,15 +321,15 @@ def parse_ros_version(string):
1.2.3, stable
"""
version, channel = re.findall(r'([\d\.]+).*?([\w]+)', string)[0]
- return packaging.version.parse(version), channel
+ return parse(version), channel
-def builtin_wifi_capsman_version(string):
+def builtin_wifi_capsman_version(version):
"""Try to check if the version is Wifi version of RouterOS (>= 7.13).
If anything goes wrong, return None.
Returns a boolean"""
try:
- cur_version, _ = parse_ros_version(string)
- if cur_version >= packaging.version.parse('7.13'):
+ cur_version, _ = parse_ros_version(version)
+ if cur_version >= parse('7.13'):
return True
except Exception as err:
print(f'could not get current RouterOS version, because: {str(err)}')