ebs-linuxnode-core 3.2.1__tar.gz → 3.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ebs-linuxnode-core-3.2.1/ebs_linuxnode_core.egg-info → ebs_linuxnode_core-3.2.3}/PKG-INFO +13 -1
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/basenode.py +2 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/config.py +45 -0
- ebs_linuxnode_core-3.2.3/ebs/linuxnode/core/tempfs.py +69 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3/ebs_linuxnode_core.egg-info}/PKG-INFO +13 -1
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs_linuxnode_core.egg-info/SOURCES.txt +3 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs_linuxnode_core.egg-info/requires.txt +1 -0
- ebs_linuxnode_core-3.2.3/ebs_linuxnode_core.egg-info/scm_file_list.json +24 -0
- ebs_linuxnode_core-3.2.3/ebs_linuxnode_core.egg-info/scm_version.json +8 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/setup.py +2 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/.gitignore +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/__init__.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/__init__.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/__init__.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/background.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/basemixin.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/busy.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/constants.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/http.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/log.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/nodeid.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/resources.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/core/shell.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/db/__init__.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs/linuxnode/db/sequence.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs_linuxnode_core.egg-info/dependency_links.txt +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs_linuxnode_core.egg-info/top_level.txt +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/example.py +0 -0
- {ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ebs-linuxnode-core
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.3
|
|
4
4
|
Summary: Twisted based linux application node core
|
|
5
5
|
Home-page: https://github.com/ebs-universe/ebs-linuxnode-core
|
|
6
6
|
Author: Chintalagiri Shashank
|
|
@@ -12,3 +12,15 @@ Classifier: Programming Language :: Python
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.6
|
|
14
14
|
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Requires-Dist: six
|
|
16
|
+
Requires-Dist: setuptools-scm
|
|
17
|
+
Requires-Dist: appdirs
|
|
18
|
+
Requires-Dist: twisted[tls]
|
|
19
|
+
Requires-Dist: SQLAlchemy
|
|
20
|
+
Requires-Dist: arrow
|
|
21
|
+
Requires-Dist: raspi_system
|
|
22
|
+
Requires-Dist: netifaces
|
|
23
|
+
Requires-Dist: ifcfg
|
|
24
|
+
Requires-Dist: psutil
|
|
25
|
+
Requires-Dist: memory_tempfile
|
|
26
|
+
Requires-Dist: treq
|
|
@@ -10,6 +10,7 @@ from .shell import BaseShellMixin
|
|
|
10
10
|
from .http import HttpClientMixin
|
|
11
11
|
from .resources import ResourceManagerMixin
|
|
12
12
|
from .background import BackgroundCoreMixin
|
|
13
|
+
from .tempfs import TempFSMixin
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class BaseIoTNode(BackgroundCoreMixin,
|
|
@@ -17,6 +18,7 @@ class BaseIoTNode(BackgroundCoreMixin,
|
|
|
17
18
|
HttpClientMixin,
|
|
18
19
|
BaseShellMixin,
|
|
19
20
|
NodeBusyMixin,
|
|
21
|
+
TempFSMixin,
|
|
20
22
|
NodeLoggingMixin,
|
|
21
23
|
NodeIDMixin):
|
|
22
24
|
_has_gui = False
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
import os
|
|
11
|
+
import shutil
|
|
11
12
|
import pkg_resources
|
|
13
|
+
|
|
14
|
+
from pathlib import Path
|
|
12
15
|
from six.moves.configparser import ConfigParser
|
|
13
16
|
from collections import namedtuple
|
|
14
17
|
from appdirs import user_config_dir
|
|
@@ -37,6 +40,48 @@ class IoTNodeConfig(object):
|
|
|
37
40
|
def appname(self):
|
|
38
41
|
return self._appname
|
|
39
42
|
|
|
43
|
+
def config_dir(self):
|
|
44
|
+
"""
|
|
45
|
+
Return the application's configuration directory.
|
|
46
|
+
|
|
47
|
+
This is the same directory used by IoTNodeConfig for
|
|
48
|
+
config.ini.
|
|
49
|
+
"""
|
|
50
|
+
path = Path(user_config_dir(self.appname))
|
|
51
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
52
|
+
return path
|
|
53
|
+
|
|
54
|
+
def ensure_app_resource(self, filename):
|
|
55
|
+
"""
|
|
56
|
+
Return the user-editable copy of a packaged resource.
|
|
57
|
+
|
|
58
|
+
On first execution the packaged resource is copied into the
|
|
59
|
+
application's configuration directory.
|
|
60
|
+
|
|
61
|
+
Subsequent executions always use the copy from the
|
|
62
|
+
configuration directory.
|
|
63
|
+
|
|
64
|
+
Deleting the copied file restores the packaged default on the
|
|
65
|
+
next application start.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
destination = self.config_dir() / filename
|
|
69
|
+
|
|
70
|
+
if destination.exists():
|
|
71
|
+
return destination
|
|
72
|
+
|
|
73
|
+
destination.parent.mkdir(
|
|
74
|
+
parents=True,
|
|
75
|
+
exist_ok=True,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
shutil.copy2(
|
|
79
|
+
self.get_path(f"resources/{filename}"),
|
|
80
|
+
destination
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return destination
|
|
84
|
+
|
|
40
85
|
@property
|
|
41
86
|
def _config_file(self):
|
|
42
87
|
return os.path.join(user_config_dir(self.appname), 'config.ini')
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import shutil
|
|
4
|
+
import tempfile
|
|
5
|
+
from memory_tempfile import MemoryTempfile
|
|
6
|
+
|
|
7
|
+
from .basemixin import BaseMixin
|
|
8
|
+
from .log import NodeLoggingMixin
|
|
9
|
+
from .config import ElementSpec
|
|
10
|
+
from .config import ItemSpec
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TempFSMixin(NodeLoggingMixin, BaseMixin):
|
|
14
|
+
def __init__(self, *args, **kwargs):
|
|
15
|
+
super(TempFSMixin, self).__init__(*args, **kwargs)
|
|
16
|
+
self._tempfile = None
|
|
17
|
+
self._tempdir = None
|
|
18
|
+
|
|
19
|
+
def install(self):
|
|
20
|
+
super(TempFSMixin, self).install()
|
|
21
|
+
_elements = {
|
|
22
|
+
'tmpfs_prefer_memory': ElementSpec('tmpfs', 'memory_prefer', ItemSpec(bool, fallback=True)),
|
|
23
|
+
'tmpfs_force_memory': ElementSpec('tmpfs', 'memory_force', ItemSpec(bool, fallback=False)),
|
|
24
|
+
'tmpfs_clean_on_exit': ElementSpec('tmpfs', 'clean_on_exit', ItemSpec(bool, fallback=True)),
|
|
25
|
+
}
|
|
26
|
+
for name, spec in _elements.items():
|
|
27
|
+
self.config.register_element(name, spec)
|
|
28
|
+
|
|
29
|
+
def _tempfile_init(self):
|
|
30
|
+
if self.config.tmpfs_force_memory:
|
|
31
|
+
# TODO This should use MemoryTempfile to find a tmpfs or ramfs path,
|
|
32
|
+
# and fail (throw exception) if a suitable path does not exist.
|
|
33
|
+
# - The assumption is going to be that it will be upto the deployment
|
|
34
|
+
# to ensure a suitable path exists.
|
|
35
|
+
# - Mounting here is not viable due to permission issues
|
|
36
|
+
# - Using pyfilesystem2 is not viable since all users will also need
|
|
37
|
+
# to treat it as a pyfilesystem2 object, and external processes
|
|
38
|
+
# cannot be handed this path.
|
|
39
|
+
raise NotImplementedError
|
|
40
|
+
elif self.config.tmpfs_prefer_memory:
|
|
41
|
+
self._tempfile = MemoryTempfile()
|
|
42
|
+
else:
|
|
43
|
+
self._tempfile = tempfile
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def tempfile(self):
|
|
47
|
+
if not self._tempfile:
|
|
48
|
+
self._tempfile_init()
|
|
49
|
+
return self._tempfile
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def tempdir(self):
|
|
53
|
+
if not self._tempdir:
|
|
54
|
+
self._tempdir = self.tempfile.mkdtemp()
|
|
55
|
+
return self._tempdir
|
|
56
|
+
|
|
57
|
+
def start(self):
|
|
58
|
+
super().start()
|
|
59
|
+
self.log.debug(f"Using tempfs: {self.tempfile.gettempdir()}")
|
|
60
|
+
self.log.info(f"Using tempdir: {self.tempdir}")
|
|
61
|
+
|
|
62
|
+
def stop(self):
|
|
63
|
+
if self.tempdir:
|
|
64
|
+
if self.config.tmpfs_clean_on_exit:
|
|
65
|
+
self.log.info(f"Cleaning up tempdir: {self.tempdir}")
|
|
66
|
+
shutil.rmtree(self.tempdir)
|
|
67
|
+
else:
|
|
68
|
+
self.log.info(f"Not cleaning up tempdir: {self.tempdir}")
|
|
69
|
+
super().stop()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ebs-linuxnode-core
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.3
|
|
4
4
|
Summary: Twisted based linux application node core
|
|
5
5
|
Home-page: https://github.com/ebs-universe/ebs-linuxnode-core
|
|
6
6
|
Author: Chintalagiri Shashank
|
|
@@ -12,3 +12,15 @@ Classifier: Programming Language :: Python
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.6
|
|
14
14
|
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Requires-Dist: six
|
|
16
|
+
Requires-Dist: setuptools-scm
|
|
17
|
+
Requires-Dist: appdirs
|
|
18
|
+
Requires-Dist: twisted[tls]
|
|
19
|
+
Requires-Dist: SQLAlchemy
|
|
20
|
+
Requires-Dist: arrow
|
|
21
|
+
Requires-Dist: raspi_system
|
|
22
|
+
Requires-Dist: netifaces
|
|
23
|
+
Requires-Dist: ifcfg
|
|
24
|
+
Requires-Dist: psutil
|
|
25
|
+
Requires-Dist: memory_tempfile
|
|
26
|
+
Requires-Dist: treq
|
{ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs_linuxnode_core.egg-info/SOURCES.txt
RENAMED
|
@@ -15,10 +15,13 @@ ebs/linuxnode/core/log.py
|
|
|
15
15
|
ebs/linuxnode/core/nodeid.py
|
|
16
16
|
ebs/linuxnode/core/resources.py
|
|
17
17
|
ebs/linuxnode/core/shell.py
|
|
18
|
+
ebs/linuxnode/core/tempfs.py
|
|
18
19
|
ebs/linuxnode/db/__init__.py
|
|
19
20
|
ebs/linuxnode/db/sequence.py
|
|
20
21
|
ebs_linuxnode_core.egg-info/PKG-INFO
|
|
21
22
|
ebs_linuxnode_core.egg-info/SOURCES.txt
|
|
22
23
|
ebs_linuxnode_core.egg-info/dependency_links.txt
|
|
23
24
|
ebs_linuxnode_core.egg-info/requires.txt
|
|
25
|
+
ebs_linuxnode_core.egg-info/scm_file_list.json
|
|
26
|
+
ebs_linuxnode_core.egg-info/scm_version.json
|
|
24
27
|
ebs_linuxnode_core.egg-info/top_level.txt
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".gitignore",
|
|
4
|
+
"setup.py",
|
|
5
|
+
"example.py",
|
|
6
|
+
"ebs/__init__.py",
|
|
7
|
+
"ebs/linuxnode/__init__.py",
|
|
8
|
+
"ebs/linuxnode/db/sequence.py",
|
|
9
|
+
"ebs/linuxnode/db/__init__.py",
|
|
10
|
+
"ebs/linuxnode/core/log.py",
|
|
11
|
+
"ebs/linuxnode/core/shell.py",
|
|
12
|
+
"ebs/linuxnode/core/tempfs.py",
|
|
13
|
+
"ebs/linuxnode/core/config.py",
|
|
14
|
+
"ebs/linuxnode/core/__init__.py",
|
|
15
|
+
"ebs/linuxnode/core/basemixin.py",
|
|
16
|
+
"ebs/linuxnode/core/background.py",
|
|
17
|
+
"ebs/linuxnode/core/basenode.py",
|
|
18
|
+
"ebs/linuxnode/core/constants.py",
|
|
19
|
+
"ebs/linuxnode/core/resources.py",
|
|
20
|
+
"ebs/linuxnode/core/http.py",
|
|
21
|
+
"ebs/linuxnode/core/busy.py",
|
|
22
|
+
"ebs/linuxnode/core/nodeid.py"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ebs-linuxnode-core-3.2.1 → ebs_linuxnode_core-3.2.3}/ebs_linuxnode_core.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|